Skip to content

Codebase Map

Michael Voitovich edited this page Jul 4, 2026 · 5 revisions

manual For developers navigating the architecture, the Scanline Engine delegates its logic into specialized subsystems. Here is a high-level guide to the src/ directory:

Path / File Description
src/mechanics/ Houses the Text Parser and the AI Orchestrator, including the LLM integration cascade. Handles natural language processing and converts player text into executable plans.
src/mechanics/Parser.ts Central parser orchestrator. Manages stage execution, target resolution, clarification loops, and linear plan execution.
src/mechanics/ParserWorldModelBuilder.ts Evaluates the current game state and builds the semantic projection, including parser context and scope.
src/mechanics/LlmCascade.ts Stage 2 AI layer. Manages scene-static and dynamic prompt splits, communicates with the provider, and extracts JSON plans from AI responses.
src/mechanics/NlpCascade.ts Stage 1.2 local neural network layer, based on NLP.js, for flexible intent recognition.
src/mechanics/parserCommands.ts / src/mechanics/parserLanguage.ts Handle vocabulary normalization and data-driven custom command matching, such as TELEPORT WITH.
src/systems/ Contains high-level gameplay logic and managers that mutate the world state.
src/systems/GameSemanticAPI.ts Implements semantic interactions triggered by parser plans, such as look, examine, take, put, open, and close.
src/systems/InventoryManager.ts Manages player inventory, nested containers, and capacity rules.
src/systems/SoundManager.ts Governs the 3D Web Audio environment, including HRTF panning, reverb crossfading, and proximity EQ.
src/systems/StateEventSystem.ts Routes authored State component mutations into reusable script events, such as triggering a script when a TV turns on.
src/systems/ShadowSystem.ts Renders and manages dynamic actor shadows.
src/scene/ Handles spatial topology, scene transitions, and world geometry.
src/scene/Scene.ts Primary data structure for loaded environments and collision logic, including Walkbox movement constraints.
src/scene/SceneManager.ts Manages scene loading and centralized actor transfers between scenes.
src/scene/SceneTextLayer.ts Projects raw spatial hierarchies into titled, anchor-relative semantic text data for the parser.
src/scene/SceneSpatialValidator.ts Enforces world logic rules, such as preventing recursive containment and rejecting invalid storage setups.
src/core/ Contains fundamental engine loops, text asset loaders, and UI managers.
src/core/Game.ts Central game loop and singleton holding the primary state and execution contexts.
src/core/IGame.ts Shared gameplay API contract used by the parser, UI, and custom scripts.
src/core/Console.ts Controls the in-game text console, handles word wrapping, manages modal dialogue states, and processes developer commands such as #PEEK and #LLM-ON.
src/core/TextAssetManager.ts Loads, caches, and provides look

Clone this wiki locally