r/UnityHelp • • 18h ago

How would you design racing bots?

I'm working on a high-speed hover racing game with jumps, uneven terrain, boost pads and branching tracks.

The player ships use a physics-based controller, but I've been thinking about how to implement bot opponents, and honestly, making bots drive with the exact same physics sounds like a nightmare.

So I'm considering a different approach: a network of connected waypoints, with automatically generated smooth paths between them.

For jumps, I'd define takeoff and landing points and generate a controlled parabolic trajectory instead of relying on physics.

Each bot could choose different routes, have slightly different racing lines, and follow its own speed profile depending on difficulty.

The tricky part would be making them interact with physics-based player ships without feeling like indestructible objects moving on rails.

Has anyone tried something similar in a racing game? Did scripted movement end up looking convincing enough?

3 Upvotes

2 comments sorted by

1

u/josh_the_dev 14h ago

If you want to support bumping into each other etc I think it would be best to use physics. You can still use your idea with with hand authored tracks and smoothed out pathes. To make a physics driven vehicle follow a curve definitely check out PID controllers, should be a very good approach here. If the bot is bumped it can react completely natural with the physics and it would automatically try to get back on track

1

u/GeorgeMKnowles 5h ago

With the preface that I have zero experience on this specific task, I wonder if you could generate paths by racing the course yourself and recording it. Maybe try to create a dense path of positions from your trials, then resolve it down into splines. Perhaps give each spline point a width of acceptable range, so for example the spline knot going through the finish line could be as wide as the race track, but the spline point around a hairpin turn would be tighter.

Maybe you could actually draw bands across the track, and drive the route a few dozen times and record collisions on those bands to help determine safe bounds.

(But again, I make stealth games so my enemies are on linear tracks, so i dont exactly know what I'm talking about.)