News for hackers. Stuff that matters.
Re:Pathfinding for Tower Defense by fenomas on Wednesday January 02, 2019 @12:42AM (#18804415)
One thing I do in my game is use pathfinding to find suitable places for doors connecting rooms.

The process is, I randomly place some adjacent rooms, completely surrounded by walls. Then I set up a pathfinder (A*) where the cost of moving through walls is large but finite, and the cost elsewhere is tuned so that long detours can cost more than going through a wall. Then I run the pathfinder between various rooms, and place a door wherever the resulting path went through a wall.

This results in doors situated on "desire paths", so they look more or less like they were intelligently placed. It's also tuneable; you can tweak the costs to either get lots of doors and very convenient paths, or minimal doors while still having every room be reachable.

There are no comments on this comment yet.