Hello. I was wondering if someone could shed some light on how games generally base ai for racing... Like what is the logic? Im not asking for code, but the idea behind the ai they use. For example, lets use a simple racing game like Nintendo 64s Diddy Kong racing (yes I still play it :). The racers move indepently and can be attacked, bumped, stopped, etc and still figure out how to get back on track and in the race. I know of pathfindg for unity in general, but from I understand it basically uses a waypoint system. What I am confused about is do racing games use waypoints like this, or ***are the racers follwing the race track some other way***? If they do use waypoints, do they have to set up different waypoints for EACH different racer to follow? It doesn't seem so from playing any racing game, because with all the bumping and attacking going on to shuffle the racers, the racers still move uniquely around.
I am trying to build a racing game using highways I built both in unity (drag n drop highway pieces to build road) and pre built whole highways from 3ds max. I would like there to be random npcs going along the road at random speeds that if you collide with, will dodge or get back on track and keep going.
I have this currently set up with a very basic waypoint system- I simply made a waypoint string of objects along the highways for specific npcs to follow.
var WayPoints : gameObject[];
var curPoint : int;
I have it check 'WayPionts[curPoint]' while doing transform lookat and moving forward until it touches the current point by trigger, then I just do curPoint +=1 and rinse and repeat
This works, but to have multiple npcs I would have to set up mutiple, unique waypoint trains for each one. Not only is this tedious, but it's very unrealistic- each time you play you see npcs going striclty along some SAME path line.
I thought I could get around this by randomizing some of the waypoints during runtime in each npc's waypoint string, but it still looks too uniform.
I had an idea that maybe I should use bones and animate them going along the road in 3ds max, then in unity I could just child a racer to the bone, but the problem with this is that it would still be too uniform. I don't want the players to notice any patterned movements. I need randomized, free thinking ai.
Is there a better/simpler way to do this? What is the common ai logic for 'travelling/racing' npcs?
Thank you for your time and any advice
↧