This package provides a maze generation and rendering engine for the ARM Games project.
npm install @roudanio/mazeThis package provides a maze generation and rendering engine for the ARM Games project.
The maze logic is split into generation and rendering:
- src/utils/maze-generator.ts: Generating the maze grid using DFS.
- src/utils/maze-renderer.ts: Main entry point for rendering the maze to a .
- src/utils/layer-renderer.ts: Individual layer drawing functions (walls, player, food, etc.).
- src/utils/fog-renderer.ts: Handles "Fog of War" rendering using raycasting for visibility polygons.
- src/utils/canvas-helpers.ts: Shared canvas drawing utilities (e.g., stars, coordinate conversion).
``bash`
pnpm install
pnpm dev
The game includes a fog of war effect.
- Fog Radius: Controls how far the player can see. Default is 3.6.defaultRenderConfig.fogRadius
- Configuration:
- Global: Modify in src/utils/utils.ts.fogRadius
- Per Level: Add to the level config object in LEVEL_CONFIG.fogEnabled
- Toggle: Use in LevelConfig to enable/disable fog for specific levels.
This package uses Vitest for unit testing.
`bash`
pnpm test
Tests currently cover the geometric calculations for the fog rendering (raycasting, intersection).
test files are located in tests` directory.