A* Pathfinding Project

Beginner questions - RTS game with vehicles and roads


#1

Hello,

I recently joined a team using this asset, and I am a little confused on how to apply it. I was wondering if I could get some pointers.

The game is an RTS where players can select vehicles and right click on the map to move them there. I would like these vehicles to conform to roads if possible. From what I understand, I would need to use a waypoint system through a point graph? How can i generate these waypoints dynamically? I want these vehicles to also conform to certain rules such as not going against traffic or not entering one way roads, but these rules can be broken in some cases. For that, do I simply need to increase costs for those tags?


#2

I have no experience with the point graph at all so I’m just throwing some ideas around.
Customizing the point graph system to have a seperate cost depending on direction would give you great results for cases with one way streets.

For a 1 section of 2 way road I would make 4 points, left lane start and end, right lane start and end.
Then connect left start to right end, and right start to left end. Once again making use of the directional penalty system, cars would prefer moving on their own lane. Though have the option to switch to the opposing lane’s path at a higher cost.