There’s this older topic with some ideas. The ones I did I’ve never been super happy with:
Best I can tell it involves solving a lot of little problems that together can give the result you’re after.
* making car follow road. Obeying traffic rules.
*avoid collisions with obstacles.
*avoid collisions with other moving cars.
Pathfinding is too much for this, and it can’t handle moving obsticles. It’s enough to only look ahead a short time in the future. Basically calculate where the cars will be like 10 frames in the future if the stay in the direction they are going, and if they collide then brake or steer now to avoid collision. Seems there are a lot of options here, you could do something arbitrary or come up with something more sophisticated to choose what to do.
Probably you’d add some events for the cars ai so it can break some of the rules depending on the situation. On example is the pursuing vehicle, it would want to crash into the player car, and maybe wouldn’t mind hiring other cars or walls to do it.
Speaking of collisions, you’d probably want to use physics instead of the car behavior in this case. The solid behavior isn’t up to snuff for collisions.
For the Sunday drivers following the road, you can probably just have it decide where to drive as it goes. Mostly just knowing what road section it’s on and what intersection is coming up.
Out of ordinary stuff would be good to handle too. Like it the car is knocked off the road it may need to backup or whatnot to get back on the road. Or maybe it could need to navigate around cars blocking the road or make excessive maneuvers to avoid reckless drivers. There’s probably a lot of extra finesse you could add.
Kind of complex overall I think.
A simplification would be to just think of each car individually responding to its sensors of what’s around it. Could give some interesting divergent behavior.