I'm creating an isometric game and require astar for my path finding however I can't find how to do it online for my specific situation.

I need the astar grid to be smaller than my tile size, specifically a 3x3 grid inside one tile. This is because my walls are in the middle of a tile and I would like the ability to path find alongside the wall. Each vertex would be connected to the neighboring vertices but not vertically and horizontally (i.e. in a non isometric grid, the vertices are connected horizontally and vertically but not diagonal!) But if there is a wall on the vertex then that vertex can't be connected to any other vertices, however if there is a doorway then the ai can move through it.

My walls are set up in a tilemap using an auto tile system including the doors, so I'm unsure how to detect which is a wall or a doorway without changing my tileset (which I'm okay with doing)

Any help or suggestion is appreciated!!! Thank you!

Example of the walls: (https://i.imgur.com/1Hf6iSe.png)

Godot includes navigation functionality. It works with TileMaps and might work with isometric as well. Astar is an option (it comes with Godot) but I think the navigation will do what you need and be easier. See this video I found.

Thanks for your reply, however I require my navigation to be grid based. Kinda like the old game “Zombie Cafe”

To my understanding the navigation doesn’t do what I want, however I might be wrong about this.

Also in that Video they use it on the ground tile and didn’t show any “obstacles” or walls so I was unsure how to use it. Would putting the navigation on the ground tile, then (sorry I forgot what it was called) put a navigation exclusion zone around the walls? Even though they are on seperate tile maps, would the ai still use both for navigation from the ground and avoid the walls from the other tile map?

Thank you!

That does sound good, however I would like to continue with the Astar path. While looking through tutorials one said (I can’t remember the exact code) that you can implement your own grid into astar. I was trying to search now to create your own however I couldn’t find how to.

So I’d like to create my own gird of vertices. I just had an idea of creating another tilemap that is smaller to my specifications and use that for the astar path finding however the isometric problem still occurs. What if I do a normal grid and rotate it to fit isometrically?

Then how would I detect the walls?

Thanks for your help!

You can paint a navigation path on each tile. It doesn't have to be the full size of the tile. But it would get complex to move in different directions, so I'm not sure navigation is the right choice. If you look at that link I posted, you can see how they define their own grid of points to use for the astar.

I have fully implemented AStar in games twice now and I'd say avoid it if you can. Your brain will thank you. If not let me sum up the steps: 1. Over your domain add points using add_point. If it's a grid you can imagine how you'd loop through each point on the grid. You'll also need to consider where the points are on these tiles? In the middle? Each corner? 2. Next you need to connect all those points which is another tricky task. Sure you just want to connect each point to the ones next to it, but how do you know which points are near it, and how are you going to avoid connecting two points twice? The way I did this is just start at the bottom left corner and connect up, right, up and left, and up right, letting connections be two way. You need to be able to find those points. This is tricky because the sides of the grid are going to have exceptions.

if(!rightSidePoint): connect_points(i, i+1, true) # Connect right if(!topSidePoint): connect_points(i, i + gridwitdth + 1, true) # Connect above if(!leftSidePoint): connect_points(i, i + gridwidth , true) # Connect up & left if(!rightSidePoint): connect_points(i, i + gridwidth + 2, true) # connect up & right

Then you're done, hurray! You can ask your Astar for paths between points. Note also you can give points weights. If there's water or something they might want to avoid you can give it a higher weight.

I have used this to compute statistics on terrain, but I have not used this to actually move characters but I'm planning to, so if you (or anyone else) has some info on how to smooth movement on a path I'd appreciate it.

4 days later

Hey, thank you for your reply and my apologies for my late reply.

I'm changing my game a bit and my specifications have changed only slightly, I'm not sure if I should do another post or keep commenting here as it still has to do with isometric astar.

Basically I'm not doing the walls in the middle of the tiles anymore however they are on the edges of the tiles, so I only need one grid for the astar however I would like it to not be able to connect points that are blocked by the walls (obviously) but lets focus on the isometric astar working.

No firstly I'm still a beginner with godot and coding in general, but I still want to give it a try however I cant seem to find any in depth tutorial on how to code an astar algorithm with explanations and demonstrations for each method and how to put it all together. Which is an issue when I'm trying to learn how to do it.

Sorry for this rushed reply, I am quite busy but I appreciate your help! Thank you

Also is there some sort of debug tool where I can see all nodes and connections?

@CauseTripod said: Also is there some sort of debug tool where I can see all nodes and connections?

I wish! =) I admit this is definitely an intermediate level programming task. With godot's astar you can disable any point in the path. What I always end up doing to debug is, after recovering from a catatonic state from implementing AStar, have it compute some simple paths say from one side of the map to the other. It will give you the list of points and you can use something else to display them. I have lines drawn from one point to the next. This might prove helpful:

Edit: Actually there are tons of youtube videos on Astar. My advice might make more sense after digesting a few.

11 days later

Hello everyone, thanks for your replies and sorry for my late reply (I'm really busy at the moment with exams)

With the help of someone else I have a working astar path finding for isometric tiles. However it only works with the root view. If i have a new camera 2d node set to current, my mouse position is still only from the root view even though my camera node is moved further out.

What I want to fix is the destination variable, I've tired global_position and other things but nothing works.

Any help is appreciated!!! https://i.imgur.com/ZOxC2L0.png https://i.imgur.com/vb54OH5.png

I’m not sure if Ground does, but Area2d or other nodes I’m sure have a on input event signal you can connect to your script. It will send over the mouse data you want when a click or something happens. I go over signals in this vid I made last week, and there’s even code in there for detecting a left mouse click. Hopefully will help ya

Hi thank you for your reply.

I feel really dumb but for some reason its working with get_global_mouse_position() after I have tried it already, but it works which makes me happy!

Thank you all for your time and help, I appreciate you all!

a year later