After shipping the map cache parser and the initial .rcnk map format, it became clear that our collision and line-of-sight systems were held together with assumptions rather than solid specification data. This week we threw it all out and rebuilt from the ground up.

The Problem With the Old System

The old system used a boolean walkable flag per tile — true or false, nothing more. This is completely insufficient for the game's design. Our specification requires a rich 32-bit TileFlag bitfield that encodes cardinal and diagonal blocking directions, projectile LOS separately from movement LOS, and various special-case flags for doors and prefab overrides.

The moment we tried to implement NPC pathfinding with proper LOS checks, the gaps were obvious. Mobs were walking through walls, arrows were phasing through trees, and door logic was impossible to wire up correctly.

TileFlags — The 32-Bit Bitfield

Every tile in the world now carries a 32-bit unsigned integer TileFlag. The layout follows our design specification exactly:

  • Bits 0–7: Tile movement blocking (N, E, S, W, NE, NW, SE, SW)
  • Bits 8–15: Projectile LOS blocking (same directional layout)
  • Bit 16: Full tile block (movement)
  • Bit 17: Full tile block (projectile)
  • Bit 18: Bridge tile indicator
  • Bits 24–31: Reserved for future scripted flags

This gives us everything we need to implement the game's pathfinding, LOS checks, and future scripted event flags without changing the tile data format again.

WorldTopologyModule Replaces Two Legacy Modules

The old architecture had WorldBakeModule and PrefabCollisionModule as separate systems that both wrote to shared tile state in undefined orders. This caused intermittent bake bugs where prefab collision would be partially overwritten by terrain bake or vice versa.

WorldTopologyModule is a single, ordered pipeline:

  1. Load terrain topology from the game's cache data
  2. Apply flo.pack overlay flags (water, lava, blocked surfaces)
  3. Stamp prefab footprints using the prefab's declared flag mask
  4. Apply runtime overrides (door open/closed state)
  5. Write final TileFlags to the chunk's topology buffer

Order is deterministic. No shared mutable state between steps. The topology buffer is immutable after step 5 — runtime door state is applied as a delta, not a rewrite.

.rcnk Format v4

The chunk format was updated to v4 to accommodate the new topology buffer. Each chunk now contains:

  • Header: magic bytes + version (u32) + chunk coordinates (i32, i32)
  • Terrain mesh data (vertices + UVs, unchanged from v3)
  • Topology buffer: one u32 per tile, 64×64 tiles = 16,384 bytes per chunk
  • Prefab reference list (id + position + flags)
  • Object spawn list (npc definitions + item definitions)

Old v3 chunks are automatically migrated on first load — the topology buffer defaults to all zeros (fully walkable, no blocking), then the WorldTopologyModule rebakes them on the next editor export.

What's Next

With the topology system solid, the next milestone is wiring the NPC pathfinder into the real TileFlags data. We also need to implement the door state intent handler so players can open and close doors with the correct LOS updates propagated to nearby clients.

If you want to follow the day-to-day progress, join the Discord — that's where the real-time dev commentary lives.