Rengine / docsProject documentation

Reference

Engine Type Model

Look up syntax, contracts, layouts, algorithms, and exact behavior.

The engine can be reconstructed from a small set of TypeScript types. Entity is the core drawable/updateable object. FolderEntity extends Entity with children. Scene groups entities and gives them a name. EngineState stores scenes, the active scene, global configuration, camera data, and renderer selection.

type Vector2 = { x: number; y: number };
type Component = {
  name: string;
  update: (delta: number, e: Entity, s: Scene, prev: EngineState) => [Entity, EngineState];
};
type Entity = {
  id: string;
  position: Vector2;
  anchor: Vector2;
  rotation: number;
  scale: Vector2;
  components: Component[];
  render: (state: EngineState) => (entity: Entity) => unknown;
};
type FolderEntity = Entity & { entities: Entity[] };
type Scene = { name: string; entities: Entity[] };
Core engine types. The model is deliberately small: transforms, components, render function, and optional children.
FolderEntity=Entity∩{children:Entity∗}FolderEntity = Entity \cap \{children: Entity^{*}\}
Folder subtype. A folder is an entity with child ownership, not a separate scene-graph primitive.

This choice keeps traversal uniform. Rendering and updating can visit an Entity, inspect whether it owns children, and recursively traverse without switching to a distinct transform-node API.