Managers
The Logic behind the game is managed by different Managers, each responsible for a single bigger functionality.
Map Manager
The Map Manager loads Tiled maps from the file system. The maps folder is located at src/maps. Tiled maps must be exported as JSON filed. For more information on how to create & export maps, see the Levels section.
Level Manager
The Level Manager converts Tiled maps into Level States. It is responsible for extracting metadata from map properties and creating entities from the object layers. A list of all available entity/object layers can be found here.
Levels are loaded alphabetically. The filename of the map is used as the level id, which is used to identify the level in the game state.
When the lastUnlockedLevelId Attribute is set when initializing the Level Manager, all levels up to and including the specified level are unlocked. Otherwise, all levels are locked.
State Manager
The State Manager is responsible for updating the game state based on server- and client-side events and is also sending events to the clients. For more information about client-server communication, see this section.