Skip to content

AcresShell.h#

Acres/Source/Acres/AcresShell.h Generated

Game mode, HUD and the free-fly inspection camera.

Unreal notes: the game mode is the class that decides, when a map loads, which pawn the player gets and which HUD draws on screen. This project has one game mode (set in Config/DefaultEngine.ini) that reads the command line: -VehicleDemo spawns the tractor, -ShellView the inspection camera and anything else the menu. A HUD (AHUD) draws 2D overlays with a canvas every frame after the 3D scene. -RigSelfTest (any mode) checks every rig map against its Blender test poses at start (FAcresRigMap::RunSelfTests).

AAcresShellPawn#

class AAcresShellPawn : public APawn

Free-flying camera for looking around the map (launch flag -ShellView). Not a vehicle.

Also hosts a render benchmark (-RenderBenchmark with -RenderBenchmarkWarmup= / -RenderBenchmarkDuration= / -RenderBenchmarkOutput=) that records per-frame wall times and Unreal's CSV profiler, and a smoke test (-ShellSmoke) used by early packaging checks.

Name Type Unit Default Description
SmoothedFrameSeconds float 1.f / 60.f Exponentially smoothed frame time, s (shown by the HUD as an FPS estimate).

AAcresShellPawn::Tick#

Reads keyboard and mouse, moves the camera, updates SmoothedFrameSeconds and runs the benchmark or smoke test.

virtual void Tick(float DeltaSeconds) override;

AAcresShellPawn::ResetView#

Puts the camera back at the home viewpoint over the farm yard.

void ResetView();

AAcresShellPawn::MoveView#

Moves the camera in its own frame.

Argument Description
LocalInput Direction in camera space (X forward, Y right, Z up), not normalised.
DeltaSeconds Frame time, s.
Speed Speed, cm/s.
void MoveView(const FVector& LocalInput, float DeltaSeconds, float Speed);

AAcresShellHUD#

class AAcresShellHUD : public AHUD

On-screen driving display, GTA-style: the view stays clean and information appears only while it matters.

Layout with a tractor (all sizes are written for a 1080 px tall screen and scaled with the viewport):

+------------------------------------------------------------------------------------------+
| [help box: key help for the first      |                        15 Jul  10:02            |
|  seconds, hints such as "Press H to    |                      (sun) 23 °C · 2.4 mm/h    |
|  start harvesting", safety alerts]     |                    ● Recording  12.3 s         |
|                                        |                         Bunker  320 / 600 kg   |
|                                        |                          Draft  12.3 kN        |
|                                                                                          |
|  Field F48  Growth 72 %                                            [LiDAR preview card]  |
|  +-------------+                                                     12 km/h  [F10]      |
|  |  minimap    |                                                     ======------- rpm   |
|  +-------------+                                                                         |
|  ====slip==== ====bunker====                                                             |
+------------------------------------------------------------------------------------------+

Top right: clock and a one-line weather readout, then rows that fade in only when relevant (recording, replay, RL bridge, bunker, draft, diff lock, fast time, strong wind). Top left: a translucent help box for contextual hints, the first seconds' key help (hold Tab for every key), RL agent captions and red safety alerts. Bottom left: north-up minimap (Content/Simulation/ACRE/minimap.png) in a rounded frame with thin wheel-slip / bunker bars under it. Bottom right: a small speed, gear and rpm readout, and the live LiDAR point cloud from above while a LiDAR recording runs. F1 swaps all of it for the engineering panel with raw telemetry.

Drawn with the HUD canvas (not Slate) so it shows up in F12 screenshots, honours -NoHUD and showhud, and needs no widget lifetime handling; rounded corners come from small anti-aliased disc textures made at start-up. Implementation: AcresHud.cpp.

AAcresShellHUD::DrawHUD#

Called by Unreal once per frame to draw the overlay.

virtual void DrawHUD() override;

AAcresShellGameMode#

class AAcresShellGameMode : public AGameModeBase

The project's game mode: picks the pawn from the command line and sets the HUD.

No flag: menu (AAcresMenuPawn). -VehicleDemo: tractor (AAcresVehiclePawn). -ShellView: inspection camera. -RigSelfTest, with any of them: evaluate every rig map at its Blender test poses when play starts and log ACRES_RIG_SELFTEST lines (FAcresRigMap::RunSelfTests).