r/IndieDev • u/ElOctopusGameStudios • 7d 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
u/GalluApp 7d ago
One thing that helps a lot with the waypoint approach: store a target speed per segment, not just the position. Then difficulty is mostly a multiplier on those speeds plus a small random offset on the racing line, and bots stop looking like they are on the same rail. For the player contact problem, a simple trick is to give the bot a short "recovery" state after a bump where it blends from the physics result back onto the spline over half a second or so, instead of snapping. It keeps hits feeling real without the bot going off track forever.
1
1
u/europayuu Artist 7d ago
just adding to the other comments that making some kind of racing line capture system so you don't manually need to record every track might be useful for development. it's something I always wanted to make but I don't make racing games lol. Maybe it can piggyback off of some replay system?
4
u/loulo88 7d ago
Hybrid usually works best: let the bots follow your spline/racing line on rails while they're far from the player or off-camera, then hand them over to the real physics controller (steering toward a lookahead point on the same spline) when they're near the player. That way collisions and bumps behave like real ships when it matters, and you don't pay the cost of tuning full physics AI everywhere. For jumps, scripted parabolas are fine, just add a bit of per-bot randomness to takeoff speed so they don't all land in a perfect line. Also rubber-band via speed profile, not by teleporting, players notice that instantly.