Skip to content

Dev runner

For changes you need to see in the game, the dev runner builds, starts a sandboxed copy of the game, drives it and saves screenshots. It never writes to your game install or your saves.

pixi run dev --quick --keep --shot a.png           # playable in about 3 s, left running
pixi run dev --attach --script "..." --shot b.png  # drive that game again: about 2 s per shot
pixi run dev --skip-story                          # play the story scenes through the in-game skip
pixi run dev --tour tools/dev/tours/menus.tour     # a scripted gamepad walk through the menus
pixi run dev --map 03_cellar.map --wait-active --shot out.png
Option What it does
--quick Starts where the player can move, without the opening scene: every map skips it when the profile's Debug.ScriptDebugOn is set, which this turns on (and runs without it turn off again). The map loads in under a second.
--attach Drives the game already running from a --keep run: no build, no restart.
--user Section.Key=value A value in the test profile's user settings (repeatable).
--skip-story Skips story scenes with the in-game skip until the player can move (about 10 s to playable).
--map <file> Starts in that map.
--menu Opens at the title menu.
--tour <file> Runs a step file (below); shots go to _tour/<name>/ with a contact sheet.
--script <line> Runs an AngelScript line in the current map (repeatable).
--shot <file> Takes a screenshot at the end.
--set Section.Key=value A main settings value for this run (repeatable).
--lang <file> Starts in another language.
--keep Leaves the game running.
--no-build Uses the current build.

The sandbox

The runner links the game's data folders into a sandbox (_stage64 on Windows, ~/amfp_stage on Linux) next to the build under test, with its own save folder and a dev profile. Dev runs use a virtual gamepad, so they work whether or not a controller is connected.

On Linux (including WSL), keep a copy of the game on the Linux disk at ~/amfp_game: reading it through a Windows drive makes startup take minutes. AMFP_GAME_DIR points the runner elsewhere.

On macOS the sandbox is ~/amfp_stage too, linked to the Steam folder (~/Library/Application Support/Steam/steamapps/common/Machine for Pigs), with the build staged as AMFP Enhanced.app. The runner brings the game window to the front after launch; macOS would otherwise leave it behind the terminal. The game closes when a run ends, also after an error; --keep leaves it running.

The dev bridge

With [Dev] Bridge="true" in the main settings (the runner sets it), the game reads commands from a file in its save folder and writes the answers next to it. It stays off unless that setting is on, and the setting is never saved back. Commands include:

Command What it does
ping Answers pong.
state Map, player state, focus, position, view angles, comfort profile, menu window and focus, skip state and more, as key=value pairs.
script <line> Runs AngelScript in the current map.
screenshot <file> Saves the framebuffer.
pad <button>, axis <axis> <value> Presses a virtual pad button, holds a stick or trigger.
keys The pad input bound to each action.
comfort original\|reduced\|comfort Switches the comfort profile at once.
camtrace <steps> <file> [script] Records the camera (angles, field of view, position) every logic step.
trace <entity> <steps> <file> Records a physics body every step.
perf Frame rate and frame time.
quit Closes the game.

Tours

A tour is a short step file: press a button, wait for a game state, take a screenshot. It runs the same way every time and ends with one contact sheet in _tour/<name>/.

pad down until ui_focus=Options    # press until the state matches
pad a
wait window=options                # until the bridge state matches (default 15 s)
shot options_game                  # -> _tour/<name>/NN_options_game.png
script FadePlayerRollTo(40, 3, 120);
bridge camtrace 240 {out}/roll.txt

Tours in tools/dev/tours/: menus (gamepad through every menu), hud (prompts and journal), guidance, comfort (each camera effect under Original and Comfort), loading, loading_screen, saves, and doc_shots (the screenshots in this guide; see Screenshots). The full syntax is in the tour module.

Checks

Script What it checks
tools/dev/comfort_check.py The comfort tour's camera traces: level horizon, turns under the cap, small hit jolt, gentle zoom.
tools/dev/physics_check.py A door, a chair, a bottle and a lever pushed the same way in this 64-bit build and in a 32-bit build with the original physics engine.
tools/dev/fbx_oracle.py Every character animation read by ufbx against the original loader's output.