3 local playtest and standalone preview
forgejo-actions edited this page 2026-07-11 10:33:50 +00:00

Local Playtest And Standalone Preview

Purpose

Local playtest, standalone shell, and standalone UI preview share runtime systems but serve different jobs. Local playtest starts gameplay from the editor or CLI without the editor shell. Standalone game starts the shipped-style login and world shell. Standalone UI preview renders authored standalone .aetherui screens inside editor preview contexts without launching the full standalone shell.

Steps

  1. Choose editor-launched local playtest, direct --local-playtest, standalone game, or standalone UI preview based on the thing being verified.
  2. Pass an explicit scene, entry point, selected tile, preview scenario, or debug overlay when the default boot state is not enough.
  3. For editor-launched playtests, inspect the spawned command line, log path, and JSON report path recorded by the editor.
  4. For standalone checks, confirm exported settings and standalone layout assets are the source of the startup state.
  5. Rerun the scenario with the smallest explicit CLI once the editor path reproduces a failure.

Mode Selection

AppMode::detect() reads AETHER_APP_MODE first, then scans CLI selectors. The mode profiles are:

  • EditorSandbox: selectors editor, editor-sandbox, --editor, and --editor-sandbox; shows editor UI, supports authoring, allows local prediction, and persists offline state.
  • LocalPlaytest: selectors playtest, local-playtest, --playtest, and --local-playtest; hides editor UI, does not support authoring, allows local prediction, and persists offline state.
  • StandaloneGame: selectors game, standalone, and --standalone-game; hides editor UI, requires network authority, and does not persist offline state locally.

Local playtest keeps the editor-like foundation stack with Egui available, but only registers the connection resources and scene-authority bridge from multiplayer. Standalone registers the standalone shell and full multiplayer path.

Editor-Launched Playtest

Editor playtest requests serialize into LocalPlaytestLaunchConfig, then LocalPlaytestProcessSupervisor launches the current executable with config.to_cli_args(). The editor does not fork a custom runtime; it starts the same binary in --local-playtest mode with explicit launch flags.

For each request, the supervisor creates:

  • A run id shaped like editor-playtest-{editor_pid}-{request_id}.
  • A log file under target/editor-playtests/{run_id}.log.
  • A report path under target/editor-playtests/{run_id}.json.
  • Environment variables AETHER_EDITOR_PLAYTEST_RUN_ID and AETHER_EDITOR_PLAYTEST_REPORT_PATH.

The child process receives stdout and stderr redirected to the log file. The editor records the process id, command line, scene path, log path, report path, and later the exit code. Stop and relaunch commands operate on the active or last recorded session.

Launch Flags

LocalPlaytestLaunchSpec accepts these scene and placement flags:

  • --scene, --scene-path, or --preview-scenario-scene with a scene path or shorthand.
  • --entry, --entry-point, or --entry-point-id.
  • --tile x,y or --selected-tile x,y.
  • --tile-x N --tile-y N.

Scene shorthand is normalized for author convenience. 4 becomes scenes/scene_4.scene, scene_4 becomes scenes/scene_4.scene, cave becomes scenes/cave.scene, and assets/scenes/cave.scene becomes scenes/cave.scene.

Preview scenario replay is opt-in with:

  • --preview-scenario ID
  • --preview-scenario-replay
  • --preview-scenario-json
  • --preview-scenario-report text|json
  • --preview-scenario-report-format text|json

When replay is enabled, local playtest builds the replay CLI args from the launch scene, optional scenario filter, and report format, then logs the replay report or error.

Debug Overlays

Debug overlays can be enabled by canonical name through repeated --debug-overlay NAME or a comma-separated --debug-overlays list. all enables every descriptor-backed overlay, and disabled overlay aliases turn specific overlay flags off.

Convenience flags include:

  • --debug-triggers
  • --debug-npcs
  • --debug-mobs
  • --debug-nav or --debug-navigation
  • --debug-collision
  • --debug-spawn-safety or --debug-no-spawn
  • --debug-ai or --debug-ai-state
  • --debug-aggro, --debug-leash, or --debug-aggro-leash
  • --debug-authority or --debug-authority-queue
  • --playtest-doctor or --debug-doctor
  • --debug-damage-numbers
  • --no-damage-numbers or --debug-no-damage-numbers
  • --debug-crit-damage
  • --debug-no-crit-damage or --debug-no-crit-emphasis
  • --debug-damage-number-lifetime-scale N

Navigation implies collision and spawn-safety display. NPCs imply AI-state display. Mobs imply aggro/leash display. Damage number lifetime is clamped to the runtime range before serialization.

Logs And Reports

Local playtest exits with code 2 when launch parsing or scene validation fails. The failure is logged and printed to stderr. Relative scene paths must exist under configured asset roots; absolute paths must exist on disk.

When runtime profiling is configured to emit Tracy identity reports, local playtest emits JSON events for startup and scene load. Startup reports include process id, app mode, profile label, requested scene, resolved scene, trace path, and scene_load_result = requested. Scene-load reports add loaded scene path, id, name, bounds, layer count, tilemap count, and any scene I/O error.

Editor-launched playtests write process stdout/stderr to the per-run log file and write a per-run JSON status report through AETHER_EDITOR_PLAYTEST_REPORT_PATH. The report records the run id, status, scene path, entry point, selected tile, and preview scenario when present. Use the recorded command line, log path, and report path from the editor session record when reproducing a failed run outside the editor.

Exported Settings

Standalone runtime settings load from config/exported_game.json. The exported payload includes:

  • Login defaults: login_base_url, protocol version, client build, and optional insecure QUIC allowance.
  • Camera defaults: world zoom, follow-player flag, and follow smoothing.
  • Session defaults: startup scene path, optional startup entry point, gameplay UI visibility, and death menu visibility.
  • Lighting defaults: placed-light full-quality slots and shader budget.
  • UI skin profile.

Editor standalone preview settings live in the local config file editor_standalone_preview_settings.json. If preview settings are missing or recovered, the editor falls back to exported settings. Preview settings carry a schema version and can be migrated or recovered through the client-local preference store.

Pack/export dependency tracking includes the exported settings file, startup scene, pack-export bake products, exported UI layout assets, and UI skin profile dependencies. Export validation checks login URL shape, protocol ranges, client build presence, camera ranges, lighting policy, session scene and entry point, UI skin profile, and required UI layout assets.

Standalone Boot

StandalonePlugin owns the standalone shell. On startup it parses runtime developer options, inserts debug overlays and schedule simulation, loads StandaloneRuntimeSettings, initializes shell/login/character resources, syncs the Bevy skin cache, and registers standalone screen controllers.

Standalone setting precedence is:

  1. Replicated multiplayer state owns gameplay facts when a realtime session is active.
  2. Authored scene/runtime data owns scene-local placement and transitions once a scene is loaded.
  3. Exported standalone settings seed boot-time and presentation defaults.
  4. Editor preview overrides stay editor-scoped and must not overwrite exported or replicated state.

The first world load chooses an authoritative zone handoff scene when available, otherwise the exported startup scene, otherwise the built-in default scene. The exported startup entry point only seeds the first scene load; authored transitions own later travel.

Standalone Flow States

StandaloneFlowState defines the shell states outside the shared gameplay world:

  • Boot
  • Title
  • Login
  • RealmSelect
  • CharacterCreate
  • CharacterSelect
  • Loading
  • InGame
  • Paused
  • Death
  • Respawn
  • Logout

Boot immediately plans Title. Login success plans RealmSelect. Loading can fall back to Login if no account is authenticated, CharacterSelect if no character is selected, or CharacterSelect when a handshake is rejected. Enter-world plans request a scene load once and then moves to InGame. Logout requests realtime disconnect, clears shell world-load state, unloads scene, resets runtime session and multiplayer UI state, and returns to Login when complete. Runtime connection loss also unloads and returns to Login; zone-transfer recovery returns to CharacterSelect with a recovery status.

Standalone UI Preview

StandaloneUiPreviewPlugin does not own login, session, or world flow. It only keeps the Bevy UI skin cache fresh and spawns preview roots for selected standalone layout assets when live runtime preview is requested.

Preview root kind is derived from the selected layout asset:

  • StandaloneTitle, StandaloneLogin, StandaloneRealmSelect, StandaloneCharacterSelect, StandaloneLoading, and StandaloneDeath use a centered root.
  • StandaloneCharacterCreate uses the character-builder root.
  • Non-standalone assets do not spawn standalone preview roots.

The preview lifecycle includes selected asset, root kind, preview rectangle, and document revision. If any of those change, the old preview tree is despawned and a new layout screen is spawned with the current fonts and skin cache.

Expected Outputs

Editor-launched playtest should produce a child process, a per-run log file, and a per-run JSON status report under target/editor-playtests. Local playtest should either load the requested scene or exit with a clear parse or validation failure. Standalone boot should reach the expected shell flow state, and standalone UI preview should spawn the selected standalone layout root.

Common Mistakes

  • Passing a scene shorthand that normalizes to a missing asset path.
  • Expecting local playtest mode to support authoring edits.
  • Confusing exported standalone settings with editor-only standalone preview settings.
  • Testing standalone UI preview with a gameplay layout asset that has no standalone root kind.
  • Retrying from the editor without checking the generated log and report first.

Recovery Paths

If local playtest fails, inspect the recorded command line, log file, and JSON report, then rerun the command with explicit --scene, --entry-point, and tile flags. If standalone boot picks the wrong scene, validate config/exported_game.json and its startup scene/entry point. If UI preview is blank, confirm the selected asset is a standalone layout and that UI layout and skin validation are clean.