How to make pathfinding paths vary

Godot Version

4.2.2

Question

I am making a racing game with enemy racers. I have programmed them to move checkpoint to checkpoint, possibly taking detours to pick up items or use speed boost pads. However, with this system, the enemies all move in a straight line. Does anyone know how to make these kinds of paths vary, introducing imperfections to optimal routes? Should I use the system of detours to add points that guide the racers off the path?

The solution I ended up coming up with was a waypoint system. Right now, I am trying to make a system where you have area 3Ds with a few marker 3Ds tied to them. When the enemies enter the area, their paths are set to target one of the randomly selected markers. I am trying to work out the details of the system now, but for me, it seems to be working so far.

A “waypoint” system is the correct choice for a racing game. Those are usually done with track curves where the ai drivers do closest edge segments checks and then steer towards the ideal track curve + some randomness and local avoidance.

2 Likes

would adding noise to the path add the bit of variation you want?

asking more than telling haha new to this too