Epsilon Engine Source code

Engine architecture

Nostalgia Studio, the public Arcade player and Frontier Dispatch share engine modules. The editor owns an authored document. A play session owns a mutable simulation. The renderer and exporter read those representations for different purposes. This split lets a creator replay the same level, preview a different perspective, or render a film without writing live controller state back into the project.

A project supplies a level to the game controller and a timeline to the film renderer. The game view reads the live world. Film capture receives authored scene frames and their mixed score.

From an edit to a frame#

  1. Author. src/base.html supplies the editor shell and preset renderers. The UI adapters read an edit, pass data through a core validator and replace the current scene or level after success. project-core.js binds a scene to its owning project. level-authoring.js validates level edits and owns undo/redo history.
  2. Compile a run. A 2D scene's level goes through EpsilonGame.create. Arcade worlds dispatch to EpsilonArcade. A playable spatial scene uses EpsilonSpatialPhysics.create(space, space.gameplay) to compile static transformed bounds and controller settings. A new run gets fresh position, timers and progression state.
  3. Step. Input adapters gather held actions and pass elapsed seconds to advance. The controller accumulates 1/120 s ticks, resolves movement and triggers, and reports events. Arcade uses string events. Spatial uses objects with a tick and, for triggers, an object ID. The UI decides when to update a HUD, play a sound, retry a flag or change scene.
  4. Draw. The 2D editor renders to Canvas. For a 2.5D scrolling title, arcade-depth.js draws projected faces aligned to the 2D collision plane. For an authored spatial scene, spatial-core.js transforms primitives and rasterizes triangles into a depth buffer. Frontier Dispatch supplies a Three.js view and a tactical Canvas fallback for the same mission world.
  5. Play or capture a timeline. EpsilonProject.locate converts production time to the active scene and local playhead. audio-core.js produces the score. During scored playback or film capture, the Web Audio clock supplies elapsed time to the drawing code. Capture combines the canvas and audio streams into WebM.

How a docking port becomes playable#

Start in examples/frontier-dispatch/dispatch.mjs and follow the actual handoff.

Step Owner Boundary
Select a revision models.mjs A local release record supplies a GLB URL, byte count and SHA-256. parseArchiveModel checks size, validates the model and verifies the digest before parsing its Three.js scene. The application ships the bytes for both HOLO revisions.
Place the model dispatch.mjs The example rotates the station into the ground plane and scales it. Anchor resolution uses that placement.
Find the port src/model-anchors.mjs and mission.mjs stationPorts matches the docking-port role, uses the authored port number as identity, then finds the aperture child. The assembly pivot is at the center of the station. The aperture's world position is where the drone docks.
Compile the objective mission.mjs createDispatch turns each port into a collectible trigger and the launch pad into the single exit. The four- and six-port assets therefore produce different missions from the same code.
Complete the flight spatial-physics.js, dispatch.mjs and flight-view.mjs Contacts update the collected set and produce events. The view updates its rings and the HUD reports progress. Returning to launch after the last port ends the run.

The example reads licensed files from the release. A running game can complete offline from a local HTTP server. HOLO provides provenance at publication time. Run the model example.

Where state lives#

State Owner and storage Lifetime and recovery
Active production EpsilonProject.store, localStorage key epsilon-prime.studio.project.v3 One canonical JSON document per browser origin. Optimistic comparison catches a competing write before replacing it.
Checkpoint history EpsilonCheckpoints, IndexedDB epsilon-prime.studio.checkpoints.v1 A bounded sequence of revisions per project. Open one by project ID and revision.
Actor images, receipts and package recovery MeldCasting and EpsilonPackages, IndexedDB epsilon-prime.nostalgia.cast.v1 Image references in the document are digests. Package import adds bytes and a recovery record atomically. Local restrictions inform subsequent import and export decisions.
Private GLBs, roles and retarget mappings model-library.mjs, IndexedDB epsilon.studio.private-models.v1 Roles bind a model digest to a project, scene and slot. Retarget records bind an ordered pair of digests. Deleting a model also removes dependent roles and mappings in one transaction. Sessions dispose their active Three.js objects.
Play session The selected core controller, in memory A restart creates a world from the level. An Arcade flag can restore a defeated run during the visit. The public campaign player uses separate per-title localStorage keys for chapter progress.
Portable output Project JSON, authorized package, standalone HTML, WAV or WebM The artifact determines which data travels. A project JSON contains references. A package can contain verified actor images. The spatial standalone player embeds primitives and the controller.

Browser storage belongs to the origin. A creator moving from localhost to another machine can use the project/package export path and retain original asset files as appropriate. A project's ID or model hash identifies data. A project-scoped grant determines whether the editor may include an image in an export. Persistence API · Export API.

Building and shipping#

Artifact Producer What it contains
index.html in the engine checkout python3 -X utf8 src/build.py Generates the editor from src/base.html, core modules, panels and UI adapters. Edit its inputs and rebuild. The separate model audition and retarget pages import their modules directly.
Hosted Studio and Arcade player release/build_public_arcade.py Extends the built editor with the public game catalog, campaign levels, launcher and mobile controls. The hosted entry is /demos/nostalgia/. Service-specific and private model UI is omitted or disabled for this build.
Offline Rift Station release/build_rift_playtest.py Packages the public HTML for disconnected file playback, including the same campaign and controller.
Frontier Dispatch The example's HTML and ES modules The source checkout serves the files directly. The Epsilon Prime website bundles the same entry with Vite.
Engine source ZIP and Git tag release/build_source.py and release/publish_source.py The ZIP contains the engine, editor, examples, docs, tests and license notices. Each public tag identifies an engine source tree. The clone rebuilds the ZIP byte for byte.

To change a game rule, start with game-core.js, arcade-core.js or spatial-physics.js and the matching tests. To change a view, follow arcade-ui.js, spatial-ui.js or the example's flight-view.mjs. To change the public campaign sequence, inspect release/campaign-player.js and the two src/expedition-*.js files. For film timing, start with score-playback.js and film-capture.js. The source-level tests check document and controller behavior. Chromium suites exercise the built editor, actual input, storage, model playback and exported files.