Skip to content

GameOptions

Options for createGame.

canvas: HTMLCanvasElement


optional capacity?: number

Initial entity capacity; the world doubles it when full. Default 16,384.


optional fixedDt?: number

Seconds per fixed step. Default 1/60.


optional plugins?: Plugin[]


optional size?: "auto" | { height: number; width: number; }

The game’s size in screen pixels: what the camera shows at zoom 1, and the unit of screen layers, clip rectangles and the pointer. Size the canvas on the page with CSS (width: 100%; height: 100% for the whole window).

  • 'auto': follows the canvas’s size on the page, in CSS pixels.
  • { width: 1280, height: 720 }: a fixed size, scaled to fit the canvas and centered, with bars in the background color, so the game looks the same on every screen.

Either way the canvas renders at the screen’s full resolution (sharp on HiDPI screens and phones) and follows resizes and rotations. Leave it out to draw the canvas’s own width x height as they are and size it yourself.