I add the CarAI object to the project.
This will be the brain for the CPU controlled car.
I link it to the reference Path, the car to drive (CPU car) and the obstacles to avoid (my car).
In the property dialog for the CarAI object, I specify the role for each of the linked objects.
Note that I also set the CarAI object to not-Working At Start, because I don't want the CPU
car to start before the 'GO!' event, in my racing game.
I then link the EVENT: show 'GO!' object to the CPU car and the CarAI object.
In my little racing game, this will activate the CPU car and its brain when the countdown is complete.
When I launch the project you can see the artificial intelligence in action.
The red car isn't easy to beat. CarAI drives fast, it can recover from crashes and avoid sudden hazards, like
my flipped-over car at the end of the movie.
That's a heck of a driver! And these are just default artificial intelligence settings on a default car-physics-layout!
Please allow some time for the movie above to load. If you can't see the video after a reasonable delay, please
click here. Note that this clip has no audio.