Overview
Coordinates play mode simulation: startGameSimulation captures SceneSnapshot, resets particles, instantiateSceneScripts, **initializeRuntimeSceneSystems.
stopGameSimulation clears runtime systems, Scene::onGameStop, restores snapshot.
WindowGame registers a ModuleRender PLAY viewport surface. Stop can be requested asynchronously via ModuleRender::requestStopSimulation.
How it works
- Play toolbar triggers
startGameSimulation, settingENGINE_STATEtoPLAYINGand cloning the scene viaSceneSnapshot. - Runtime systems (scripts, particles, etc.) initialize for the play session.
- Stop restores the snapshot and tears down runtime systems; F3 toggles
WindowGameDebugin play mode.
Internal architecture
ModuleGameView
├── SceneSnapshot clone
├── start/stop simulation hooks
├── ModuleScene / Scripting / ParticleSystem refs
└── Debug window flag (F3)
Relationships
PlayToolbar→startGameSimulation;ModuleRenderstop hook;ENGINE_STATE::PLAYING.
Technical features
- Snapshot-based play/stop isolation for editor vs running game.
- Dedicated play viewport surface registered with
ModuleRender. - Async stop path through
ModuleRender::requestStopSimulation(GPU flush, music stop).
Implementation notes
- Verified: snapshot-based play/stop isolation.