Skip to main content

Debugging Tools

The engine comes with built-in debugging tools to help you visualize the grid, monitor performance, and track camera state. These tools are rendered on top of all other layers.

Enabling Debug Mode

Debug features are controlled via the debug object in the configuration.

const config = {
// ...
debug: {
enabled: true,
hud: {
enabled: true,
coordinates: true,
scale: true,
tilesInView: true,
fps: true,
},
},
};

Heads-Up Display (HUD)

Displays real-time information about the engine state in the top-right corner of the canvas.

PropertyTypeDefaultDescription
enabledbooleanfalseToggles the HUD panel.
topLeftCoordinatesbooleanfalseShows the world coordinates of the top-left corner of the viewport.
coordinatesbooleanfalseShows the world coordinates of the center of the viewport.
scalebooleanfalseShows the current zoom level (pixels per grid unit).
tilesInViewbooleanfalseShows how many tiles fit horizontally and vertically in the current view.
fpsbooleanfalseShows the current frames per second (continuously updated).

HUD Example Output

When enabled, the HUD panel might look like this:

TopLeft: 10.50, 5.20
Coords: 15.00, 10.00
Scale: 32.00
Tiles in view: 25 x 19
FPS: 60
tip

The HUD is rendered using a semi-transparent black background with bright green text (#00ff99) for high visibility on any background.