Pathfind Along specified path in isometric game

I’m trying to make a vehicle pathfind on a road. I’ve got that working, but my problem is making it stick to its lane basically
2023-04-29 00-00-31 - current implementation

Currently it works by pathfinding to the center of the cell I click and the obstacles are grass and invisible blocks that spawn around each intersection to straighten up the path so it doesn’t cut corners so much but that only works for proof of concept.

In the end I’m going to need it to stay in its lane, behind other vehicles, and stop at intersections for other traffic.

I know about grid based pathfinding but I don’t think that will work for me here.
I figured id worry about interrupting its path and regulating its speed later but I’m pretty lost currently.

Any help would be appreciated

This documentation could help:
https://wiki.gdevelop.io/gdevelop5/all-features/extensions/linked-objects-tools/

The tactical example seems similar to what you want to do but with hexagons instead of isometry and the city builder example uses isometry but don’t do movement (though they both use the same extension).

Thank you for this, I will check it out.

Is there a way to get the objects on a path in the order they are on that path?

I figured I could Run a quick object through the path that’s invisible or something and log the data to an array that I need to log then send the actual sprite through with the array info it needs along that path, but I’m sure that there is a better way than that to do that.

What’s the ultimate goal? Will there be cars in each direction? How are they being controlled? Are they all autonomous? What does the player do? Is it a set track or user created?

In the end they will have to be able to drive from any user made point to another. No set tracks. They can drive on both directions of the road. They won’t be player controlled, they will go from building to building. The pathfinding should avoid broken road pieces and stop at stop signs, give way to other vehicles.

I’m only trying to figure out the lane problem currently though. As that seems to me to be the hardest.

1 Like

Will the player click on the road or on the buildings? I’m just wondering how the cars know where to go.

The player will select the building

Ok. I forgot about this. Have you made progress?

That simplfies the navigation. The player clicks the building. A car is set in motion with the pathfinder behavior. I was playing with a few concepts. When I’m at my PC I’ll look at what I had and try to post something.

I haven’t been able to wrap my head around the linked objects extension pathfinding, and I’ve had irl stuff going on. I’ve mostly been doing research and trying to think of things that will work.

I look forward to see what concepts you came up with!

I looked at what I had and it’s not working. I forgot it was isometric. I’ll think about it.

Sounds good, I haven’t had time to work on it yet myself

It took some doing but I made some progress. I still don’t really understand the linked objects tools but I was able to get it to work based on the examples. It’s still far from workable for your project but I think the technique might be there.

Click on any road tile. You can’t click when the “mover” object is moving.

Source:

I left the tile set in the asset for in the original zip in case you want to experiment with them or use them for reference. I know you plan on having the player click a building. The building could choose any tile to go to. You just need to link the target to the road and the road link. You also need to remove any previous target first.