LoneTower
A 3D tower-defence MVP prototype in Unity 6 (URP): procedural corner-typed voxel terrain, a custom flow-field navigation resolver (BFS cost field + boid steering), and a connector-aware block-building sandbox.
LoneTower is a 3D tower-defence MVP prototype built in Unity 6 (URP) centred on two interlocking systems: a procedural voxel-ish terrain generated from a corner-type grid, and a custom flow-field navigation resolver that drives agents over that terrain without using Unity's built-in NavMesh.
The terrain is a vertex-grid where each vertex is typed as Land or Water with a biome. Each cell derives a presentation (variant + quarter-turn rotation) from its four corner types via a 4-bit bitmask classifier (marching-squares-style), then assembles either an authored FBX tile mesh or a runtime-built placeholder quad. Slope analysis (triangle-normal dot-product against a configurable walkable-slope threshold) decides which cells are traversable and buildable.
The standout piece is the NavigationResolver — a self-contained flow-field pathfinding and steering system. A BFS integration builds a per-goal cost field and direction field over the grid; agents sample the direction field for a preferred velocity, a spatial-hash broadphase collects neighbours, and a boid-style steering layer (separation + goal slowdown) produces a safe velocity. A topology-version cache invalidates fields on terrain/block changes, and a mutation-preview API validates whether a pending block placement would disconnect existing agents from their goals before committing.
Key features
- Procedural voxel-ish terrain from a corner-type vertex grid — 4-bit bitmask cell classification (6 variants × 4 rotations = 24 presentations).
- Custom flow-field navigation resolver: BFS cost field + direction field, spatial-hash broadphase, boid-style steering — no Unity NavMesh.
- Topology-version cache invalidation: fields rebuild lazily on terrain/block changes.
- Mutation-preview API: validates block placement won't disconnect agents from goals before committing.
- Connector-aware tower block system: 24-rotation cube search for deterministic mesh selection from connected faces.
- VContainer DI composition root; MessagePipe events; UniTask async; Strategy camera (zoom/pan/orbit).