View on GitHub

FOnline Engine

Flexible cross-platform isometric game engine

Web Debugging

Engine-owned documentation. Paths under ../ are relative to the FOnline engine root. Paths under ../../ point to an embedding game project such as Last Frontier when this engine is used as a submodule.

Local web workflow

The current web-debug flow is task-driven, but the tasks are thin wrappers around the shared BuildTools layer.

That last point matters: the current local/scene packaging task generates both debug package variants in one pass, not just the one you are about to launch. The staging task is separate and packages only the Staging variant.

Version pinning

Key commands

Prepare the shared web workspace parts directly through BuildTools:

py -3 ../BuildTools/buildtools.py prepare-host-workspace windows web

Linux wrapper equivalent:

bash ../BuildTools/prepare-workspace.sh web

Build the web client for the local debug workflow:

py -3 ../BuildTools/buildtools.py build web client RelWithDebInfo

Build an optimized browser release:

py -3 ../BuildTools/buildtools.py build web client Release

Create the browser debug packages used by the VS Code launch configurations:

py -3 ../BuildTools/buildtools.py package-web-debug LF RemoteSceneLaunch LocalTest

Current package layout:

package-web-debug currently packages with -pack Raw+WebServer, which is why each output directory includes a generated web-server.py used by the launch tasks.

VS Code launch

Current ../../.vscode/launch.json entries are:

These use Workspace/web-debug/LF-Client-LocalTest-Web for the local web client flow and Workspace/web-debug/LF-Client-RemoteSceneLaunch-Web for the remote-scene web flow.

The launch flow performs these steps:

  1. Prepare the host workspace for web builds.
  2. Bake resources.
  3. Build the headless server for the current platform.
  4. Build the Emscripten web client.
  5. Run one packaging step that refreshes both RemoteSceneLaunch and LocalTest browser packages under Workspace/web-debug/.
  6. Start the local headless game server.
  7. Start the generated web-server.py HTTP server for the packaged browser build on port 7000.
  8. Open a dedicated Chrome instance pointing at the local package.

The hidden stop tasks for the web flow currently kill listeners on ports 7000, 4025, and 4026, so stale browser-package or headless-server processes are cleaned up by port rather than by process identity.

The browser client uses the existing local server defaults from ../../LastFrontier.fomain, including ServerHost = localhost and ServerPort = 4025.

The web scene workflow uses the RemoteSceneLaunch subconfig and starts LF_ServerHeadless with --Scene.Startup <SceneId>, so the server stays headless while its output remains visible in the terminal.

The Linux staging web workflow is task-only rather than a Chrome debug launch entry. Web :: Prepare Staging Launch [linux] prepares the web workspace, bakes resources, builds LF_ServerHeadless, builds the web client, removes Workspace/output/Baking, packages LF Staging, starts LF_ServerHeadless --ApplySubConfig Staging, and serves Workspace/web-debug/LF-Client-Staging-Web/web-server.py on port 8001. Web :: Launch Staging Client [linux] then opens https://dev.lastfrontier.ru/play-staging/, so staging browser behavior depends on both the local staging package/server and the public staging URL route.

On the client side, scene transitions are surfaced through PrepareToLoadScene() / SceneLoaded() remotes in ../../Scripts/Scenes.fos, which fire Game.OnPrepareToLoadScene / Game.OnSceneLoaded. ../../Scripts/GameState.fos uses those events to keep the Wait screen visible during scene loads and only restore GuiScreen::Game after the scene is reported as loaded.

Workspace/web-debug/... output directories are generated by the packaging tasks and may not exist in a fresh checkout until the first web package build completes.

Practical Debugging Notes

When a web-debug run fails, separate browser packaging, HTTP serving, and game-server startup before rebuilding everything:

Key Files and Integration Points

If you need to trace the current web-debug flow through the live repository, start with these files:

Validation and Tests

Current checks worth running when web launch flow, packaging paths, or browser-debug assumptions change: