Skip to content

Module index

Everything genre-specific lives in an opt-in module, each one a separate subpath import, so the ones you never import cost nothing to ship. The core primitives they build on are under Core.

Find the task you have in mind, then open the module for its guide.

Module What it is for
easing The standard Robert Penner easing curves — pure, domain-free, zero-dependency functions that reshape normalized time.
math The engine’s value-primitive module — the Mathf / Math* equivalent, holding scalars and every vector and rotation dimension in one place.
noise Pure, domain-neutral coherent noise: the smooth, seed-reproducible field under terrain, water shaping, texture variation and clouds.
rng Pure, domain-neutral randomness utilities: a seedable generator whose position can be saved and restored, number/array helpers, and an in-place Fisher–Yates shuffle.
tween The Tween value primitive — interpolates a number from → to over a duration along an easing curve.
Module What it is for
attach One-way attachment: an entity follows another entity’s position, rotation, and velocity each tick.
collision Shape components and domain-free collision helpers, plus a tiny trigger-system factory that wires a broadphase + narrowphase into a SchedulableSystem.
collision-3d 3D shapes and domain-free narrowphase helpers — the parallel sibling of modules/collision, not an extension of it.
kinematics Arcade-style kinematic body resolution for platformers and other gravity-driven 2D games.
kinematics-3d Arcade-style kinematic body resolution in 3D — the parallel sibling of modules/kinematics, not an extension of it.
motion 2D velocity integrator: each tick, pos += vel · dt.
motion-3d 3D velocity integrator — the 3D sibling of @pierre/ecs/modules/motion.
spatial Concrete SpatialStructure implementations.
transform Canonical 2D transform primitives: position, velocity, rotation, scale.
transform-3d Canonical 3D transform primitives: position, velocity, rotation, scale — the 3D sibling of @pierre/ecs/modules/transform.
Module What it is for
animation Sprite-frame animation — cycles through an ordered list of atlas frame names at a given FPS.
asset-loader Shared async asset loading primitives for ECS games.
audio Reusable audio primitives for ECS games: a provider interface, validated audio source component, a queue for one-shots, and a scheduler-ready system.
camera 2D camera component, follow system, and world↔view transforms.
camera-3d A 3D camera for the world: a lens component, the matrices and screen ↔ world conversions built from it, a view frustum for visibility tests, and three camera rigs — first-person, orbit and chase — driven by one system.
particles One-shot bursts and continuous emitters of short-lived particle entities, animated over their lifetime (fade, shrink, spin, gravity, damping).
render-canvas2d Default Canvas 2D renderer for ECS entities that carry PositionDef + RenderableDef.
render-dom DOM-backed renderer primitives for ECS games.
render-scene3d Keeps a scene graph in step with the world: one scene object per selected entity, created the first frame the entity is selected, updated every frame, and removed from the graph once the entity stops matching.
texture-atlas Parse TexturePacker / Kenney “Generic XML” sprite atlases and resolve sprite names to drawable image rectangles.
Module What it is for
cooldown Per-entity action-gating cooldown — fire-rate limits, ability recharge, invulnerability i-frames.
drag-drop Drag-and-drop as a small state machine: press on something, follow the pointer, find the drop target under it that accepts what is dragged, then drop there or snap back.
input Action-map + edge-detected input state with pluggable raw-event providers, in two modes: tick-polled state (createInput) and event dispatch (createEventInput).
lifetime Countdown-to-destroy component and system.
tick Concrete TickSource implementations.
timer A small, embeddable countdown value — the shared timing primitive behind modules/lifetime, modules/cooldown, and (later) modules/spawner.
Module What it is for
behavior-tree A reactive behaviour tree built from pure functions.
fsm A tiny finite-state machine: a serialisable runtime value (Fsm) plus a per-tick tickFsm that dispatches to a state table of closures.
game-search Look-ahead search for computer opponents in turn-based games: the computer tries moves, the replies to them and the replies to those, and picks the move that ends best.
goap Goal-oriented action planning: give an agent actions with preconditions/effects and a goal, and plan() finds the least-cost sequence that reaches it — via A* over symbolic world-states.
grid-based Grid and tile-based spatial primitives.
pathfinding Grid-agnostic A* pathfinding.
steering Reynolds steering behaviours as pure functions.
Module What it is for
pile Ordered piles: a deck, a hand, a discard pile, a solitaire tableau column, a bag of letter tiles.
save Versioned-save primitives for browser games: migration chains, integrity envelopes, backup rotation, orphan recovery, and IndexedDB/localStorage backends.
scene-transition Tick-boundary world-transition primitives for ECS games.
spawner Cadence emitter — “emit something every T ms”, where T may be fixed, a difficulty ramp, or jittered.
stats Headless frame-timing collector plus an optional Canvas2D overlay.
tilemap Tile-layer spawn and collision-grid helpers for Tiled (.tmx) maps.
tmx Parse Tiled .tmx maps into plain data and resolve global tile ids to tileset source rectangles.
turn-based Turn order for turn-based games.
worker-pool Task-parallelism helper: run whole jobs on a pool of Web Workers, off the main thread, and get a Promise back.