Skip to content

Composers

Alex Pineda edited this page Oct 3, 2023 · 1 revision

Composers are higher level modules of code that take responsibility over specific areas of logic, and expose some of their api for plugins and macros as well as the top level composer: World Composer.

World Composer is essentially the game engine. It can be instantiated using createWorldComposer.

createWorldComposer is used to initialize a World object, which serves as the core data structure for the game world. The World object contains various properties and methods related to the game state, such as the map, players, and fog of war.

Janitor class is used to manage resource cleanup, and it employs a variety of "composers" to handle different aspects of the game world. These composers are responsible for game loops (gameLoopComposer), rendering scenes (sceneComposer), handling commands (commandsComposer), and more.

This function also sets up event listeners for settings changes and other game events. It has methods for activating and deactivating scene controllers, updating the game state, and rendering frames. The ApiSession class is used for managing API-related activities for macros and plugins.

Game Loop Composer - Simple wrapper to start/stop the animation frames. Ensures disposal on world destroy.

Surface Composer - Creates and configures the game surface dimensions, handles window resizing events, and exposes an API for interacting with the surface, such as toggling pointer lock and checking if the pointer lock is lost.

ViewControllerComposer - The Scene Controller plugin is responsible for managing the game viewports. This composer helps activate those plugins, as well as update the viewports and their orbiting camera controls.

Clone this wiki locally