Epsilon Engine Source code

API reference

The engine exposes JavaScript interfaces inside the application process. Most simulation and document files are side-effect scripts. Import them in dependency order, then read their namespace from globalThis. Files ending in .mjs expose named module exports. Both forms work in browser modules. The examples use Node.js 24 so you can run them without a page or a render loop.

Start a simulation#

This advances Rift Station one tenth of a second with Right held. The controller accumulates elapsed seconds and runs twelve fixed ticks. The world object keeps the result for the next frame.

import './src/arcade-core.js';
import './src/game-core.js';

const game = globalThis.EpsilonGame;
const level = game.defaults('metroid');
const world = game.create(level, 'metroid');
const startX = world.x;
const events = game.advance(world, 0.1, { right: true });

console.log(world.ticks, world.x > startX, Array.isArray(events));
12 true true

A browser entry point usually reads keyboard or pointer state, calls advance once with elapsed seconds, handles its events, and draws the resulting world. Keep the level document if the player will restart. Each new call to create builds an independent run.

Interface directory#

Interface Source under src/ What the caller owns
EpsilonProject, EpsilonCheckpoints project-core.js, checkpoint-core.js Preset catalog, project documents, revision and conflict handling. Projects
EpsilonGame, EpsilonArcade game-core.js, arcade-core.js Level data, mutable play state and held input. Games
EpsilonLevelAuthoring, EpsilonArcadeDepth, EpsilonArcadeFeedback level-authoring.js, arcade-depth.js, arcade-feedback.js Edit history, the selected presentation and event feedback. Editing and drawing
EpsilonSpatial, EpsilonSpatialPhysics spatial-core.js, spatial-physics.js Scene geometry, collider bindings and a 3D controller. Spatial API
modelAnchors, inspectStudioModel, openStudioModel model-anchors.mjs, model-preview.mjs, model-runtime.mjs Selected scene root or Blob, per-actor playback and disposal. Models
Private library, scene roles and rotation retargeting model-library.mjs, model-role.mjs, model-retarget.mjs Preview consent, role scope, source and target model identities. Private casting
EpsilonAudio, EpsilonScoreClock, EpsilonFilmCapture audio-core.js, score-playback.js, film-capture.js Cues, audio clock and frame drawing. Audio and film
MeldCasting, EpsilonPackages, EpsilonSpatialExport cast-core.js, package-core.js, spatial-export.js Stored asset access, export authorization and output files. Publication

Values crossing a module boundary#

Value Convention
Time Pass seconds to simulation, timeline and animation methods. The 2D and 3D controllers use STEP = 1 / 120. The audio mixer reports sample indices at 24,000 Hz.
Position 2D levels use pixels with Y increasing downward. Spatial gameplay uses scene units with Y up. modelAnchors returns world coordinates after transforms.
Identity Project, scene, entity and level object IDs survive edits. An imported model clip is identified by its original numeric index. Asset bytes use SHA-256.
State Codecs return normalized documents. Simulation steps mutate the world supplied by the caller. Model sessions allocate resources and expose dispose().
Failure Synchronous validators throw Error. Asynchronous model, storage and encoder operations can reject. A successful document parse validates its structure. Exporting actor media also requires verified bytes and project-scoped permission.

The editor binds these interfaces to controls in the *-ui.js files. The public Arcade launcher and the Vite bundle for Frontier Dispatch are consumers of the same underlying modules. Architecture and build paths.