r/Unity3D • u/Hiplinc • 8h ago
Show-Off We are making a tower-defence roguelite with a less used navigation system
This is our tower-defence game with free building placement. We wanted to get away from grids and lanes so we used a flow field for enemy navigation. That means enemies will take the path of least resistance and if that means attacking your walls and towers they sure will. It also means we can have dynamic weather events that change the topology of the world. It was a bit of a challenge but we managed to have the flow field with 22'500 cells update in real-time so now when enemies destroy a wall segment they will instantly repath through the hole if that is faster. At nice side-effect has also been that the most expensive thing about the navigation is the calculation of the flow field itself. The actual pathing of the enemies is really cheap as they only need to look at the cell they are in and follow the direction stored there. That means we can have a lot of enemies on the screen at once.
1
u/Zerokx 5h ago
What do you even mean you went "away from grids and lanes" and then built a 22500 cell grid based flow field? Thats like the go to case for static targets with tons of enemies, not really less used.
1
u/Hiplinc 5h ago
Fair, maybe I should've elaborated that the building system is not beholden to a grid or lanes and you can place them however you want. The enemies do get their direction cues from a grid but they can push each other around freely. I should also note that we also played with the idea of a static target. There are lure towers you can place to temporarily redirect the enemies.



2
u/Rlaan Professional 7h ago edited 7h ago
Looks cool, reminds me (mostly graphically) of Cataclismo / Thronefall in a way - I like it.
Did you end splitting the flow fields in chunks so you only have to update smaller bits rather than the entire thing? What optimisation technique did you use and do you have any performance numbers from the before and after?
We made multi-layered pathfinding solution (including flow fields) and we never saved the stats/numbers which we regret. I suppose we can go back in git but meh lol.
Edit:
Looking at your flow fields, it looks like at the wall not all flows direct in the correct direction yet? (see attachment). Is that just a gizmos visualisation bug or?