The Game#
The game is the full simulator. It is one Unreal Engine 5.8 project in Game/ with one C++ module, Acres. It has the farm, the two vehicles, the implements, the weather, the farm traffic and all sensors.
Folders#
| Folder | Content |
|---|---|
Game/Acres.uproject |
The project. The default map is /Game/Maps/ACRE. The game mode is AcresShellGameMode. |
Game/Source/Acres |
The C++ code of the module. |
Game/Config |
The engine, game and input settings (DefaultEngine.ini and the other .ini files). |
Game/Content/Simulation |
The parameter files and the map products (Files and Formats). |
Game/Content |
The assets: meshes, materials, the level. Most files are in Git LFS. |
Game/Shaders |
The shaders of the project. |
Tests/Game |
The tests of the engine-free models, with their own builds (Tests/Game/run.sh). |
Game/Raw/farm-equipment |
The source assets of the implements and the Polaris (Blender files). |
Two Layers of Code#
The code has two layers.
- The engine-free models. These files contain the mathematics. They use standard C++ and SI units, and no Unreal type. The model tests and ACRES Core compile the same files (ACRES Core).
- The Unreal layer. It owns the actors, the threads, the rendering, the sockets and the user interface. At each physics step, it fills the inputs of the models and applies their outputs.
Chaos, the physics engine of Unreal, integrates only the chassis body. The vehicle pawn computes each tire, soil and implement force itself and gives Chaos the totals.
File Groups#
All game code is in Game/Source/Acres. A name without an extension is a .h file and a .cpp file. C++ Headers gives the public declarations of each file.
| Group | Files | Function |
|---|---|---|
| Vehicle pawn | AcresVehicle, AcresVehicleControl.cpp, AcresPolaris.cpp |
The pawn of a vehicle, its physics step, its controls and the Polaris branch. |
| Vehicle models | AcresVehicleModel, AcresUtvModel, AcresSimModel, AcresPowerModel |
The Maxxum, the Polaris with its drive-by-wire, the engine helpers, the fuel and the energy ledger. |
| Soil and ground | AcresSoilModel, AcresSurfaceMap |
The soil library, the tire on soil, the surface class at a point. |
| Implements | AcresImplementModel, AcresImplementCoupling, AcresFieldWorkModel, AcresRig |
The implement forces, their path to the chassis, the marks of field work, the skeletal rigs. |
| Agents and places | AcresAgents, AcresPlaces, AcresGeoUtm.h |
The vehicles of a session, the named places, the UTM projection. |
| Farm | AcresFarmRuntime, AcresFarmModel, AcresFieldSetup, AcresSoilVisuals, AcresCrops.h, AcresDriveRegion |
The crops, the soil water, the ruts, the field settings, the look of the ground and the regional ground. |
| Weather | AcresEnvironment, AcresEnvironmentModel |
The sun, the clouds, the temperature, the wind, the rain and the clock. |
| Sensors | AcresSensors, AcresCameraModel, AcresLidarModel, AcresLidarPhysics.h, AcresLidarGpu, AcresGnssModel |
The sensor recorder and the model of each sensor. |
| Rendering | AcresRenderTier, AcresVideoCapture |
The render tiers, the sensor profile and the video capture. |
| Bridges | AcresRlBridge, AcresCommandTiming.h, AcresSensorStream, AcresSimControl, AcresPathObjects |
The vehicle bridge with its timestamped command queue, the sensor stream, the simulator control channel and the objects on the path. |
| Logs | AcresSessionLog, AcresEpisodeLog, AcresEpisodeSchemas.h, AcresReplay |
The session log, the episode log and the replay input. |
| Application | AcresShell, AcresMenu, AcresSession, AcresHud.cpp, AcresNpc, AcresMapData |
The game mode, the menu, the session configuration, the HUD, the farm traffic and the map folder. |
How a Session Starts#
The menu does not build the simulation in the running map. It writes a session folder with copies of the configuration files. Then it starts the map again with -VehicleDemo -FromMenu -SessionMode=... -EnvConfig=... -VehicleConfig=... -VehicleOutput=... -FieldSetup=.... A command line can start the same session without the menu (Game Command Line).
The game mode makes agent 0. In its BeginPlay, agent 0 reads the agent list, makes the weather and the farm runtimes, and spawns the other agents. The other agents share the farm and the weather. When the command line asks for it, agent 0 then makes the simulator control.
Each agent has its own controls, sensors, bridge ports and logs.

One Physics Step#
Time#
| Item | Value | Source |
|---|---|---|
| Physics step | 1/120 s, on the physics thread (bTickPhysicsAsync=True) |
Game/Config/DefaultEngine.ini |
| Longest physics time of one frame | 0.1 s (12 steps) | MaxPhysicsDeltaTime=0.1 in DefaultEngine.ini |
| Control period of the bridge observations | 0.1 s | Game/Source/Acres/AcresRlBridge.h |
A frame that is longer than 0.1 s makes the simulation slower than real time. Time Stepping gives the rules.
Threads#
| Thread | Work |
|---|---|
| Game thread | Actors, user interface, visuals, sockets, the sensor schedule, lockstep control. |
| Physics thread | The vehicle step at 120 Hz: models, forces, farm marks, log rows, sensor samples. |
| Render thread | Drawing, the camera readback, the GPU LiDAR pass. |
AcresWater |
The soil-water model. |
AcresSensorWriter |
Writes the sensor files. |
AcresSensorStream |
Sends the sensor frames to a client. |
AcresRlReceiver |
Reads the vehicle bridge and stamps each message with its arrival time. |
AcresVideoWriter |
Sends the frames of the window to ffmpeg. |
Render Tiers#
The game selects a render tier at the start. Without -RenderTier=, a GPU with 11776 MiB (11.5 GiB) or more gets the tier high. A GPU with less memory gets the tier low. Source: Game/Source/Acres/AcresRenderTier.cpp.
The GPU LiDAR needs hardware ray tracing. Without it, or with -SensorCpuLidar, the game uses the CPU LiDAR.
Logs and Stop#
The game writes its log to the terminal and to Saved/Logs/Acres.log (Packaged/Linux/Game/Saved in the package). Files and Formats gives the session folder. At each important event the game writes a line with the prefix ACRES_. Use these lines in scripts.
| Log Marker | Event |
|---|---|
ACRES_RENDER_TIER |
The render tier, the GPU memory and the sensor profile. |
ACRES_MAP_DATA |
The map variant and the fields that are different. |
ACRES_SPAWN, ACRES_VEHICLE_READY |
A vehicle got its start pose. A vehicle is ready. |
ACRES_ENVIRONMENT_READY, ACRES_FARM_READY |
The weather and the farm are ready. |
ACRES_SENSOR_START, ACRES_SENSOR_STOP |
A sensor episode started or stopped. The start line shows gpu_lidar=1 or gpu_lidar=0. |
ACRES_SIM_CONTROL_READY |
The simulator control channel is open. |
ACRES_CAPTURE_START, ACRES_CAPTURE_DONE |
The video recording started or stopped. |
To stop a session, push Esc. Without a window, push Ctrl+C one time or use timeout -s INT.
Warning
Push Ctrl+C one time only, then wait. A second interrupt stops the game immediately. The game then does not write session-summary.json and the farm files, and the sensor episode stays open.
Keyboard#
Keyboard and Mouse gives the keys.
Build and Run#
- Install gives the build of the game.
- Game Command Line gives the options.
- Sockets of a Session gives the vehicle bridge, the sensor stream and the simulator control channel.