Skip to content

Decoupled 2D

Decoupled 2D (slug decoupled-2d) is the 2D engine of the Decoupled family. It provides a gameplay framework a game is written inside, separates simulation from rendering, and owns the rendering itself.

The engine is designed and awaiting implementation, so it is outside the set a run may select. Its documentation arrives with its runtime, in the same four sections Simple 2D uses.

Decoupled 2D supplies the structure a game is built inside: a game mode holding the rules of a match, actors as the things that exist in the world, pawns as the actors a controller drives, and controllers as the players and computer opponents driving them.

A game learns that structure from the engine’s seeded documentation and builds within it. This is the part of the family that measures integration with an existing codebase, so the framework is documented in the depth a model needs to use it without seeing its source.

A game’s simulation is authored in Rust and compiled to WebAssembly against the engine’s crate. Its rendering is configured declaratively and drawn by the engine’s TypeScript renderer, and per-frame state reaches the renderer through the engine rather than by serializing a snapshot each frame. The simulation therefore runs with no rendering dependency, and the renderer reads simulation state without stepping it.

The Rust toolchain is present only while a run is live, so a build compiles its module once during the run and commits it as a build input. The build step that validation and the published source repository run installs and bundles with Node alone.

The engine owns rendering. A game configures what to draw by attaching render components to its actors, and the engine’s pipeline draws them. Render modes such as wireframe, unlit, and normals belong to that pipeline and are available without the game implementing them.

A game may also draw directly, for a case that measures the drawing itself. An actor on that path implements its own rendering and the engine calls it as part of the frame.

Decoupled 2D offers modules for the game-agnostic work a case may or may not want provided, collision among them.

Decoupled 2D suits a 2D case large enough that the framework is a help rather than an imposition, and a case whose validation needs the precision that engine-owned simulation and rendering give.