Runners are the handoff point between the App and the scheduler. The app stages setup, the scheduler holds ordered schedules, and the runner decides when those schedules actually advance and which world they run against.
That makes runners the timing layer of the runtime. They do not define behavior themselves; they decide when the behavior that lives in Systems and Schedules gets a turn.
Why A Runner Exists
The app is intentionally not a game loop. It prepares the worlds, registers plugins, pushes staged schedule state into the scheduler, and then hands control to a runner. In the standard core runtime, CorePlugin creates MainWorld and makes it the default target world.
The default engine path uses defaultRunner. That runner is browser-oriented and advances schedules from requestAnimationFrame(), which is a good fit for the standard frame loop.
What The Runner Sees
A runner receives the Scheduler and the app’s world registry. Each schedule already carries a world label, and the runner uses that label to pick the target world from the registry.
In the common path, the app starts like this:
app
.setRunner(defaultRunner)
.run()
At that point, the runner is responsible for the loop. App.run() does not keep calling into the scheduler itself.
Default Runner Behavior
The default runner keeps per-executable state, initializes each schedule’s next run time, and then advances runnable schedules on each animation frame. Repeating schedules are rescheduled after they run. One-shot schedules are marked inactive after their first execution. Before each run, it asks worlds.getWorld(executable.world) for the target world. When a schedule runs, its system groups provide the phases that determine the order of the work within that schedule.
That behavior is what makes AppSchedule.Startup and AppSchedule.Update feel different even though both are just schedules. Startup runs once. Update keeps stepping with the frame loop.
Custom Runners
Custom runners are useful when the host environment is not a browser or when the timing model needs to change. For example, a test runner might run a schedule once and exit, while a server runner might tick on a fixed interval.
If a runner only needs the default world, call worlds.getWorld(). If it needs the world attached to a schedule, look it up with the schedule’s label.
app.setRunner((scheduler, worlds) => {
for (const executable of scheduler.values()) {
const world = worlds.getWorld(executable.world)
executable.schedule.run(world, executable.errorHandler)
}
})
The key point is that the runner is the only part that owns advancement policy. Everything else in the runtime can stay focused on declaring what should happen rather than how often it should be polled.
