Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / AI for a racing game

Author
Message
Hopilite
20
Years of Service
User Offline
Joined: 19th Jan 2004
Location:
Posted: 10th Apr 2004 04:09
Can anyone tell me how to make a good AI for a racing game?

Some people say 2+2=Fish.
I don't.
andrew11
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 10th Apr 2004 04:15
Basically, in a racing game theres 3 things racers want to do:

o Get to the next checkpoint.
o Stay on track.
o Dont crash into other cars. (Unless they are crazy!)

An example would be (Pseudo-Code)
Move Object Car 2
If Distance(Between Car and Road) < 2 then Move away()
If Distance(Between 2 Cars) < 2 then Move away()

After you make those, you need some randomization to dumb the computer down since no racer is perfect and you wouldnt have a game then!

If RND(100)=1 : ` 1% Chance each loop
Move away
Endif

"All programmers are playwrites and all computers are lousy actors" -Anon
Don Malone
21
Years of Service
User Offline
Joined: 27th Apr 2003
Location: Birmingham, Alabama
Posted: 10th Apr 2004 04:18
First you have to decide what or how your AI should do or respond.
How will you design your track?
How will the game play?
will it be a straight up racer or a Mario Kart clone?
How many opponents will there be?

Your first step will always to be to figure your needs and then create an AI that works based on those needs.

I also want to one day make a racerand have seen a few tips on the forumn and I will post the links when I get a chance.

Good luck with your project.

Wasting CPU Cycles since the 286 was a hot machine.
Hopilite
20
Years of Service
User Offline
Joined: 19th Jan 2004
Location:
Posted: 10th Apr 2004 04:35
Thanks for the suggestions

Some people say 2+2=Fish.
I don't.
Sparda
20
Years of Service
User Offline
Joined: 13th Jan 2004
Location: Pacifica
Posted: 10th Apr 2004 07:35
I really suggest you check out Astar for your AI. Astar is a pathfinding algorithm that is easy to write and understand. Since racing really only needs pathfinding, you probably will want to go with the Astar method. Here's a site I used long ago to get started:
http://www.aiguru.com/pathfinding.htm
Also check out http://www.gamedev.net// for more resources

There 10 kinds of people, those who understand binary and those who don't
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 10th Apr 2004 20:27
http://www.policyalmanac.org/games/aStarTutorial.htm

my fav a* tutorial.

also, you could use waypoints, which is a method of going to and from invisible objects (usually boxes)
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 11th Apr 2004 01:14
A* may be overkill.

If it's a first attempt at a racer, simple waypoint to waypoint may be enough.

I would suggest getting the cars travelling around the track via waypoints, then build some additional AI over that once it's working.

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php

Login to post a reply

Server time is: 2024-09-22 04:34:25
Your offset time is: 2024-09-22 04:34:25