amaccann / phaser-navmesh-generation

12 stars 1 forks source link

Calculating 'gaps' or holes in marching-square blobs #1

Closed amaccann closed 7 years ago

amaccann commented 7 years ago

Problem

The marching squares algorithm works, but it doesn't 'find' any holes or gaps that might exist in a discovered blob of collision tiles. This is a perfectly viable scenario after all, you might have pockets of navigable areas in your map (eg, a ring of collision tiles with a square of viable terrain in the middle).

Ideas?

  1. Maybe reverse the calculations and instead of finding blobs of colliding tiles, find the blobs of non-colliding areas: that's what we want after all to put into the delaunay afterwards anyway. May need to add a phantom border around the edge of the map of colliding tiles so the calculation can 'find' all the way out to the edge.
  2. Another algorithm?? :D