SlideShare a Scribd company logo
1 of 76
From the Ground Up: A.I.
Architecture and Design
Patterns
Dr Brett Laming
Rockstar Leeds
Contents
• Basic Principles
• Think/Act - The I/O Divide
• An Algorithmic Approach
• A Functional Approach
• Movement
• Animation
• Conclusion
Basic Principles
Why Do We Care?
• It’s a Competitive
Market…
– Higher Expectations
– Tighter Schedules
– Multiple Platforms
– Simultaneous Titles
• …But Patterns Are
Everywhere
– Identify, generalise,
reuse, evolve
> Reliability
> Production Speed
⇒ More Fun Stuff
Inspirations
Marvin Minsky
Different representations
for different views
Noam Chomsky
Hierarchical
decomposition
Structure vs Meaning
“Colorless green ideas
sleep furiously”
Daniel Dennet
Behaviour can be
viewed at the physical,
design and intentional
levels
David Marr
Computational,
algorithmic and
implementational
Chris Hecker
Style vs Structure [2008]
What is the textured
triangle of A.I.
Craig Reynolds
Simple rules
Complex behaviour
Damian Isla
Cognitive Maps
Spatial Relations
Semantics
What Am I Looking For?
Best
Practice
Hierarchy
Reusability
Commutability
Concepts
Components
How Do I Find Them?
• Observation
– How might it work?
• Introspection
– What would I do?
• Generalisation
– I’ve done this before
– They do the same
• Bad Experience
– Lets not do that
again
• Background
– I studied this once?
– Could I apply this?
Best Practice
Best Practice
• Prototype new ideas where possible
– Get visual and design direction
• Mock-ups
– Prove (or disprove) the concept
• Quick and dirty programming
• Play to peoples strengths
– Maths ⇒ Physics Guys
– Navigation Mesh ⇒ Collision Guys
Best Practice
• Program Defensively
– Assert and Unit Test
– Automated Scripts as soak tests
– One co-ordinate system and S.I. units
• Maximise Workflow
– Cater tools to their needs
– Put new functionality on bypass
• Think of the man-hour cost!
– Minimise potential for human error
Best Practice
• Build A Debugging Suite
– Instant Pause
– Flyable Camera
– Layered Information
– Action Histories
• Maintain Player Immersion
– A.I. should not be too bad or too good
– Limit ourselves to what the player would know
– Constrain them to the same actions
The Algorithmic Approach
• Key tenants
– Use only what
we might know
– Mimic the player
The Think-Act Loop
Sensory Receptors
Brain
Controller
Game
Player
Sensory Data
Think
Controller
Act
A.I.
Sensory Data
Think
Controller
Act
Sensory Input
Sensory Data
• Detail level
– Depends on genre and
perceived communication
• Thief vs Medieval Total War II
• General Model
– Visual component an arc
– Auditory component a radius
• Auditory targets less official
– Occlusion too expensive?
• Shoot a weapon to get info
– Theorise using ghost images
Blackboards
• Used To Share Information
– Static blackboard stores defined types of info
– Dynamic blackboard stores arbitrary data
• Agents write to the board
– Generally read it as well
Agent
A
Agen
t B
{10,20,15}
{-30,20,13}
{-10,15,12}
{17,11,5}
Scout {3, 17, 10}
Cover {17, 11,5}
cSensorCone
Think
Controller
Act
Control Output
Virtual Controller (yoke)
• Purpose
– Carries control instructions
– Provides a strict I/O Divide
• Notice the const correctness
– Unifies player and A.I.
• Control mapping for the player
• A.I. fills it in from Think()
• Key Properties
– Never stored in it’s entirety
– Created on the stack
– Lifetime of a single Process()
Process()
Think(yoke&) const
Controller
Act(const yoke&)
cVirtualYoke yoke
… So Actually
Process()
Think(yoke&) const
Act(const yoke&)
cVirtualYoke yoke
cSensorCone
cBlackboard
Virtual Yoke
• Composite
– Collection of smaller yokes
– Allows selective storage
cVirtualYoke
cLocomotionYoke mLocomotion;
cWeaponYoke mWeapons;
cAnimYoke mAnimation;
cLocomotiveYoke
fp32 mGas;
fp32 mSteering;
fp32 mPitch;
cEntity *mpDontAvoid;
• Context Based
Controller Input
• Logic Flow Control
cWeaponYoke
enum eFire
{
F_PRESSED,
F_WHEN_IN_CONE,
F_WHEN_LOCKED
};
eFire mFireButton;
• Conditional
signals
Taking Action
Process()
Think(yoke&) const
Act(const yoke&)
cVirtualYoke yoke
cSensorCone
cBlackboard
Act
• Applies Yoke Commands
– Composite yokes →
Subsystems
• Object Models
– Supply common interfaces
• Could be a turret mounted
weapon or my pistol.
• Could be driving a car, a plane,
a boat or myself!
Act()
yoke
iWeaponMgr*
iLocomotive*
Object Model
• Self Contained
– Instructions for Think
– Actions for Act
– Commutable
• Plug and Play
• Downloadable
Content
– Maybe broadcast use
• Think Sims 2!
iLocomotive
// Fills in yoke
ComputeMotion(const cTarget &,
cLocomotiveYoke&)
// Computes forces
ApplyMotion(const cTarget &,
const cLocomotiveYoke&,
v3 &force,
v3 &torque)
More Coolness
ApplyMotion(const cTarget& targ,
cLocomotiveYoke& yoke)
{
v3 force(Zero);
v3 torque(Zero);
if (Drivable())
{
Drivable()->ApplyMotion(
targ, yoke, force, torque);
}
if (Floatable())
{
Floatable()->ApplyMotion(
targ, yoke, force, torque);
}
ApplyForceTorque(force, torque);
}
Compute
Apply
Compute
Apply
Compute
Apply
Compute
Apply
Frame Time
Process()
Think(yoke&, dt) const
Act(const yoke&, dt)
cVirtualYoke yoke
cSensorCone
Update(dt)
cBlackboard
dt()
dt()
• Work into everything
– Including fixed time steps
– No more s+=v, s+=v*dt()
• Benefits
– Integration
• Implicit forward Euler
– Rough Smoothing
– Closed Feedback
– Pause dt=0
– Level Of Detail dt=2dt
– Special Effects
dt()
smoothing
feedback control
The Functional Approach
Problem Domain
• Examine the Terminology
– Feeling, Knowledge, Goals, Beliefs, Needs
• Examine the Concepts
– Decisions, Facts, Uncertainty, Exploration, Verb-Noun
Actions, Repetition, Sequencing
Needs a problem 
What Are We Doing?
• Goal based reasoning
– Working to solve a goal
– Thinking about and realising smaller tasks
– Taking a hierarchical approach
– Using a limited number of short verb-noun pairings
to form a plan
• We’ve seen this before
– An old pattern
• Colossal Cave Adventure and MUDs
• Verb-noun actions like “get axe, wield axe” separated by
movement “n, e, e, s, e”
– We use a container object model
Applying The Pattern
Know of “Mine, Smithy”
1. Goto “Mine”
Know of “Wall”
2. Get Ore From “Wall”
3. Goto “Smithy”
Know of “Door”
4. Use “Door”
5. Play “Open Door”
6. Warp Inside
Know of “Owner”, “Forge”
7. Play “Close Door”
8. Goto “Owner”
9. Put 10 gp In “Owner”
10. Get Time From “Owner”
11. Goto “Forge”
12. Put Time In “Forge”
13. Put Iron In “Forge”
14. Use “Forge”
15. Use Enchant
16. Use “Forge”
17. Get Sword From “Anvil”
Taking the computational to the algorithmic
Easy Questions
• Why did I choose to do this again?
– Because we were driven to it by personality
and need
• What happens when I get the treasure?
– I’ll probably choose to do something else
depending on my mood
• Why stop at get iron?
– Because its reached the atomic level -
there are no more questions, just results
Putting It Together
Ambient
Controller
“Get treasure”
Planning
“Get magic sword”
Explicit
Order
“Script here,
Please greet
the player”
Explicit Orders
• Script commands
– Script on A.I.
• Autopilot
– Player on Player
• Player instructions
– Player on A.I.
• Squad Commander
– A.I. on A.I.
Ambient
Controller
“Get treasure”
Planning
“Get magic sword”
Explicit
Order
“Script here,
Please greet
the player”
Scripting Notes
• Don’t mix styles
– Script has immediate control
– Script waits for an opportunity
• Keep common properties separate
– No sharing memory locations
• A script global population density
• A code global population density
– Maintain a set order of calculation
• Generally consistent with style
Ambient Controller
• Generates sensible
actions autonomously
– Maybe Idle
– Maybe Full Daily Routine
• Daily Routines
– Character properties
– Needs/Drives
– Scheduling
– Time of day
⇒ nice emergent behaviour
Ambient
Controller
“Get treasure”
Planning
“Get magic sword”
Explicit
Order
“Script here,
Please greet
the player”
Daily Routine
Sleep
Goto Work
Work
Leave Work
Relax
Go Home
Drive Model
Time Of Day
Schedule
Housework 5%
Tavern 50%
Brothel 30%
Shopping 10%
Study 5%
Character
Hunger Libido
dt()
Planning
Ambient
Controller
“Get treasure”
Planning
“Get magic sword”
Explicit
Order
“Script here,
Please greet
the player”
Goto Position
“Goto Forge”
Perform Action
“Use Forge”
Planning
Continuous bar dt()
⇒Defines Think()
Plan Components
• Play “Animation”
– Waits on dt()
• Use “Object”
– Object model again
– Broadcast actions.
– Change world based on
state
– May wait on dt()
• Get/Take “Object” From
“Container”
– Primary world manipulation
– Contents determine state
• Goto “Location”
– Waits on dt()
– Key A.I. output
– Complex
– Warrants special attention
later
Search Based Planning
• Traditional academic approach
– See STRIPS, Hierarchical Task Networks, Bratko
• The Good
– Mimics our introspective reasoning
– Seeks to fully realise a plan to the goal
• Directed search for optimal solutions
• Post processing even more so
• The Bad
– Knowledge representation
• Scalability - difficult for video games
• Lots of storage
Procedural Planning
• Industry preferred approach
• Hierarchical
• Easy to comprehend
• Limited Language
– Goals
– Sub-goals
– Conditions
– Actions
• Transitions
– Sequential
– Decision Based
• Powerful Results
Get Object
Short of
money?
Make
Thief
skills?
Steal
Buy
Get OreGoto Mine
Procedural Planning - Issues
• Competing children
– We have to make a best guess from the
options
– A* might help
• But we could still end up with case of a basic
sword being bought but not affording the forge.
• Incomplete plan means no post process
– Not good for player supporting A.I.
– More action for generic A.I.
The Curve Ball
• Task Interruption
– I’m returning to my gang hideout
– I see an enemy
• I engage the enemy
–I roll out of the way of a car
–I recover to my feet
• I re-engage the enemy
– I continue to return to my gang hideout
• … Is A Key Requirement of our A.I.
Finite State Machines
• No plan history
⇒No idea of context
⇒No generalised exit.
⇒Hideous state history
workarounds
• Don’t scale well
– Many transitions
Death
Look At
Gain Range
Attack
Kill Examine
Death
Look At
Gain Range
Attack
Kill Examine
• HFSM came along
– Eased transitions
– But history still an issue
Behaviour Trees
Goto Source
Get Material
Take Material
Create
Buy
Steal
Get Object
Crime
Allowed?
Low
money?
Ok
money?
Thief
Class?
Sequencing
Selection
Preconditions
Actions
Decorators
Modelling Interruption?
Goto
Location
Kill
Enemy
Return
Home
Locate
Hideout
Gain
Range
Fire
Weapon
Ambient
Behaviour
Parallel?
Behaviour Trees
• Simple and powerful
– Limited vocabulary
– Most situations handled
• Highly flexible
– Plug and play
– Customisable
– Nice design tools
– Handy child evaluation
• Lends itself to directed
decision making
• Issues
– Interruption handling
• Where to return
– Amount of flexibility
• Trees get complicated
MARPO
Goto Source
Get Material
Take Material
Create Buy Steal
Get Object
Not enough money? Money?
Thief class?
Thieving allowed?
ReactiveLong term
MARPO
Get Object
Create
Get Material
Take Material
Immediate
ReactiveLong term
MARPO
Get Object
Take Material
Kill Enemy
Gain Distance
Immediate
Get Material
Create
ReactiveLong term
MARPO
Get Object Kill Enemy
Immediate
Roll
Gain Distance
• Behavioural Bamboo Forest
– Stack based tasks
• Suppression model
– Multiple threads of execution
• Keeps only one stack in memory down to current task
– Decision logic lies with the parent
• Higher level parameterised building blocks
– Authoring is by script not tool.
• Winding Ability
– Allows auto-recovery from any state
– Respects script orders on an immediate basis
MARPO
Movement
Goto Position
• What Is Position?
– A world co-ordinate
– An entity
– A navigation point
– An offset off an entity
– A radius off an offset,
off an entity
• Still World Positions!
– So generalise
cTarget
void Set(…);
void SetArrivalConditions(…);
v3 WorldPos() const;
v3 InterceptPos(…) const;
bool HasArrived(…) const;
• Lots for free
– Entity intercept
– Completion checks
The Problem
• Dynamic obstacles
• … on the move
• Terrain type
• Usable surfaces
• Static geometry
Stage 1 - Navigation
• Navigation Mesh
– Industry standard [Tozour, 2008]
– Handles static geometry
• Searching with A*
– Optimise search space, not A*
• Improve Data Format
– Make it Hierarchical
– Allow for reference spaces [Isla, 2005]
Navigation
• Quick To Search
⇒ Live Updates
• Zones
⇒ Spatial Reasoning [Isla, 2005]
cNavPos
Components
cNavId
mPolyId;
mPolySource;
cNavPoly
… indices
… edge info
cNavId mParent
cNavId mFirstChild
mChildCount
cPolyCoords
… local co-ords
cNavigator
Pos()
FinalTarget()
CurrentTarget()
HasArrived()
Update( cTarget )
cNavPos mFinal
cNavPos mCurrent
cNavPos mPos
Stage 2 - Optimisation
• String Pulling
– Bevel uncrossable
edges to a radius
– Tighten points
Stage 3 - Dynamic Avoidance
• At rest
– Mesh binding
• On move
– Intercept calculation
Stage 4 - Locomotion
• Differing approach
– Vehicle
– Humanoid
• Can we generalise?
Locomotion
iLocomotion
ComputeMotion(…)
ApplyMotion(…)
• Generalised by iLocomotion
• Same interface
• Different yoke instructions
• Vehicles
– Vehicles supply gas, steering
– Difficulty is in mapping target to gas and steering
• Actors
– Actors supply ideal position, velocity, direction
– Difficulty is in animation to hit position.
Locomotion - Vehicles
Target
Position
Top SpeedSpeed For
Deceleration
Speed For
Steering
Min
Speed to Gas
Maths
PID Controller
Yoke
Yoke
Angle To Steering
Maths
PID Controller
Some Hints 
a
d
vmax
u
v
s1 s2
Speed For
Deceleration
• Equations of Motion
Speed to Gas
Angle To Steering
• PID • Response Curves
Manual Shift
Animation
Locomotion - Character
• Animation ⇒ Position
• Challenges
– Sensible manoeuvre
choice
• Animation Graphs
• Navigation Mark Up
– Natural fluidity
• Foot positioning
• Hand positioning
Idle
Walk
Run
Crouch
Crouch Walk
Crouch Run
Goal Based
• Directed Search of Animation Graph
– Incorporates interesting A.I. along the way
– Think Gears of War, A*
• Interested ⇒ Champandard
• Personal Issues
– Need to find a full animation plan to goal
• This would need to sit with path finding
• Makes it more expensive
– Painful Heuristic Balancing
• Switching to the time domain probably partially solves it
• But how do we prevent repeated actions
“Carrot On A Stick” Method
• Keep iLocomotion interface
• ComputeMotion() computes
velocity
• ApplyMotion() animates for
velocity
• dt() helps minimise error
• Want to use a cover point?
– Explicit decision
⇒a new target
iLocomotion
ComputeMotion(…)
ApplyMotion(…)
• Given the animation
properties
• We can solve by
mathematics
Cover
Under fire?
Find cover?
Route to
cover
Kill
Nav.mesh
Goto
Set piece
“Carrot On A Stick” Method
Anchor Point
“Carrot On A Stick” Method
s
θ
Direction for
Animation
off=ƒ(θ,s)
• Offset based on θ, s
• Changes our target
– Hierarchical changes
• Changing over dt
• Smoothes our arrival
– Think high jump!
– Never perfect
– But mistakes made
are human
– Constrained by
navigation mesh
“Carrot On A Stick” Method
s
u
V = 0?
• Equations of Motion
– They’re back!
• Give us our aim
velocity vaim
• What about a and d?
vmax
a
d
u
v
s
vaim
dt
• Animations
– distance (s) in time (t)
⇒ an average velocity
– Assume velocity bands
– Look up vfor animation
– Dead zones indirectly
determine blending
• a and d now character
properties
• Actively correct for v
– Use tricks like light I.K.
• Implicitly correct by dt()
v
t
Crouch run
Crouch walk
v
Crouch walk
Crouch run
“Carrot On A Stick” Method
“Carrot On A Stick” Method
• Animation graph
– Used for information query only
• Locomotive cycle driven by vaim
• Free things!
– Foot positioning
• Obtained through cycle alteration and dt()
– Blending
– Character movement properties
• Obtained through a and d
– Swim, crawl, crouch, walk
• Same procedure, different velocity bands
– Human like arrival mistakes
Conclusion
Conclusion
– Best Practices
– Strict interfaces
– Multiple takes on
problems
– Concepts
– Commutability
– Components
– Algorithms
– Hierarchy
– Pattern Recognition
– Human Sciences
Good reusable AI is about
Conclusion
• Style vs Structure - Hecker 2008
– “Texture Mapped A.I. Triangle”
– Style
• No idea where it is – annoyingly
– Structure
• Not one single triangle
• But many triangle like pieces
• Represented differently
• But all essentially the same piece
References
• Key References
– Laming, B. [04] “The Art of Surviving A Simulation Title”, A.I. Wisdom 2, Charles River Media
– Laming, B. [08] “The MARPO Methodology: Planning And Orders”, A.I. Wisdom 4, Charles River Media
– Isla, D. [05], “Dude, where’s my Warthog?”, www.aiide.org/aiide2005/talks/isla.ppt, 13.3.08
– Tozour, P. [08] “Fixing Pathfinding Once and For All”, http://www.ai-blog.net/archives/000152.html, 13.3.08
– Champandard, A., http://aigamedev.com, 13.3.08
– A.I. Wisdom Books in general
• Introduction
– Reynolds, C. [87] “Boids”, http://www.red3d.com/cwr/boids/, 13.3.08
• Intercept Calculation and Dynamic Avoidance
– Stein, N. [02] “Intercepting a Ball”, A.I. Wisdom 1, Charles River Media. [HINT ]
– Tozour, P. [02] “Building a Near-Optimal Navigation Mesh”, A.I. Wisdom 1, Charles River Media
• Best Practice
– Tozour, P. [02] “Building an AI Diagnostic Toolkit”, A.I. Wisdom 1, Charles River Media
• Sensory and Blackboards
– Isla, D. and Blumberg, B. [02] “Blackboard Architectures”, A.I. Wisdom 1, Charles River Media
• Planning
– Champandard, A [08], “Getting Started With Decision Making and Control Systems”, A.I. Wisdom 4, Charles River Media
– Champandard, A., “Understanding Behaviour Trees”, http://aigamedev.com/hierarchical-logic/bt-overview, 13.3.08
– Yiskis, E. [04] “A Subsumption Architecture for Character-Based Games”, A.I.Wisdom 2, Charles River Media
• Navigation
– Numerous references, almost all A.I. Wisdom books.
• Locomotion – Vehicle
– Alexander, B. [02] “The Beauty of Response Curves”, A.I. Wisdom 1, Charles River Media
– Forrester, E. [04] “Intelligent Steering Using PID Controllers”, A.I. Wisdom 2, Charles River Media
• Conclusion
– Hecker, C. [09] “Structure vs Style”, http://chrishecker.com/Structure_vs_Style, 13.3.08

More Related Content

Viewers also liked

DOCSIS 3.0 SCTE Piedmont Chapter January 18th
DOCSIS 3.0 SCTE Piedmont Chapter January 18thDOCSIS 3.0 SCTE Piedmont Chapter January 18th
DOCSIS 3.0 SCTE Piedmont Chapter January 18thThe Volpe Firm, Inc.
 
DOCSIS 3.0 Troubleshooting, SCTE Blacksburg, VA
DOCSIS 3.0 Troubleshooting, SCTE Blacksburg, VADOCSIS 3.0 Troubleshooting, SCTE Blacksburg, VA
DOCSIS 3.0 Troubleshooting, SCTE Blacksburg, VAThe Volpe Firm, Inc.
 
دور وزارة التنمية الادارية المحدثة
دور وزارة التنمية الادارية المحدثةدور وزارة التنمية الادارية المحدثة
دور وزارة التنمية الادارية المحدثةتيشوري عبد الرحمن
 
Един Велик ден
Един Велик денЕдин Велик ден
Един Велик денsharenkova
 
Circuit turistic de 3 zile in Transilvania
Circuit turistic de 3 zile in TransilvaniaCircuit turistic de 3 zile in Transilvania
Circuit turistic de 3 zile in TransilvaniaAlexandru Marian Avanu
 
歴史資産活用に係るオープンデータの重要性とその活用方法としてのウィキ町史プロジェクト
歴史資産活用に係るオープンデータの重要性とその活用方法としてのウィキ町史プロジェクト歴史資産活用に係るオープンデータの重要性とその活用方法としてのウィキ町史プロジェクト
歴史資産活用に係るオープンデータの重要性とその活用方法としてのウィキ町史プロジェクトTakuya Yamagata
 
4 Monumental Benefits of Pinterest for Business
4 Monumental Benefits of Pinterest for Business4 Monumental Benefits of Pinterest for Business
4 Monumental Benefits of Pinterest for BusinessLab3 Marketing
 
JV writing sample - Burma
JV writing sample - BurmaJV writing sample - Burma
JV writing sample - BurmaJohn Vicars
 

Viewers also liked (10)

DOCSIS 3.0 SCTE Piedmont Chapter January 18th
DOCSIS 3.0 SCTE Piedmont Chapter January 18thDOCSIS 3.0 SCTE Piedmont Chapter January 18th
DOCSIS 3.0 SCTE Piedmont Chapter January 18th
 
DOCSIS 3.0 Troubleshooting, SCTE Blacksburg, VA
DOCSIS 3.0 Troubleshooting, SCTE Blacksburg, VADOCSIS 3.0 Troubleshooting, SCTE Blacksburg, VA
DOCSIS 3.0 Troubleshooting, SCTE Blacksburg, VA
 
دور وزارة التنمية الادارية المحدثة
دور وزارة التنمية الادارية المحدثةدور وزارة التنمية الادارية المحدثة
دور وزارة التنمية الادارية المحدثة
 
thaivinh
thaivinhthaivinh
thaivinh
 
Един Велик ден
Един Велик денЕдин Велик ден
Един Велик ден
 
Circuit turistic de 3 zile in Transilvania
Circuit turistic de 3 zile in TransilvaniaCircuit turistic de 3 zile in Transilvania
Circuit turistic de 3 zile in Transilvania
 
歴史資産活用に係るオープンデータの重要性とその活用方法としてのウィキ町史プロジェクト
歴史資産活用に係るオープンデータの重要性とその活用方法としてのウィキ町史プロジェクト歴史資産活用に係るオープンデータの重要性とその活用方法としてのウィキ町史プロジェクト
歴史資産活用に係るオープンデータの重要性とその活用方法としてのウィキ町史プロジェクト
 
4 Monumental Benefits of Pinterest for Business
4 Monumental Benefits of Pinterest for Business4 Monumental Benefits of Pinterest for Business
4 Monumental Benefits of Pinterest for Business
 
Programma Uniti Per Rinnovare
Programma Uniti Per RinnovareProgramma Uniti Per Rinnovare
Programma Uniti Per Rinnovare
 
JV writing sample - Burma
JV writing sample - BurmaJV writing sample - Burma
JV writing sample - Burma
 

Similar to Ai architectureand designpatternsgdc2009

Getting started in mobile games
Getting started in mobile gamesGetting started in mobile games
Getting started in mobile gamesahamidi27
 
LearningKit.ppt
LearningKit.pptLearningKit.ppt
LearningKit.pptbutest
 
BiowareDesignDoc.ppt
BiowareDesignDoc.pptBiowareDesignDoc.ppt
BiowareDesignDoc.pptHonggangMan
 
Five Cliches of Online Game Development
Five Cliches of Online Game DevelopmentFive Cliches of Online Game Development
Five Cliches of Online Game Developmentiandundore
 
The Settler 7- 포스트모템
The Settler 7- 포스트모템The Settler 7- 포스트모템
The Settler 7- 포스트모템drandom
 
Super Gun Kids: The Making Of by Iain Lobb
Super Gun Kids: The Making Of by Iain LobbSuper Gun Kids: The Making Of by Iain Lobb
Super Gun Kids: The Making Of by Iain Lobbmochimedia
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法Unite2017Tokyo
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法Unity Technologies Japan K.K.
 
Artificial Inteligence for Games an Overview SBGAMES 2012
Artificial Inteligence for Games an Overview SBGAMES 2012Artificial Inteligence for Games an Overview SBGAMES 2012
Artificial Inteligence for Games an Overview SBGAMES 2012Bruno Duarte Corrêa
 
Hands-on Performance Workshop - The science of performance
Hands-on Performance Workshop - The science of performanceHands-on Performance Workshop - The science of performance
Hands-on Performance Workshop - The science of performanceC2B2 Consulting
 
Hands on Performance Tuning - Mike Croft
Hands on Performance Tuning - Mike CroftHands on Performance Tuning - Mike Croft
Hands on Performance Tuning - Mike CroftJAXLondon2014
 
The Final Frontier
The Final FrontierThe Final Frontier
The Final FrontierjClarity
 
LST Toolkit: Exfiltration Over Sound, Light, Touch
LST Toolkit: Exfiltration Over Sound, Light, TouchLST Toolkit: Exfiltration Over Sound, Light, Touch
LST Toolkit: Exfiltration Over Sound, Light, TouchDimitry Snezhkov
 
The Design of Everyday Things
The Design of Everyday ThingsThe Design of Everyday Things
The Design of Everyday Thingslifanxi
 
Going off the rails
Going off the railsGoing off the rails
Going off the railsNing Hu
 
Bugs Aren't Random
Bugs Aren't RandomBugs Aren't Random
Bugs Aren't RandomDan Kaminsky
 
Lecture 8 - What is Game AI? Final Thoughts
Lecture 8 - What is Game AI? Final ThoughtsLecture 8 - What is Game AI? Final Thoughts
Lecture 8 - What is Game AI? Final ThoughtsLuke Dicken
 
Shut Up And Eat Your Veg
Shut Up And Eat Your VegShut Up And Eat Your Veg
Shut Up And Eat Your VegGarth Gilmour
 
Introduction to Steering behaviours for Autonomous Agents
Introduction to Steering behaviours for Autonomous AgentsIntroduction to Steering behaviours for Autonomous Agents
Introduction to Steering behaviours for Autonomous AgentsBryan Duggan
 

Similar to Ai architectureand designpatternsgdc2009 (20)

Getting started in mobile games
Getting started in mobile gamesGetting started in mobile games
Getting started in mobile games
 
LearningKit.ppt
LearningKit.pptLearningKit.ppt
LearningKit.ppt
 
BiowareDesignDoc.ppt
BiowareDesignDoc.pptBiowareDesignDoc.ppt
BiowareDesignDoc.ppt
 
Five Cliches of Online Game Development
Five Cliches of Online Game DevelopmentFive Cliches of Online Game Development
Five Cliches of Online Game Development
 
The Settler 7- 포스트모템
The Settler 7- 포스트모템The Settler 7- 포스트모템
The Settler 7- 포스트모템
 
Super Gun Kids: The Making Of by Iain Lobb
Super Gun Kids: The Making Of by Iain LobbSuper Gun Kids: The Making Of by Iain Lobb
Super Gun Kids: The Making Of by Iain Lobb
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
 
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
【Unite 2017 Tokyo】インスタンシングを用いた美麗なグラフィックの実現方法
 
Artificial Inteligence for Games an Overview SBGAMES 2012
Artificial Inteligence for Games an Overview SBGAMES 2012Artificial Inteligence for Games an Overview SBGAMES 2012
Artificial Inteligence for Games an Overview SBGAMES 2012
 
Hands-on Performance Workshop - The science of performance
Hands-on Performance Workshop - The science of performanceHands-on Performance Workshop - The science of performance
Hands-on Performance Workshop - The science of performance
 
Hands on Performance Tuning - Mike Croft
Hands on Performance Tuning - Mike CroftHands on Performance Tuning - Mike Croft
Hands on Performance Tuning - Mike Croft
 
The Final Frontier
The Final FrontierThe Final Frontier
The Final Frontier
 
LST Toolkit: Exfiltration Over Sound, Light, Touch
LST Toolkit: Exfiltration Over Sound, Light, TouchLST Toolkit: Exfiltration Over Sound, Light, Touch
LST Toolkit: Exfiltration Over Sound, Light, Touch
 
The Design of Everyday Things
The Design of Everyday ThingsThe Design of Everyday Things
The Design of Everyday Things
 
God Of War : post mortem
God Of War : post mortemGod Of War : post mortem
God Of War : post mortem
 
Going off the rails
Going off the railsGoing off the rails
Going off the rails
 
Bugs Aren't Random
Bugs Aren't RandomBugs Aren't Random
Bugs Aren't Random
 
Lecture 8 - What is Game AI? Final Thoughts
Lecture 8 - What is Game AI? Final ThoughtsLecture 8 - What is Game AI? Final Thoughts
Lecture 8 - What is Game AI? Final Thoughts
 
Shut Up And Eat Your Veg
Shut Up And Eat Your VegShut Up And Eat Your Veg
Shut Up And Eat Your Veg
 
Introduction to Steering behaviours for Autonomous Agents
Introduction to Steering behaviours for Autonomous AgentsIntroduction to Steering behaviours for Autonomous Agents
Introduction to Steering behaviours for Autonomous Agents
 

Ai architectureand designpatternsgdc2009

  • 1. From the Ground Up: A.I. Architecture and Design Patterns Dr Brett Laming Rockstar Leeds
  • 2. Contents • Basic Principles • Think/Act - The I/O Divide • An Algorithmic Approach • A Functional Approach • Movement • Animation • Conclusion
  • 4. Why Do We Care? • It’s a Competitive Market… – Higher Expectations – Tighter Schedules – Multiple Platforms – Simultaneous Titles • …But Patterns Are Everywhere – Identify, generalise, reuse, evolve > Reliability > Production Speed ⇒ More Fun Stuff
  • 5. Inspirations Marvin Minsky Different representations for different views Noam Chomsky Hierarchical decomposition Structure vs Meaning “Colorless green ideas sleep furiously” Daniel Dennet Behaviour can be viewed at the physical, design and intentional levels David Marr Computational, algorithmic and implementational Chris Hecker Style vs Structure [2008] What is the textured triangle of A.I. Craig Reynolds Simple rules Complex behaviour Damian Isla Cognitive Maps Spatial Relations Semantics
  • 6. What Am I Looking For? Best Practice Hierarchy Reusability Commutability Concepts Components
  • 7. How Do I Find Them? • Observation – How might it work? • Introspection – What would I do? • Generalisation – I’ve done this before – They do the same • Bad Experience – Lets not do that again • Background – I studied this once? – Could I apply this?
  • 9. Best Practice • Prototype new ideas where possible – Get visual and design direction • Mock-ups – Prove (or disprove) the concept • Quick and dirty programming • Play to peoples strengths – Maths ⇒ Physics Guys – Navigation Mesh ⇒ Collision Guys
  • 10. Best Practice • Program Defensively – Assert and Unit Test – Automated Scripts as soak tests – One co-ordinate system and S.I. units • Maximise Workflow – Cater tools to their needs – Put new functionality on bypass • Think of the man-hour cost! – Minimise potential for human error
  • 11. Best Practice • Build A Debugging Suite – Instant Pause – Flyable Camera – Layered Information – Action Histories • Maintain Player Immersion – A.I. should not be too bad or too good – Limit ourselves to what the player would know – Constrain them to the same actions
  • 13. • Key tenants – Use only what we might know – Mimic the player The Think-Act Loop Sensory Receptors Brain Controller Game Player Sensory Data Think Controller Act A.I.
  • 15. Sensory Data • Detail level – Depends on genre and perceived communication • Thief vs Medieval Total War II • General Model – Visual component an arc – Auditory component a radius • Auditory targets less official – Occlusion too expensive? • Shoot a weapon to get info – Theorise using ghost images
  • 16. Blackboards • Used To Share Information – Static blackboard stores defined types of info – Dynamic blackboard stores arbitrary data • Agents write to the board – Generally read it as well Agent A Agen t B {10,20,15} {-30,20,13} {-10,15,12} {17,11,5} Scout {3, 17, 10} Cover {17, 11,5}
  • 18. Virtual Controller (yoke) • Purpose – Carries control instructions – Provides a strict I/O Divide • Notice the const correctness – Unifies player and A.I. • Control mapping for the player • A.I. fills it in from Think() • Key Properties – Never stored in it’s entirety – Created on the stack – Lifetime of a single Process() Process() Think(yoke&) const Controller Act(const yoke&) cVirtualYoke yoke
  • 19. … So Actually Process() Think(yoke&) const Act(const yoke&) cVirtualYoke yoke cSensorCone cBlackboard
  • 20. Virtual Yoke • Composite – Collection of smaller yokes – Allows selective storage cVirtualYoke cLocomotionYoke mLocomotion; cWeaponYoke mWeapons; cAnimYoke mAnimation; cLocomotiveYoke fp32 mGas; fp32 mSteering; fp32 mPitch; cEntity *mpDontAvoid; • Context Based Controller Input • Logic Flow Control cWeaponYoke enum eFire { F_PRESSED, F_WHEN_IN_CONE, F_WHEN_LOCKED }; eFire mFireButton; • Conditional signals
  • 21. Taking Action Process() Think(yoke&) const Act(const yoke&) cVirtualYoke yoke cSensorCone cBlackboard
  • 22. Act • Applies Yoke Commands – Composite yokes → Subsystems • Object Models – Supply common interfaces • Could be a turret mounted weapon or my pistol. • Could be driving a car, a plane, a boat or myself! Act() yoke iWeaponMgr* iLocomotive*
  • 23. Object Model • Self Contained – Instructions for Think – Actions for Act – Commutable • Plug and Play • Downloadable Content – Maybe broadcast use • Think Sims 2! iLocomotive // Fills in yoke ComputeMotion(const cTarget &, cLocomotiveYoke&) // Computes forces ApplyMotion(const cTarget &, const cLocomotiveYoke&, v3 &force, v3 &torque)
  • 24. More Coolness ApplyMotion(const cTarget& targ, cLocomotiveYoke& yoke) { v3 force(Zero); v3 torque(Zero); if (Drivable()) { Drivable()->ApplyMotion( targ, yoke, force, torque); } if (Floatable()) { Floatable()->ApplyMotion( targ, yoke, force, torque); } ApplyForceTorque(force, torque); } Compute Apply Compute Apply Compute Apply Compute Apply
  • 25. Frame Time Process() Think(yoke&, dt) const Act(const yoke&, dt) cVirtualYoke yoke cSensorCone Update(dt) cBlackboard dt()
  • 26. dt() • Work into everything – Including fixed time steps – No more s+=v, s+=v*dt() • Benefits – Integration • Implicit forward Euler – Rough Smoothing – Closed Feedback – Pause dt=0 – Level Of Detail dt=2dt – Special Effects dt() smoothing feedback control
  • 28. Problem Domain • Examine the Terminology – Feeling, Knowledge, Goals, Beliefs, Needs • Examine the Concepts – Decisions, Facts, Uncertainty, Exploration, Verb-Noun Actions, Repetition, Sequencing Needs a problem 
  • 29. What Are We Doing? • Goal based reasoning – Working to solve a goal – Thinking about and realising smaller tasks – Taking a hierarchical approach – Using a limited number of short verb-noun pairings to form a plan • We’ve seen this before – An old pattern • Colossal Cave Adventure and MUDs • Verb-noun actions like “get axe, wield axe” separated by movement “n, e, e, s, e” – We use a container object model
  • 30. Applying The Pattern Know of “Mine, Smithy” 1. Goto “Mine” Know of “Wall” 2. Get Ore From “Wall” 3. Goto “Smithy” Know of “Door” 4. Use “Door” 5. Play “Open Door” 6. Warp Inside Know of “Owner”, “Forge” 7. Play “Close Door” 8. Goto “Owner” 9. Put 10 gp In “Owner” 10. Get Time From “Owner” 11. Goto “Forge” 12. Put Time In “Forge” 13. Put Iron In “Forge” 14. Use “Forge” 15. Use Enchant 16. Use “Forge” 17. Get Sword From “Anvil” Taking the computational to the algorithmic
  • 31. Easy Questions • Why did I choose to do this again? – Because we were driven to it by personality and need • What happens when I get the treasure? – I’ll probably choose to do something else depending on my mood • Why stop at get iron? – Because its reached the atomic level - there are no more questions, just results
  • 32. Putting It Together Ambient Controller “Get treasure” Planning “Get magic sword” Explicit Order “Script here, Please greet the player”
  • 33. Explicit Orders • Script commands – Script on A.I. • Autopilot – Player on Player • Player instructions – Player on A.I. • Squad Commander – A.I. on A.I. Ambient Controller “Get treasure” Planning “Get magic sword” Explicit Order “Script here, Please greet the player”
  • 34. Scripting Notes • Don’t mix styles – Script has immediate control – Script waits for an opportunity • Keep common properties separate – No sharing memory locations • A script global population density • A code global population density – Maintain a set order of calculation • Generally consistent with style
  • 35. Ambient Controller • Generates sensible actions autonomously – Maybe Idle – Maybe Full Daily Routine • Daily Routines – Character properties – Needs/Drives – Scheduling – Time of day ⇒ nice emergent behaviour Ambient Controller “Get treasure” Planning “Get magic sword” Explicit Order “Script here, Please greet the player”
  • 36. Daily Routine Sleep Goto Work Work Leave Work Relax Go Home Drive Model Time Of Day Schedule Housework 5% Tavern 50% Brothel 30% Shopping 10% Study 5% Character Hunger Libido dt()
  • 37. Planning Ambient Controller “Get treasure” Planning “Get magic sword” Explicit Order “Script here, Please greet the player” Goto Position “Goto Forge” Perform Action “Use Forge” Planning Continuous bar dt() ⇒Defines Think()
  • 38. Plan Components • Play “Animation” – Waits on dt() • Use “Object” – Object model again – Broadcast actions. – Change world based on state – May wait on dt() • Get/Take “Object” From “Container” – Primary world manipulation – Contents determine state • Goto “Location” – Waits on dt() – Key A.I. output – Complex – Warrants special attention later
  • 39. Search Based Planning • Traditional academic approach – See STRIPS, Hierarchical Task Networks, Bratko • The Good – Mimics our introspective reasoning – Seeks to fully realise a plan to the goal • Directed search for optimal solutions • Post processing even more so • The Bad – Knowledge representation • Scalability - difficult for video games • Lots of storage
  • 40. Procedural Planning • Industry preferred approach • Hierarchical • Easy to comprehend • Limited Language – Goals – Sub-goals – Conditions – Actions • Transitions – Sequential – Decision Based • Powerful Results Get Object Short of money? Make Thief skills? Steal Buy Get OreGoto Mine
  • 41. Procedural Planning - Issues • Competing children – We have to make a best guess from the options – A* might help • But we could still end up with case of a basic sword being bought but not affording the forge. • Incomplete plan means no post process – Not good for player supporting A.I. – More action for generic A.I.
  • 42. The Curve Ball • Task Interruption – I’m returning to my gang hideout – I see an enemy • I engage the enemy –I roll out of the way of a car –I recover to my feet • I re-engage the enemy – I continue to return to my gang hideout • … Is A Key Requirement of our A.I.
  • 43. Finite State Machines • No plan history ⇒No idea of context ⇒No generalised exit. ⇒Hideous state history workarounds • Don’t scale well – Many transitions Death Look At Gain Range Attack Kill Examine Death Look At Gain Range Attack Kill Examine • HFSM came along – Eased transitions – But history still an issue
  • 44. Behaviour Trees Goto Source Get Material Take Material Create Buy Steal Get Object Crime Allowed? Low money? Ok money? Thief Class? Sequencing Selection Preconditions Actions Decorators
  • 46. Behaviour Trees • Simple and powerful – Limited vocabulary – Most situations handled • Highly flexible – Plug and play – Customisable – Nice design tools – Handy child evaluation • Lends itself to directed decision making • Issues – Interruption handling • Where to return – Amount of flexibility • Trees get complicated
  • 47. MARPO Goto Source Get Material Take Material Create Buy Steal Get Object Not enough money? Money? Thief class? Thieving allowed?
  • 48. ReactiveLong term MARPO Get Object Create Get Material Take Material Immediate
  • 49. ReactiveLong term MARPO Get Object Take Material Kill Enemy Gain Distance Immediate Get Material Create
  • 50. ReactiveLong term MARPO Get Object Kill Enemy Immediate Roll Gain Distance
  • 51. • Behavioural Bamboo Forest – Stack based tasks • Suppression model – Multiple threads of execution • Keeps only one stack in memory down to current task – Decision logic lies with the parent • Higher level parameterised building blocks – Authoring is by script not tool. • Winding Ability – Allows auto-recovery from any state – Respects script orders on an immediate basis MARPO
  • 53. Goto Position • What Is Position? – A world co-ordinate – An entity – A navigation point – An offset off an entity – A radius off an offset, off an entity • Still World Positions! – So generalise cTarget void Set(…); void SetArrivalConditions(…); v3 WorldPos() const; v3 InterceptPos(…) const; bool HasArrived(…) const; • Lots for free – Entity intercept – Completion checks
  • 54. The Problem • Dynamic obstacles • … on the move • Terrain type • Usable surfaces • Static geometry
  • 55. Stage 1 - Navigation • Navigation Mesh – Industry standard [Tozour, 2008] – Handles static geometry • Searching with A* – Optimise search space, not A* • Improve Data Format – Make it Hierarchical – Allow for reference spaces [Isla, 2005]
  • 56. Navigation • Quick To Search ⇒ Live Updates • Zones ⇒ Spatial Reasoning [Isla, 2005]
  • 57. cNavPos Components cNavId mPolyId; mPolySource; cNavPoly … indices … edge info cNavId mParent cNavId mFirstChild mChildCount cPolyCoords … local co-ords cNavigator Pos() FinalTarget() CurrentTarget() HasArrived() Update( cTarget ) cNavPos mFinal cNavPos mCurrent cNavPos mPos
  • 58. Stage 2 - Optimisation • String Pulling – Bevel uncrossable edges to a radius – Tighten points
  • 59. Stage 3 - Dynamic Avoidance • At rest – Mesh binding • On move – Intercept calculation
  • 60. Stage 4 - Locomotion • Differing approach – Vehicle – Humanoid • Can we generalise?
  • 61. Locomotion iLocomotion ComputeMotion(…) ApplyMotion(…) • Generalised by iLocomotion • Same interface • Different yoke instructions • Vehicles – Vehicles supply gas, steering – Difficulty is in mapping target to gas and steering • Actors – Actors supply ideal position, velocity, direction – Difficulty is in animation to hit position.
  • 62. Locomotion - Vehicles Target Position Top SpeedSpeed For Deceleration Speed For Steering Min Speed to Gas Maths PID Controller Yoke Yoke Angle To Steering Maths PID Controller
  • 63. Some Hints  a d vmax u v s1 s2 Speed For Deceleration • Equations of Motion Speed to Gas Angle To Steering • PID • Response Curves Manual Shift
  • 65. Locomotion - Character • Animation ⇒ Position • Challenges – Sensible manoeuvre choice • Animation Graphs • Navigation Mark Up – Natural fluidity • Foot positioning • Hand positioning Idle Walk Run Crouch Crouch Walk Crouch Run
  • 66. Goal Based • Directed Search of Animation Graph – Incorporates interesting A.I. along the way – Think Gears of War, A* • Interested ⇒ Champandard • Personal Issues – Need to find a full animation plan to goal • This would need to sit with path finding • Makes it more expensive – Painful Heuristic Balancing • Switching to the time domain probably partially solves it • But how do we prevent repeated actions
  • 67. “Carrot On A Stick” Method • Keep iLocomotion interface • ComputeMotion() computes velocity • ApplyMotion() animates for velocity • dt() helps minimise error • Want to use a cover point? – Explicit decision ⇒a new target iLocomotion ComputeMotion(…) ApplyMotion(…) • Given the animation properties • We can solve by mathematics
  • 68. Cover Under fire? Find cover? Route to cover Kill Nav.mesh Goto Set piece “Carrot On A Stick” Method Anchor Point
  • 69. “Carrot On A Stick” Method s θ Direction for Animation off=ƒ(θ,s) • Offset based on θ, s • Changes our target – Hierarchical changes • Changing over dt • Smoothes our arrival – Think high jump! – Never perfect – But mistakes made are human – Constrained by navigation mesh
  • 70. “Carrot On A Stick” Method s u V = 0? • Equations of Motion – They’re back! • Give us our aim velocity vaim • What about a and d? vmax a d u v s vaim dt
  • 71. • Animations – distance (s) in time (t) ⇒ an average velocity – Assume velocity bands – Look up vfor animation – Dead zones indirectly determine blending • a and d now character properties • Actively correct for v – Use tricks like light I.K. • Implicitly correct by dt() v t Crouch run Crouch walk v Crouch walk Crouch run “Carrot On A Stick” Method
  • 72. “Carrot On A Stick” Method • Animation graph – Used for information query only • Locomotive cycle driven by vaim • Free things! – Foot positioning • Obtained through cycle alteration and dt() – Blending – Character movement properties • Obtained through a and d – Swim, crawl, crouch, walk • Same procedure, different velocity bands – Human like arrival mistakes
  • 74. Conclusion – Best Practices – Strict interfaces – Multiple takes on problems – Concepts – Commutability – Components – Algorithms – Hierarchy – Pattern Recognition – Human Sciences Good reusable AI is about
  • 75. Conclusion • Style vs Structure - Hecker 2008 – “Texture Mapped A.I. Triangle” – Style • No idea where it is – annoyingly – Structure • Not one single triangle • But many triangle like pieces • Represented differently • But all essentially the same piece
  • 76. References • Key References – Laming, B. [04] “The Art of Surviving A Simulation Title”, A.I. Wisdom 2, Charles River Media – Laming, B. [08] “The MARPO Methodology: Planning And Orders”, A.I. Wisdom 4, Charles River Media – Isla, D. [05], “Dude, where’s my Warthog?”, www.aiide.org/aiide2005/talks/isla.ppt, 13.3.08 – Tozour, P. [08] “Fixing Pathfinding Once and For All”, http://www.ai-blog.net/archives/000152.html, 13.3.08 – Champandard, A., http://aigamedev.com, 13.3.08 – A.I. Wisdom Books in general • Introduction – Reynolds, C. [87] “Boids”, http://www.red3d.com/cwr/boids/, 13.3.08 • Intercept Calculation and Dynamic Avoidance – Stein, N. [02] “Intercepting a Ball”, A.I. Wisdom 1, Charles River Media. [HINT ] – Tozour, P. [02] “Building a Near-Optimal Navigation Mesh”, A.I. Wisdom 1, Charles River Media • Best Practice – Tozour, P. [02] “Building an AI Diagnostic Toolkit”, A.I. Wisdom 1, Charles River Media • Sensory and Blackboards – Isla, D. and Blumberg, B. [02] “Blackboard Architectures”, A.I. Wisdom 1, Charles River Media • Planning – Champandard, A [08], “Getting Started With Decision Making and Control Systems”, A.I. Wisdom 4, Charles River Media – Champandard, A., “Understanding Behaviour Trees”, http://aigamedev.com/hierarchical-logic/bt-overview, 13.3.08 – Yiskis, E. [04] “A Subsumption Architecture for Character-Based Games”, A.I.Wisdom 2, Charles River Media • Navigation – Numerous references, almost all A.I. Wisdom books. • Locomotion – Vehicle – Alexander, B. [02] “The Beauty of Response Curves”, A.I. Wisdom 1, Charles River Media – Forrester, E. [04] “Intelligent Steering Using PID Controllers”, A.I. Wisdom 2, Charles River Media • Conclusion – Hecker, C. [09] “Structure vs Style”, http://chrishecker.com/Structure_vs_Style, 13.3.08

Editor's Notes

  1. Bias: One author talking about one system. 75 minutes to cover a multitude. Background: Came from an academic background, BSc Cognitive Science and then PhD Computational Neuroscience. Multi-disciplinary: computer science, philosophy, maths, control engineering, psychology, neuroscience. Always good to have a splattering – expanding horizons outside CS is a good thing. Worked on mainly simulation titles, spaceships (I-War 2), futuristic hover craft (Powerdrome), cars (Burnout Revenge) and then the bombshell GTA (sandbox). No FPS/RTS or RPG experience but GTA provides elements of all. Noticed patterns in the simulation genre. Only by GTA did the patterns become really genre independently obvious. This lecture is not about GTA IV. History is the old next gen to hand-helds. Tough challenge, still doable but needs generalisation and relevant level of complexity. Principles still applicable to next gen. Went from academic->junior->senior->lead. Using funky processes gave way to a more realised goal:- simplicity, robustness, the tried-and-tested.
  2. What we won’t cover Higher level specific A.I., e.g. ID3, Belief Trees, Terrain Analysis Machine learning Only cos I’ve not had cause to use them – they all have a place
  3. Reuse leads to reliability leads to faster production (less reinventing the wheel) which ultimately leads to more fun stuff – what makes our games different, higher level A.I. etc. Includes evolution of good ideas.
  4. Some inspirations for me, both old and new. The whole is more than the sum of its parts We can understand behaviour on different levels using different views There are definite divides in understanding problems Basically a pool of ideas crossing cognitive science, neuroscience, psychology, A.I., philosophy. .
  5. Algorithms A* Concept of navigation Nav poly component
  6. Observation – how do you drive your car Introspection – how would I drive my car Generalisation – look we are both using gas and a steering wheel Bad Experience – maybe we can apply gas when we turn left and brake when we turn right Background – Hold on I’m sure I studied this car thing in physics. I wonder could I apply some of the same maths
  7. Start off with some general good practice
  8. Laming, 2004 A.I. Wisdom 2. Monday’s lecture on debugging
  9. Remember chief tenants for Immersion.
  10. Yoke has default properties. We override those to send a continuous signal. Should we not do that we revert. Safe handling.
  11. Notice blackboard isn’t updated by dt. Class candidate for being threaded, maybe co-ordinating at a higher strategy level
  12. .
  13. Keep it factored in – even on fixed Dts() Applying a velocity means you get a change in distance, natural integrator.. Applying a proportion of current error means you get smoothing Dt() * 2, 1 in every 2 is the same as Dt() 1 in 1, provided stability holds… For game effects, think Bullet Time/Matrix Cycle Cam (all simulation Dt()s go to 0) or Hiro Nakamura (all Dt()s but mine head towards 0). Needed for debugging anyway
  14. Literally to appear on the CD for looking up.