Several 2D related question

Hello @aron_granberg or whoever feels like answering,

I’ve been using A* Pathfinding Project for my 2D platforming game, mostly to manage a bunch of flying AIs in the map. I had no problem implementing the asset using a gridpath generated from my tilemap, i’m actually grateful for how straightforward everything was and I have my behavior scripts up and running: the little guys fly around, attack, retreat and do their stuff properly.

I have some of questions, mostly meant to make the best of what I currently have and maybe optimize it a little bit:

-My maps are made of 2x2 units tilemaps, with occasional sloped tiles. In general, what’s the best approach to have a 1:1 walkable gridpath with a tiny bit of safe border around the tilemap? Is it better to have a matching 2v2 units gridpath? Half the size of the tilemap? something even smaller to account for slopes? My biggest problem at the moment is that often the AI will try to reach the player, who happens to be on a slope that is marked as non walkable cause the grid is too big (and they’re only squares anyway) so the AI ends up to the closest node and just stands there. (for context, AI has 0.5 radius)

-From a performance point of view, is it better to have 1 single (big) gridpath where all the AIs can move (with non walkable areas so they don’t all just go everywhere), or several smaller ones with the AIs checking only the grid they’re supposed to move in? For context, currently an average map with only 1 gridpath (size = 1unit) has about 70x40 nodes and i’m using 8 connection per node. I usually have no more than 5 flying AIs per map. Is it overkill?

-I tried to implement navmesh navigation, but since recastgraph doesn’t support 2D, i made a script to generate a mesh object from navmesh data (using navmeshplus as source for the data) to feed to navmeshgraph. Although it does seem to work if i use AILerp (the AIs will properly move, but in the lerpy robotic way) none of the AIs will move if I use AIPath (i can see seeker generating a path, but they won’t go there). I can’t figure out why, they’re both oriented for 2D games. Any clue?

-Final question, from a performance point of view, is it even worth to use navmesh for a 2D tile based platforming game? To be honest, I’m happy with gridpath and I wonder if i’m just wasting time trying to implement a navmesh solution, when the sole reason i would like to do it is because i can generate a navmesh that accounts for slopes and has a nice edge border.

Kind regards


That’s a tiiiny graph. Don’t worry about performance, just do what works best for you and is easiest. If a grid graph works for you then by all means go for that.

I usually recommend 1 big graph.