Racing Game A.I.
Download
Report
Transcript Racing Game A.I.
Racing Game A.I.
By Austin Borden, Qihan Long, and Jim Pratt
Defining the Racetrack
Sectors
Define on-track areas
Interfaces
Leading and trailing edges of a sector
Interfaces
Right/left edge
Driving line nodes:
Racing line
Overtaking line
Overtaking
When the A.I. car gets close to an opponent, it will change
its driving line from racing to overtaking
Multiple overtaking lines possible
Burnout 1:15
Sectors
Stores its distance from start, to finish line, and to other
vehicles.
Path types
Terrain types
Walls
Hairpin turns
Brake-Throttle
Path Types
Defines the type of route ahead
Normal
Shortcut
Long route
Weapon pick-up route
Winding road
Drag strip
A.I. chooses route depending on current situation
Terrain Types
Adds another variable for A.I. to deal with
Rugged terrain
Slick
If a route is a shortcut and also rugged, only vehicles capable
of traversing will choose this route
Terrain Traversing
Racetrack Definition Conclusion
The more information we provide, the less complex the A.I.
system has to be
Racing A.I. Logic
Vehicles do not follow driving lines exactly, only guided by
them
A.I. is supposed to emulate human input
Done by creating an A.I. controller
Basic A.I. Framework
Finite State Machines
Allows decision making
Fixed Time-Step
Ensures that AI reacts quickly always
Controls
float dx;
float dy;
//-1.0 to 1.0 for left to right steering
//-1.0 to 1.0 for max brake to max acceleration
Looking Ahead
Cars look ahead for obstacles and turns
The faster it’s moving, the further it looks to smooth path
Wall Avoidance
Position is predicted by using the current velocity and scaled
by how far in the future we are predicting (seconds)
Correction amount is then applied to steering depending on
which wall car is closest to
If predicted position is outside of sector, brakes are applied
Hairpin Turns
Looking too far ahead during a sharp turn will cause A.I. to
cut corners
To fix this, car looks for hairpin flags and shortens the look
ahead distance if flags are found
Under/Over-Steer
With simple physics cars can spin out due to over steering
Cars can also miss turns due to under steering
Based on sideways velocities of wheels
Steer Correction
Depending on over or under-steering, a correction value is
added to the current steer value
Overcorrection is prevented by the understeer/oversteer
range
Colin McRae Dirt 2
Catch-Up Logic
If A.I. is winning…
Limit A.I.’s top speed in proportion to distance leading
Brake early for corners, accelerate slowly out of turns
Take long routes/ unstable terrain routes
Get worse weapons/ only target other A.I.
Opposite can be used if A.I. is trailing
Good way of making a race challenging for all skill levels
Diddy Kong Racing 1:45
Shadows of the Empire 5:50
Catch Up Logic Case Study:
Pure
The Rubber Band System
Racing Grouping in Pure
Difficulty Regulation
Powerful items
Intelligence modification
Similar Placing
Tuning the Car Handling
If each car has different characteristics, tuning the code can
be time consuming.
Adjusting the Parameters
Assign each parameter with a minimum and maximum value.
Modify the parameter depending on whether the lap time
decreases or increases.
Time for this process can be reduced by running the game as
fast as possible.
Real Time Editing
Real Time Track Modification
An important tool in AI creation is the ability the change the
track in real time.
Allows problems in the track to be quickly modified and tested.
User Control Overriding AI
Allows tester to take control when AI becomes stuck or
incapable of navigating a certain part of the track.
Can be used to test the AI on specific parts of the track.
Layer Behavior
Reactionary system
Modular approach makes it easy
Multiple inputs for one output
Output contention system ultimately determines output
Layer Interactions:
Overriding
Internal states
Altering input for other layers
Example of Layers
Path Following Layer
Turning and speed dealt with separately
Attempt to keep car on line
Cornering regulation monitors speed
Corners and apex determined
Formulate max speed and braking zone distance
Dynamic according to current speed
Braking, cruise, full throttle
Tactical Racing Layer
Makes competitive racing choices (driver into a racer)
Analyzes situation and races accordingly
Find optimum road position
Generates new paths
Safe guards in place
Visual Perception
8 eyes, 4 pairs
Determines speed and position of cars and environment
Determines desirability of current position based on
environment and position of other cars
Fine Grain Avoidance Layer
Priority
Needed when cars want to occupy same space
Relative car position determines who yields
Prevents collisions by overriding
For passing, steering is moderated
For linear, speed is moderated
Determining Racing Lines
Problems with user made content
Track detail hard to take into account
Lines of minimum curvature are limiting, boring
Midway points across track
Forces used to smooth out sharp turns
Safe guards
Competitive AI Racing Under Open
Street Conditions
Allows an AI controlled vehicle to traverse an random
network of roads.
Finding the correct route to destination.
Calculating steering brake and throttle values.
Library Interface
RegisterRoute Interface
Holds a list of intersections and roads
Registers the path through the map
Called when entering a new route
DriveRoute Interface
Used on a lower level than the RegisterRoute interface
Calculates steering, throttle, and brakes
Used for driving forward, backing up, colliding, and stopping.
Navigating the City
Find the current location
Update the road cache
When a road is fully traversed, loads a new road into the cache.
Emulate all possible routes
Finds possible routes
through the road
Avoiding obstacles
Check for obstacles after the route is calculated.
References
Champandard, Alex J. "Paris Game AI Conference '09: Highlights, Photos &
Slides." Game AI for Developers. Web. 24 Mar. 2010.
<http://aigamedev.com/open/coverage/paris09-report/#session13>.
"Gamasutra - Features - The Pure Advantage: Advanced Racing Game AI."
Gamasutra - The Art & Business of Making Games. Web. 24 Mar. 2010.
<http://www.gamasutra.com/view/feature/3920/the_pure_advantage_adva
nced_.php>.
"Mario Kart Wii: Those Damn Powerups." GamerBunny Speaks. Web. 24 Mar.
2010. <http://gamerbunny.wordpress.com/2008/05/19/mario-kart-wiithose-damn-powerups/>.
Rabin, Steve. AI Game ProgrammingWisdom 2. Hingham, MA: Charles River
Media, 2004. Print.
Rabin, Steve. AI Game ProgrammingWisdom. Hingham, Mass.: Charles River
Media, 2007. Print.
Youtube. Web. 24 Mar. 2010. <http://youtube.com>.
Questions?