Skip to content

How a game fits together

A game is scenes. A scene is a world and its UI. Every component nests inside the thing it belongs to and reads only that thing. UI sits at any level. The engine draws it on the screen, and the level decides what it reads and how long it lives.

flowchart TB
    Game --> Scene --> World --> Entity
    Game -.-> GU[global UI]
    Scene -.-> SU[scene UI]
    World -.-> WU[world UI]
    Entity -.-> EU[entity UI]
    GU & SU & WU & EU --> Screen

Solid arrows are nesting. Dotted arrows are UI at that level, which the engine hoists to the screen.

Level It reads It lives as long as
Game wallet, scenes, player the game
Scene the scene’s state the scene is active
World the map, the player’s position the world is loaded
Entity that entity, through useEntity() the entity exists

UI covers the primitives at every level. Frame lists what one frame runs and what each line costs. Internals covers what the engine does underneath.