@roudanio/maze
v0.3.2
Published
This package provides a maze generation and rendering engine for the ARM Games project.
Readme
@roudanio/maze
This package provides a maze generation and rendering engine for the ARM Games project.
Architecture
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<canvas>.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).
Development
pnpm install
pnpm devFog of War
The game includes a fog of war effect.
- Fog Radius: Controls how far the player can see. Default is
3.6. - Configuration:
- Global: Modify
defaultRenderConfig.fogRadiusinsrc/utils/utils.ts. - Per Level: Add
fogRadiusto the level config object inLEVEL_CONFIG. - Toggle: Use
fogEnabledinLevelConfigto enable/disable fog for specific levels.
- Global: Modify
Testing
This package uses Vitest for unit testing.
pnpm testTests currently cover the geometric calculations for the fog rendering (raycasting, intersection).
test files are located in tests directory.
