Game AI - Carleton College

Download Report

Transcript Game AI - Carleton College

Game AI
Kevin Dill
Senior AI Engineer
Blue Fang Games
[email protected]
Blue Fang Games
“To create compelling, emotionally engaging
games focused on the animal kingdom that
set the benchmark for broad-based family
entertainment.”
The Plan
•
•
•
•
What is Game AI?
How does it compare to Academic AI?
A few common techniques
A few interesting research areas
NOTE: talk runs a little long
What is Game AI?
• Makes the characters in the game move
• Decide what, where, how, when
• Some uses of AI:
– Opposing/allied player AI
– Character AI
– Path planning & collision avoidance
– Animation selection
The Goals of Game AI
• Games need to be fun!
• “Organic credibility”
– Create the illusion of intelligence
– Players will make up stories about the AI
• Rule #1: Don’t look stupid
• Rule #2: Try to look smart
– But not *too* smart!
• Rule #3: Don’t cheat
• Rule #3 (revised): Don’t get caught!
Academic AI (vs. Game AI)
• Hard, unsolved problems
• Scientific method: Simplify & focus down
– Planning
•
•
•
•
•
Time
Resources
Imperfect knowledge
Failure
Not constrained by performance (mostly)
– Checkers/Chess/Go
Game AI (vs. Academic AI)
• Avoid unsolved problems like the plague
(unless it’s the core of your game)
• You can’t simplify the game away
– Time
– Resources
– Imperfect knowledge
– Failure
• *Very* constrained by performance
Techniques – Scripted AI
• AI Follows a script, much like a movie
– Script specifies exactly what will happen,
when it will happen, where it will happen
• Advantages:
– Gives designers explicit control
– Easy to write
– Easy to balance
• Disadvantages
– Extremely poor replayability
Techniques – State Machines
• States represent a high level view of what
the AI is trying to do
• Each state has custom code
• Transitions occur when the situation
changes
First Person Shooter Example
Got Ammo
Get Ammo
Run Away
Got Away,
Low on Ammo
Get Health
Got Away,
Low on Health
Low on Ammo
Low on Health
Attack
Got Health
Enemy
Lost
Enemy
Found
Search For Enemy
Techniques – State Machines
• Advantages:
– Easy to conceptualize
– Easy to implement
– Middleware tools exist
• Disadvantages:
– Quickly becomes large and unwieldy
• Difficult to debug
• Difficult to expand
– Rampant duplication of code
Techniques – Goal Based AI
• A “goal” is defined for every action that the
AI can take
• Examples of goals from Kohan II include:
Attack, Defend, Retreat, Explore, Build
• Each goal is assigned a priority, the
highest priority goal(s) are executed
Explore Goal Example
num_goals = 2
min_priority = 0
base_priority = 300
repeat_penalty = 100
black_fog_priority = 500
grey_fog_priority = 100
fog_search_depth = 3
current_region_bonus = 200
actor_region_bonus = 100
building_region_bonus = 50
flare_region_bonus = 1000
percent_to_count_region_explored = 0.8
consider_distance_to_kingdom_center = true
kingdom_center_distance_prefer_close = true
consider_distance_to_last_region = true
last_region_distance_prefer_close = true
consider_distance_to_actor = true
actor_distance_prefer_close = true
Techniques – Goal Based AI
• Advantages
– Flexible and powerful
– Can execute more than one goal at a time
– Emergent behavior
• Disadvantages:
– Performance issues need to be managed
– “Bucket of floats” can make balance tricky
– Emergent behavior
Research – Path Planning
• *Not* a solved problem
• Particularly interesting is how to handle
planning with constraints
– Travel in forest is slower then open fields
– Avoid being sighted by the enemy
– *Really* avoid coming under enemy fire
– See as much unexplored territory as possible
Research – Terrain Analysis
• How do I break the map up into
meaningful areas?
• What use can I make of those areas?
• How can I launch a multi-pronged attack?
• How can I identify strategically important
terrain to attack or defend?
• How can I identify my borders?
• What is the best placement for my scouts?
• Where can I ambush the enemy?
Research – Dynamic Difficulty
• Games need to be fun!
• How can I adjust game difficulty
dynamically so as to deliver the proper
challenge to the player?
• Is it possible to determine the challenge
the player wants? Or does that have to be
designer defined?
• How do I do all this without the player
catching on?
Resources
• Artificial Intelligence for Games
Ian Millington
• Programming Game AI by Example
Matt Buckland
• AI Game Programming Wisdom 1-3
Steve Rabin, editor
• Craig Reynolds’ web site
http://www.red3d.com/cwr/games/
Game AI
Kevin Dill
Senior AI Engineer
Blue Fang Games
[email protected]