Skip to content

Overview

This section is the specification of the surface Structured 2D exposes: the types, classes, functions, and methods an implementation of the engine provides, with their parameters, return values, defaults, and error conditions. An implementer satisfies these pages; a game and a validator read them as reference.

The package @clockwyrks/structured-2d has one entry point.

SpecifierProvides
@clockwyrks/structured-2dcreateEngine, the framework classes, the built-in components, the clocks, TOUCH_LAYOUTS, the viewport functions, RECORDING_FORMAT, and every type a game or a validator names.

A game and a validator both import it. A validator constructs the engine over the build’s own game definition, installs a scripted clock, steps it with engine.advance, and reads the world and the debug surface back off the engine it holds, so the surface a validator exercises is the surface the game was written against.

PageCovers
EnginecreateEngine, EngineOptions, SurfaceMetrics, RunOptions, FrameInfo, the Engine object’s lifecycle, and EngineEvents with its event map.
Game InstanceGameDefinition, GameInstance, the InitApi its initialize receives, and the debug surface it returns.
WorldsLevelDefinition, ActorSpec, LoadApi, the World object, its timers, and the transition sequence.
Game ModeGameMode, GameState, PlayerState, MatchPhase, and the player and bot calls.
ActorsActor, Pawn, Transform, the tag calls, and the deferred destroy.
ComponentsComponent and the built-in render, sprite, shape, text, draw, and camera components.
ControllersController, PlayerController, AIController, InputReader, and possession.
RenderingRenderer, RenderMode, the collision overlay switch, and the pipeline’s ordering.
CollisionColliderComponent, CollisionResponse, CollisionWorld, Manifold, and the queries.
CameraCamera, CameraSnapshot, Viewport, fitViewport, applyViewport, syncCanvas, and the three spaces.
ClocksThe Clock interface and the five clocks a run’s deltas can come from.
InputAction registration, ActionBinding, the read methods, the pointer, and TOUCH_LAYOUTS.
AudioCueSpec, WorldAudio, synthesized and file-backed cues, looping, and the mute and unlock calls.
AssetsloadImage, loadAudio, load, resolve, and the asset root.
DiagnosticsSource registration on the instance and the world, the values a read returns, FrameMetrics, the overlay, and its toggle.
RecordingThe recorder’s engine members, Recording, RecordedFrame, DrawState, DrawOp, and DrawValue.