Docs/Recipes/Round-based game (3 phases)
Recipe: Round-based game (3 phases)
Lobby → game → ending → back to lobby. Drives the whole match flow with phases and a timer device.
Last updated 2026-06-06
Ingredients
- Phases:
lobby,game,ending. - Config
round_time— int, default 180 (seconds). - UEFN devices: 1 Timer Device (for round timer), 1 Teleporter for lobby spawn, 1 Teleporter for game spawn.
Build it
Declare the phases
Game Data → Phases → addlobby,game,endingin that order. The first one declared is the starting phase.Route joining players
WHEN On Player Joined IF Is in phase lobby → DO Activate Teleporter lobby_tp. And the symmetric one for game phase, sending them to the game spawn.Lobby → game transition
WHEN On Timer Elapsed (LobbyTimer) → DO Change Phase to game.On game start, teleport all
WHEN On Phase Start (game) → DO Activate Teleporter game_tp— sends everyone to the game spawn at the moment of transition.Game → ending
WHEN On Timer Elapsed (RoundTimer) → DO Change Phase to ending, Show HUD "Round over".Ending → loop back
WHEN On Phase Start (ending) → DO Enable Timer (LobbyResetTimer), thenWHEN On Timer Elapsed (LobbyResetTimer) → DO Change Phase to lobby.
💡 Tip
Always pair a
Change Phase action with an On Phase Start rule for the destination phase — that's where you do setup (teleport, reset variables, show banner).Generated Verse
game_phase := enum:
Lobby
Game
Ending
var CurrentPhase:game_phase = game_phase.Lobby
LobbyTimer.SuccessEvent.Subscribe(OnLobbyTimerEnd)
OnLobbyTimerEnd(Agent:?agent):void=
set CurrentPhase = game_phase.Game
PhaseChangedEvent.Signal(game_phase.Game)
# On Phase Start (game) handler runs here:
GameTP.Activate(Agent?)
Variations
- Min-player gate — gate the lobby→game transition with
IF Player count ≥ 4. - Countdown HUD — show the round timer's remaining seconds via
Show Variable HUDon a dedicated variable. - Best-of-3 — add a
round_numbervariable; end the match instead of looping when it hits 3.
Gotchas
⚠️ Watch out
One phase active at a time. Rules in the wrong phase silently won't fire. If a button stops responding, check its
Is in phase condition.⚠️ Watch out
Timer devices need wiring in UEFN. The timer fires from a placed Timer Device — verify the @editable binding points to a Timer Device on the island.
See also