Skip to content

Collision system v2: binary format, close-doors, and overlay visualization#2

Merged
PapaBlooD merged 16 commits intomainfrom
collision-v2-binary-overlay
Feb 11, 2026
Merged

Collision system v2: binary format, close-doors, and overlay visualization#2
PapaBlooD merged 16 commits intomainfrom
collision-v2-binary-overlay

Conversation

@PapaBlooD
Copy link
Owner

Summary

Builds on the binary collision cache concept from PR #29 by @grumpyowlbear. Migrates the collision system to a v2 binary format, adds close-door handling, and generates a collision overlay PNG with dungeons.

  • Binary v2 format: 18MB JSON → 7MB binary (67% smaller, 13x faster init)
  • Close-doors: Detect default-open doors (op1=Close) and add wall collision so pathfinder treats them as blocked
  • Wall diagnostics: Export endpoint returns all wall-layer locs for debugging
  • PNG overlay: Auto-generated visualization with overworld, dungeons, wilderness dungeons, and legend key

Detailed File Changes

sdk/pathfinding.ts (+93/-60 lines)

  • Replaced JSON import (collision-data.json) with binary file reader (collision-data.bin)
  • Added unpackCoord() to decompress packed 32-bit coordinates (z:14, x:14, level:2)
  • Added binary header validation (magic "COLL", version 1 or 2)
  • Added close-doors section: reads v2 closeDoors and calls rsmod.changeWall(..., add=true) to wall off default-open doors
  • Added close-doors to doorIndex so findDoorsAlongPath can detect them
  • Changed tile/zone/door loading from array iteration to sequential binary reads

server/engine/src/web/pages/api.ts (+21/-7 lines)

  • Added closeDoors array — locs with "Close" option (default-open doors)
  • Added wallLocs array — ALL wall-layer locs with blockwalk for diagnostics (locId, name, shape, angle, blockrange)
  • Changed door scanning to categorize: hasOpen → doors, hasClose → closeDoors, all → wallLocs
  • Updated response to return { tiles, zones, doors, closeDoors, wallLocs }

server/engine/tools/export-collision.ts (+424/-3 lines)

  • Added binary v2 output (24-byte header + packed tiles/zones/doors/closeDoors sections)
  • Added full PNG overlay generation with 3 map sections:
    • Overworld (X=2300-3600, Z=2800-3600)
    • Dungeons (X=2240-3520, Z=9216-9984)
    • Wilderness Dungeons (X=1856-3072, Z=4608-4928)
  • Added large legend key panel with scaled font, color swatches, and stats
  • Added diagonal wall rendering (NW/NE/SE/SW) with perpendicular-offset thickness
  • Added pure JS PNG encoder (zlib deflate, no dependencies)
  • Output always overwrites sdk/collision-overlay.png

sdk/collision-data.json (data change)

  • Now includes closeDoors (104 entries) and wallLocs (94,441 entries) fields

sdk/collision-data.json.gz (data change)

  • Updated compressed version (2.8MB → 3.2MB due to new fields)

sdk/collision-data.bin (NEW — 6.96 MB)

  • Binary v2 format used by pathfinding.ts (replaces JSON loading)
  • 67.5% smaller than JSON, loads in <20ms vs ~260ms

sdk/collision-overlay.png (NEW — 1.1 MB)

  • Generated collision visualization with overworld, dungeons, wilderness dungeons, and legend

Test plan

  • Export script produces all 4 outputs (JSON, gzip, binary, PNG)
  • Pathfinding tests: 30/30 pass with binary loader
  • Close-doors: 104 default-open doors correctly walled
  • PNG overlay: 5700x7600 with all 3 map sections and legend key

🤖 Generated with Claude Code

MaxBittker and others added 16 commits February 11, 2026 16:05
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nt routing

- Add populatedZones cache to reject empty ocean zones in snapToWalkable(),
  preventing the pathfinder from routing through water
- Add FLOOR_DECORATION to collision export FLAG_BITS so all blocked tiles
  are properly captured
- Export wall collision flags and door/gate positions separately, allowing
  the pathfinder to route through doorways while respecting permanent walls
- Add one-way door handling (Draynor Manor front door) and escape routing
- Add multi-segment routing for cross-continent paths (500+ tiles)
- Re-export collision data with all improvements (853k tiles, 1006 doors)
- Add 30-test pathfinding validation suite covering walls, doors, water
  avoidance, and cross-continent routes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Revert PapaBlooD's mining.md changes and remove the interactPlayer
feature (sendInteractPlayer, OPPLAYER packets, trade support) to keep
this PR focused on pathfinding improvements only.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove rs-sdk submodule (PapaBlooD's fork reference)
- Revert bun.lock configVersion formatting change
- Revert server/engine/bun.lock reformatting (no dep changes)
- Revert server/gateway/bun.lock (unrelated dep removal)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ation

Builds on the binary collision cache concept from PR MaxBittker#29 by grumpyowlbear.

- Migrate pathfinding from JSON to binary v2 format (18MB -> 7MB, 13x faster init)
- Add close-door detection (default-open doors that need wall collision added)
- Export endpoint now returns closeDoors and wallLocs for diagnostics
- Export script generates JSON, gzip, binary v2, and PNG overlay in one run
- PNG overlay includes overworld, dungeons, wilderness dungeons, and legend key

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@PapaBlooD PapaBlooD force-pushed the collision-v2-binary-overlay branch from d2e3962 to 263663f Compare February 11, 2026 22:06
@PapaBlooD PapaBlooD merged commit fcb38e3 into main Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants