Scenes > Play Scene

The main game scene. Owns all in-game views, drives the game engine via dispatch, and translates engine effects into visual updates. Acts as the bridge between engine state and the UI — no view reads engine state directly.

create

Initialises all views, boots the game engine, and kicks off the first turn. The engine init is async so board setup and the initial dispatch wait for it to resolve. TURN_END starts the full turn cycle from player index 0 because SessionManager sets currentPlayerId to the last player on init, causing incrementPlayer to wrap around to index 0 on the first TURN_NEXT_PLAYER.

#setupListeners

Wires up all scene-level event listeners. Translates UI events emitted by views into engine actions dispatched through #dispatch.

#dispatch

Dispatches an action to the engine and processes returned effects in sequence. Terminates immediately on GAME_OVER or GAME_WIN. All other effects are routed through #handleEffect one at a time, awaiting async effects before continuing.

#handleEffect

Routes a single engine effect to the appropriate view method. Returns a promise for async effects (animations) or void for sync ones.




© Gamesanova 2026