VerseBuilderDocs

Docs/Core concepts/Phases & game flow

Phases & game flow

Phases are named stages of your game — lobby, game, ending. They let rules switch behavior between sections without entangling every condition.

Last updated 2026-06-06

What is a phase?

Declared in Game Data → Phases. Each phase is just a name (lobby, game, ending). The device tracks which one is current; rules can read or change it.

  • Globally active rule — no phase condition, fires whenever its event fires.
  • Phase-scoped ruleIF Is in phase = lobby, fires only when the lobby is current.

Phase transitions

Phases never change on their own. You write a rule that does it explicitly via the Change phase action. Common triggers:

  • A button or volume — WHEN On Button Pressed → DO Change phase to game.
  • A timer — WHEN On Timer Elapsed → DO Change phase to ending.
  • A count threshold — WHEN On Elimination IF Compare variable kills ≥ 20 → DO Change phase to ending.

Scoping rules to a phase

Use IF Is in phase to gate by phase. The same event can drive completely different behavior depending on the current phase:

Rule A: WHEN On Player Joined  IF Is in phase = lobby   DO Teleport to lobby_spawn
Rule B: WHEN On Player Joined  IF Is in phase = game    DO Teleport to game_spawn

Patterns

3-phase loop

lobby → game → ending → lobby. Lobby waits for enough players, game runs the round, ending shows results then loops back.

Story phases

intro → tutorial → main → boss → ending. Each phase enables a different chunk of rules. Transitions are triggered by progression events.

On-enter setup

Pair every DO Change phase with an “on phase change” rule that initializes the next phase (reset timers, teleport players, show banner).

Gotchas

⚠️ Watch out

Forgetting the transition. A round that's supposed to end never does — usually because the Change phase rule is gated by a condition that never becomes true.

⚠️ Watch out

Rules outside their phase don't fire. If a button isn't responding, double-check it's not gated to a phase you're not currently in.

📌 Note

Phases are global to the device — not per-player. If you need per-player flow (e.g. tutorial progress), use a Variable with scope player instead.

What gets generated?

Phases compile to an enum, a current-phase field, and a setter that fires a device-level PhaseChangedEvent:

game_phase := enum:
    Lobby
    Game
    Ending

# inside the device:
var CurrentPhase:game_phase = game_phase.Lobby

SetPhase<public>(NewPhase:game_phase):void=
    set CurrentPhase = NewPhase
    PhaseChangedEvent.Signal(NewPhase)

# IF Is in phase = lobby
if (CurrentPhase = game_phase.Lobby):
    # rule actions

See also