VerseBuilderDocs

Docs/Game data/Phases

Phases

Declare the named, timed stages of your game here — lobby, game, ending. Rules use them via Is Phase / Start Phase atoms and On Phase Start / End events.

Last updated 2026-06-15

What is this?

Each Phase is a row with a name, a duration (in seconds) and an auto-start toggle. Phases run in list order: when a phase's duration elapses it auto-advances to the next one. The first phase is the starting phase. Exactly one phase is current at a time, held in a CurrentPhase string.

Rules interact with phases three ways: ask “am I in phase X?” (IF Is Phase), jump to a phase immediately (DO Start Phase), and react the moment a phase begins/ends (WHEN On Phase Start / On Phase End).

When do I need it?

  • Round-based gameslobby → game → ending → lobby.
  • Story gamesintro → tutorial → main → boss → ending.
  • Lobby flowwaiting → starting → live.

Walkthrough: 3-phase loop

  1. Open Game Data → Phases

    The empty state offers the 3-phase loop pattern (lobby, game, ending) — one click to scaffold the standard match flow.
  2. Order + duration

    The phase at the top is the starting phase; reorder with the up/down buttons. Each phase's duration drives the auto-advance to the next phase — set it per row.
  3. React to phase changes

    Phases auto-advance on their duration; you hook behavior to them with WHEN On Phase Start (game) — teleport players, reset variables, show a banner the moment a phase becomes active.
  4. Jump phases manually (optional)

    To leave a phase early (e.g. “everyone ready → start now”), use DO Start Phase (game) in a rule. To branch on the current phase, gate a rule with IF Is Phase (lobby).

💡 Tip

Full end-to-end pattern with all 6 rules and the timer wiring: Recipe: Round-based game.

Gotchas

⚠️ Watch out

Declaration ≠ visible behavior. The chain auto-advances on durations, but nothing happens in a phase until a rule reacts to it. If your phases look like they're not working, check you have rules using On Phase Start, Is Phase or Start Phase.

⚠️ Watch out

Phases are device-scoped. Each device has its own phase machine. For multi-device packs where all consumers should follow one phase, declare the phase enum on the Provider and bind read/write through exports.

📌 Note

Phase names go through snake_case normalization, like Variable names.

What gets generated?

Phases compile to a CurrentPhase string plus one RunPhase_<Id> suspending function per phase. Each sets the current phase, runs its On Phase Start actions, sleeps for its duration, then calls the next phase. StartPhaseSystem() kicks off the chain in OnBegin:

var CurrentPhase : string = "lobby"

StartPhaseSystem()<suspends>:void=
    RunPhase_Lobby()

RunPhase_Lobby()<suspends>:void=
    set CurrentPhase = "lobby"
    # …On Phase Start (lobby) actions…
    Sleep(30.0)        # the phase's duration
    RunPhase_Game()    # auto-advance to the next phase

Is Phase compiles to CurrentPhase = "lobby", and Start Phase calls the matching RunPhase_<Id>() to jump.

See also