Skip to main content
Waypoint serves Overworld’s Waypoint 1.5 as a Reactor model. Its source is examples/waypoint in Reactor Runtime 3.11.9, and the code below is simplified from it.

Files

examples/waypoint/
The runtime drives Waypoint, the model class. Waypoint calls WaypointModel, which runs the weights through Overworld’s world_engine and imports nothing from Reactor. The two classes exchange WaypointInput and WaypointResult. Model Structure describes this split.

Contract

The contract declares the output track and the controls that a client can set:
waypoint.py (simplified)
  • Video track: WaypointOutput declares the outbound main_video track. The attribute name is the track name that the client receives.
  • Commands: each field becomes a command named set_<field>. For example, set_action sets action. The runtime rejects a value outside the field’s limits, such as choices or ge and le.
The model class also declares 2 commands with @event: set_image and reset.

Loading

The runtime calls load() once, when the instance starts and before any session:
waypoint.py (simplified)
config_path points to config.yml. get_weights_path() returns the folder that holds the Waypoint-1.5-1B weights: the weights the deploy pinned with --weights, or runtime.weights_path in reactor.yaml for a local run. Waypoint passes the folder to WaypointModel, so the world model class still imports nothing from Reactor. WaypointModel.load() reads config.yml, loads the weights from the folder onto the GPU, and runs 50 warmup steps. The warmup compiles the kernels, so the first session does not wait for them. The engine also downloads a small autoencoder, about 23 MB, from Hugging Face, because the checkpoint’s own configuration names it.

The step

The runtime runs the model in a loop of steps. Each step calls 3 methods in order:
A clockwise loop inside the Waypoint model class. Commands update the session state. process_input() reads the controls, generate() makes 4 frames, and process_output() sends them to clients on main_video. Then the next step starts. A step is skipped while the session is paused or has no seed image.
Generation Loop explains this loop for every model.

Read the controls

process_input() builds the input for each step:
waypoint.py (simplified)
process_input() turns the session state into a WaypointInput, the input that WaypointModel can generate from. The state holds the controls the way a client sets them: a movement name such as forward, extra key codes, and mouse and scroll values. The world engine reads a set of pressed keys instead, so button_set() converts action and buttons into one set of key codes. For example, forward becomes the W key. The mouse and scroll values pass through unchanged. The seed image is the image that starts the world: the client uploads it with set_image, and it becomes the first frame. The input carries it only on the first step after set_image or reset. On every other step, seed is None, and the world model continues the world that it holds. When the state is not enough to make frames, the step is skipped. While the session is paused, or before a seed image arrives, process_input() raises ApplicationError. The runtime skips the step and calls process_input() again on the next one.

Make the frames

Each step then calls generate() with the WaypointInput from process_input(). On Waypoint, it only passes the input on to the model:
waypoint.py (simplified)
WaypointModel.generate() does the GPU work. When the seed has changed, it starts a new world from it. Then it makes the next 4 frames and returns them in a WaypointResult:
waypoint_model.py (simplified)
The world model keeps the world between steps, so each step continues from the frames before it.

Send the frames

process_output() receives the result of generate() and sends the 4 frames to the client on main_video:
waypoint.py (simplified)
If generate() fails, the error arrives in outcome.error. process_output() raises it again, and the runtime ends the session with an error that the client sees. The full method also tags each frame with its step number, notes which seed the world model holds, and sends waypoint_status every 50 steps.

Commands written by hand

Two commands need more than a field write, so the model class declares them with @event:
waypoint.py (simplified)
  • set_image stores the uploaded image as the new seed. The new _seed_id tells the next step to start a new world from it.
  • reset clears the world model. The next step starts again from the seed image that the session already has.
Both commands reply with waypoint_status.

Sessions and reset

  • Client connects: @connected sends the current waypoint_status to the client that joined.
  • Session end: @session_ended calls WaypointModel.reset() and drops the frames that are not sent yet. The seed image and the controls reset with the rest of the state, so the next session starts with no world.
  • reset command: starts the world again from the current seed image, in the same session.