Pathfinding for Enemies in a Fixed Path Tower Defense

Godot Version

4.3

Question

So I’m working on a Tower Defense Proof of Concept just to see if I can yknow? and one of the things I’m stumped on is how to deal with Enemy Pathfinding. Mostly just cause I haven’t really touched pathfinding in Godot at all tbh. The game uses a traditional “fixed path” style, so think how games like Bloons & Element TD handle pathing. and in Those game’s I know they use like a series of “destination Points” that enemies walk towards in sequence that eventually leads to your base if that makes sense.

It sounds a lot like how I wanna set things up again I just don’t know how cause I haven’t played around with pathfinding much. If anyone would mind sharing some resources or help point me in the right direction that’d be greatly appreciated

You can use Path2D/3D and a PathFollow node for fixed paths, this is much faster and easier to work with than navigation-based pathfinding.

1 Like

That depends on what kind of path movement you are after, you could use a basic waypoint system if you just want strict and simple line movement, or you could use the navmesh when you want to define entire movement surfaces for more detailed and complex movement.

E.g. Godot tower defense games Rift Riff use the 2d navmesh and NavigationAgent2D with the build-in avoidance system.

(I am not associated with them, I just think their game is cool and fun and a good example what you can do in Godot with the available navmesh and avoidance system).

2 Likes