#Are NavigationAgent2D enough for most projects compared to AStar Pathfinding?

1 messages · Page 1 of 1 (latest)

somber root
#

Sprout Coder here, with max 2 months of Godot experience. For my tiny Colony Simulation game I needed Pathfinding. And for the last 2 days I've been trying to use AStar Pathfinding. Saw it was more efficient and the tutorial on Youtube also used it.

But after 2 days of still not managing to make it work correctly, and not fully understing myself what I'm putting in my code, or how it correctly works I know I should look for alternatives, and even if NavigationAgent2D are "marked as experimental" the tutorials seem great, the Godot Documentation on them and Navigation Agents is full. And I'd just like to know if realistically it's not "enough" for most game made and I'm just crashing in a unrealistic big wall for a beginner

lean sierra
#

It's not experimental and doesn't use NavigationServer2D

somber root
# lean sierra I assume you are trying AStarGrid2D? https://docs.godotengine.org/en/stable/clas...

Yes indeed sorry, although my problems don't directly come from AStarGrid2D I think. I've got it working for 1 NPC, but when there are multiple ones that dynamically change position too, and variables everywhere, and certain data are in Global Pixel position and transforming them to Grid Position and sending and receiving data from one script to the other. I think I'm also losing myself in my code and NavigationAgent2D are a bit more less messy and less "everywhere" (at least they look like it?) and I'm wondering if they would be a bad alternative

lean sierra
#

Your game looks "turn based" as in, you go through the list of npc's and do the calculations one after the other, no?

#

I think the only thing you would have to do with AStarGrid in comparison to NavigationAgent is filling solids (other npcs/walls/stuff) before you calculate the path.

#

but even with NavigationAgents you still have to compute the path every now and then

somber root
#

The goal is:

Every 2 seconds there is a "Tick" and actions happen

Then NPC's do one action or move one tile

lean sierra
#

ya, but you can't calculate all paths before moving everything, you have to do it sequentially

#

because something might move into something elses path

#

unless your characters can stand on the same cell, then it's not a thing ofc

#

The biggest and most useful thing i can recommend, when dealing with path stuff, is to actually draw the full path.. it's time well spent ;)

somber root
somber root
lean sierra
#

you're welcome.. hope you find a solution you like