Skip to main content
Built by Best ROI MediaMITWave 4 · LiveBestRoiMedia/bestroi-game-tools

light2d

2D painted-room lighting, hazard contrast, and route readability validator.

Lighting and visual-readability checker for 2D painted levels that verifies glows sit on lit sources, lightning/shadows stay inside openings, hazards remain distinct under color blindness, and playable routes stay readable.

View on GitHub ↗
Quick clonegit clone https://github.com/BestRoiMedia/bestroi-game-tools.git
GitHub repositoryBestRoiMedia/bestroi-game-tools
Module path_tools/light2d/
LicenseMIT
Release waveWave 4
LanguagesPython

Why we built it

Atmospheric 2D rooms often suffer from unmotivated glow sprites on blank walls, lightning spilling across solid masonry, or hazards camouflaged into dark painted backgrounds. light2d codifies our lighting and readability rules into automated checks.

Architecture & how it works

Sharing the scene2d/1 and anchors/1 formats with anchors, light2d.py checks relative luminance under glow centers against surrounding pixels, tests lightning and shadow-figure pixel containment against window/doorway polygons, evaluates hazard telegraph CIEDE2000 edge contrast across normal and Machado-2009 color-blind views, and measures median L* along the playable hero corridor.

Key capabilities

  • Verifies glow emitters sit on matching light anchors with bright painted source pixels
  • Enforces window/doorway containment for lightning bolts and shadow-figure effects
  • Audits hazard telegraph contrast against local backgrounds in normal and CVD views
  • Measures playable route corridor luminance (L*) to catch overly dark traversal paths
  • Outputs diagnostic lights.png, hazards.png, and route_heatmap.png overlays

Usage example

Validate lighting, hazards, and route readability for a 2D scenePython
python3 light2d/light2d.py check --scene ./scene.json --anchors ./room.anchors.json --out ./out/light2d
python3 light2d/light2d.py check --scene ./scene.json --anchors ./room.anchors.json --only hazards,route --out ./out
Threshold constants are echoed in every JSON report for transparent calibration.