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.
Configure startup using the example in game.config.ts:
static readonly config: GameConfig = {
system: {
renderer: new PixiRendererModule(),
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(),
};
Import PixiRendererModule from @gamedevland/engine/renderers/pixi. The required system.renderer field selects rendering and registers the standard node types. The game does not need to register Container, Sprite and Text again in DI.
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.