Level Event System
This system consumes LevelEvent messages from the server and applies runtime changes on the client.
Responsibilities
- Update background scroll speed when
set_scrollevents arrive. - Swap backgrounds on
set_backgroundevents. - Play or switch music on
set_musicevents. - Record camera bounds and gate states for future systems.
Behavior
set_scrollupdates an internal scroll clock and recomputes the background speed every frame.set_backgroundswaps textures on existing background entities or creates one if missing.set_musicloads the music asset from the manifest and plays it in a loop.set_camera_boundsstores bounds; no camera system consumes it yet.gate_open/gate_closeare stored by id for future gate handling.
Integration
The system runs after NetworkMessageSystem and LevelInitSystem, and before BackgroundScrollSystem.
Migration / Tests / TODO
- Migration: send initial
set_scrollafter LevelInit; optionalset_musicif music should start immediately. - Tests: parser validity for each event type, CRC rejection, background swap without entities.
- TODO: camera bounds consumption in a camera system, gate entity visuals/logic.