Game configuration
Connect engine systems, assets, scenes and DI in one place.
GameConfig describes game startup. It is passed to Engine.run and defines which systems and scenes to prepare. In Block Puzzle, it is the static field BlockPuzzleGameConfig.config.
A shortened version of game.config.ts:
static readonly config: GameConfig = {
system: {
canvasBackground: '#1d57c8',
screen: {
land: { width: 960, height: 540 },
port: { width: 540, height: 960 },
dpr: 'auto',
maxDpr: 2,
},
boot: { configs: { engineStartBundles: ['configs'] } },
},
assets: { bundles: BlockPuzzleAssetsManifest.bundles, preload: ['configs'] },
scenes: {
initial: 'boot',
map: { boot: BootSceneDefinition.config, game: GameSceneDefinition.config },
},
di: new BlockPuzzleDiDefinitionRoot(),
};
The land and port dimensions define virtual screen profiles. They do not fix the browser size: ScreenManager calculates the scale for the current window. maxDpr limits rendering density, not the cell dimensions in the game rules.
The optional layouts.textStylesConfigId field connects a catalog of text styles. data stores arbitrary application data; an unknown structure still needs schema validation when read.
The scenes.initial key must exist in scenes.map. Each key needs a matching SceneDiDefinition. Broken connections are detected at startup, rather than after the first move.