Debugging

In-game diagnostics, the flags and environment variables the code reads, and how to reproduce a problem headless (checked against the source on 2026-11-10).

In-game diagnostics

Typed cheat words work in Play when the build has cheats enabled (the CMake option GALAXY_EGGBERT_ENABLE_CHEATS, ON by default; OFF compiles out typed words, F12 and the hidden cheat menu). The full list is on Cheats & Diagnostics; these are the ones that help when debugging:

Word or keyEffect
debugToggles the diagnostics panel (only in Play): simulation time and ticks, mission and sky region, lives, Blupi's raw position and cell, velocity in blocks/s, yaw, movement mode (ground or air, vehicle), animation state and icon, game speed, keys and touches held, gamepad and accelerometer state. Upper right on desktop, upper centre on touch layouts. Lines built by src/GalaxyEggbert/Game/DebugOverlay.hpp
positionShows Blupi's place (x, y, z) in the active cheats' list, with the world's X, Y and Z axes drawn as arrows that turn with the camera
fpsShows the frames drawn per second in the cheats' list
ghost, megablupi, zoomWalk through walls; invincibility; step the chase camera out
help / cheats, F1A paused overlay listing every cheat word; F1 shows the controls help
F5, F6, TabNormal and fast game speed; Tab steps slow motion 0.5, 0.25, 0.125 and back. F7/F8 (faster still) only after the quick cheat
F12The cheat menu

fairplay turns the toggles off and locks cheat entry (typing it again unlocks); honest locks every cheat until the game quits. If a debugging word does nothing, check for those.

Command-line flags

Parsed in src/GalaxyEggbertCNA/main.cpp. Run the game from its build directory, where a post-build step stages its assets.

FlagEffect
--mission NSkip the menus and start mission N
--spawn x,y,z[,yaw]With --mission: place Blupi at that raw grid position (yaw 0 faces -Z, 90 faces +X)
--autoplay <script>Play the mission by a QA script, write autoplay_trace.txt, exit 0 when it passed (Testing & QA)
--galaxyWith --mission: start from the selected player's own galaxy
--golden-capture, --golden-capture-traceThe deterministic captures behind tests/golden/
--record-demo <file>, --demo-ticks N, --demo-title <text>, --verify-demo <file>Record a main-menu demo; replay one and compare its end state (tools/record_demo.sh, tools/verify_demos.sh)
--user DIRKeep the player's files (savedata.txt, resume.txt, demos/, customworlds/) in DIR instead of the system's per-user folder; GALAXY_USER_DIR does the same
Use a scratch user folder Since 2026-11-10 a desktop build keeps the player's files in the per-user data folder ($XDG_DATA_HOME/Galaxy Eggbert on Linux). When you experiment with saves, resume or the editor, pass --user with a throwaway directory so your own progress is not touched. The QA scripts already set GALAXY_USER_DIR to their run directory.

Diagnostic environment variables

Each of these is read by the code named; the effects and graphics settings themselves (GALAXY_EFFECTS, GALAXY_TEXTURES) are on Configuration.

VariableEffectRead in
GALAXY_PERF=1Every 120 frames prints the mean draw time and the models drawn, their triangles and the models culled per frame; also prints how terrain changes were patched or rebuilt and how long it tookGalaxyEggbertGameDraw.cpp, GalaxyEggbertGameLoad.cpp
GALAXY_MODEL_CULL=0Draws every object model, without the frustum testGalaxyEggbertGame.cpp
GALAXY_EFFECTS_DEBUG=shadow|occlusion|gi|spritesWith the 3D effects on: draws the terrain as the sun's shadow factor or the ambient occlusion alone; gi and sprites (Ultra) show the light from around and the light the sprites takeSceneShaders.cpp
GALAXY_ULTRA_DEBUG=1..9Ultra's final pass: 1 no grade, 2 no glow, 3 fixed exposure, 4 the scene as drawn, 5 the exposure, 6 ambient occlusion, 7 contact shadow, 8 reflection weight, 9 the light scattered by the airUltraFinish.cpp
GALAXY_RELIEF_GI=0Ultra without the global illumination on the terrain reliefs, to compareWorldRenderer.cpp
GALAXY_INTERP_TRACE=<file>In Play, writes one line per drawn frame to the file: the step, the interpolation alpha, the drawn eye position, camera shake and the moving objects drawn between steps (for frame rates above 60)GalaxyEggbertGameDraw.cpp
GALAXY_RESUME_SELFTEST=<ticks>At that tick of a mission, serializes the resume log, restores from it, and prints RESUME SELFTEST equal or ... different: <fields> (exit code 1 when different)GalaxyEggbertGameDemo.cpp
GALAXY_TERRAIN_RELIEF=0|1Overrides the Setup's 3D terrain reliefs; _DIR reads reliefs from another directory, _RADIUS sets the radius around the camera's target (default 8 blocks), _OVERHANG=1 keeps overhangs into the air, _TIMING prints the first relief build's timeGalaxyEggbertGameLoad.cpp, GalaxyEggbertGameScene.cpp
GALAXY_ACCEL_PAD=1Shows the accelerometer-steering pad without a sensorGalaxyEggbertGameUpdate.cpp
AUTOPLAY_SHOTS=N, AUTOPLAY_REALTIME=1With --autoplay: save a frame every N ticks into autoplay_shots/; pace at 60 Hz instead of as fast as possibleGalaxyEggbertGame.cpp

Headless runs

The game needs a GL context. Under Xvfb, keep it silent with the dummy audio driver, as the QA scripts do:

cd build-cna-opengl3
SDL_AUDIODRIVER=dummy SDL_VIDEODRIVER=x11 xvfb-run -a -s "-screen 0 1280x720x24" \
    ./GalaxyEggbert --user qa-user --mission 12 --spawn 48,1,68,0

For anything you want to repeat, prefer the scripts: tools/autoplay.sh for gameplay and tools/qa_live.sh for screenshots (Testing & QA). Intermittent loss of window focus or input has been seen under Xvfb; it has not been traced to a defect in this code.

Reproducing a gameplay bug

  1. Start at the place: --mission N --spawn x,y,z,yaw (the debug panel's cell line gives raw coordinates).
  2. Write a short probe script (tools/autoplay/probes/ holds examples) with trace N to log every tick, shots N to save frames, and mortal to keep going past a death; run it with tools/autoplay.sh. The run is deterministic, so it reproduces the same way every time.
  3. Compare with the original's code (Decor.cpp and friends in mobile-eggbert) and search the ledgers before changing anything.
  4. Turn the reproduction into a test that fails without the fix (usually in VerifyBlupiMovement or VerifyInteractionSystem).

Context loss (F9)

On native desktop builds, CNA's runtime maps F9 to a simulated GL context loss and recreation. Use it to check that textures and meshes come back. The black distant floor seen after F9 was a CNA defect (upstream_bugs.md UB-009: only the base mip level was restored), fixed in CNA; the game has no workaround of its own.

Logs

API documentation (Doxygen)

When CMake finds Doxygen, it adds the target GalaxyEggbertDocs (cmake --build build-cna-opengl3 --target GalaxyEggbertDocs), which runs Doxygen in the build directory with a configured copy of the repository's Doxyfile. That file leaves INPUT empty and RECURSIVE = NO, so as committed it does not point Doxygen at the sources; the output has not been checked for this page. The headers' own comments (and the Classes pages) are the better reference.