• History% • Overview%/%Categorize% Game%AI%Overview% • Agent%Based%Modeling% – Sense?>%Think?>Act% • FSM%in%biological%simula3on%(separate%slides)% Introduc3on% – Hybrid%Controllers% – Simple%Perceptual%Schemas% • Discussion:%Examples% • Resources%(Homework,%read)% What%is%Ar3ficial%Intelligence% AI%in%Games% • The%term%Ar3ficial%Intelligence%(AI)%was%coined% • Game%AI%less%complicated%than%AI%taught%in% by%John%McCarthy%in%1956% machine%learning%classes%or%robo3cs% – “The%science%and%engineering%of%making%intelligent% – Self%awareness% machines.”% – World%is%more%limited% • AI%Origin,%even%than%that%(of?course)!% – Physics%is%more%limited% – Greek%Mythology:%% • Talos%of%Crete%(Giant%Bronze%Man)% – Less%constraints,%‘less%intelligent’% • Galatea%(Ivory%Statue)% • More%‘ar3ficial’%than%‘intelligent’%(Donald% – Fic3on:%%Robot%–%1921%Karel%Patek% Kehoe)% • Asimov,%Three%laws%of%robo3cs% • Hal%–%Space%Odyssey% AI%in%Game% Scripted%AI% • Enemy%units%in%the%game%are%designed%to% • Pong% follow%a%scripted%pacern.% – Predic've)Logic :%how%the%computer%moves%paddle% • Either%move%back%and%forth%in%a%given%loca3on% • Predicts%ball%loca3on%then%moves%paddle%there% or%acack%a%player% if)nearby) (percep3on)% • Pacman%% • Became%a%staple%technique%for%AI%design.% – Rule)Based %(hard%coded)%ghosts% • Always%turn%leb% • Always%turns%right% • Random% • Turn%towards%player%
More%Complex%and%Tradi3onal%AI% Game%Agents% • Behavior%Models% • Game%Agents,%Examples:% – Agent%Model%(Focus)% – Enemy% – Ally% – Neutral% • Loops%through%:%Sense?Think?Act%Cycle% Sense Think Act Sensing% Thinking% • How%the%agent%perceives%its%environment% • Decision)making ,%deciding%what%it%needs%to%do% as%a%result%of%what%it%senses%(and%possible,% – Simple%check%the%posi3on%of%the%player%en3ty% what%‘state;’%it%is%in)%Coming%UP!% – Iden3fy%covers,%paths,%area%of%conflict% • Planning)–)more)complex)thinking.) – Hearing,%sight,%smell,%touch%(pain)%…% • Sight%(limited)% – Path)planning)) – Ray%tracing% • Range:)Reac've)to)Delibera've) Ac3ng% More%Complex%Agent% • Aber%thinking%Actuate%the%Ac3on!% • Behavior%depends%on%the%state%they%are%in% • Representa3on:%Finite%State%Machine% hcps://sobware.intel.com/en?us/ar3cles/designing? ar3ficial?intelligence?for?games?part?1%
Egyp3an%Tomb%Finite%state%Machine% Finite%State%Machine% • Mummies!%%Behavior% See Enemy – Spend%all%of%eternity%w andering( in% tomb% Wander Attack Wandering – When%player%is%close,% s earch )) No Enemy – When%see%player,% c hase ) Close by Far away Low Health Make%separate%states% No Enemy • – Define%behavior%in%each%state% Flee • Wander%–%move%slowly,%randomly% Searching • Search%–%move%faster,%in%lines% • Chasing%–%direct%to%player% • Abstract%model%of%computa3on% • Define%transi3ons% Hidden Visible • Formally:% – Close%is%100%meters%(smell/sense)% – Set%of%states% – Visible%is%line%of%sight% – A%star3ng%state% Chasing % – An%input%vocabulary% – A%transi3on%func3on%that%maps%inputs%and%the%current%state%to%a% next%state% Can%Extend%FSM%easily% How%to%Implement% • Ex:%Add%magical%scarab%(amulet)% • Hard%Coded%% • When%player%gets%scarab,% Wandering Mummy%is%afraid.%%Runs.% – Switch%Statement% Behavior% • Close by Far away – Move%away%from%player% fast% Transi3on% • Searching Afraid – When%player%gets%scarab% Scarab – When%3mer%expires% Hidden Visible • Can%have%sub?states% – Same%transi3ons,%but% different%ac3ons% Chasing • i.e.,?%range%acack% versus%melee%acack% Finite?State%Machine:%% Hardcoded%FSM% void Step(int *state) { // call by reference since state can change • AD%Hoc%Code% switch(state) { case 0: // Wander • Inefficient% Wander(); if( SeeEnemy() ) { *state = 1; } break; – Check%variables%frequently% case 1: // Attack Attack(); if( LowOnHealth() ) { *state = 2; } if( NoEnemy() ) { *state = 0; } break; case 2: // Flee Flee(); if( NoEnemy() ) { *state = 0; } break; } }
Becer% Embellishments% • Object%Oriented% • Adap3ve%AI% • Transi3ons%are%events% – Memory% • Predic3on% • Path%Planning,%Tomorrow% Resources% • hcps://sobware.intel.com/en?us/ar3cles/ designing?ar3ficial?intelligence?for?games? part?1%%(there%are%4%parts,%read%the%first%3)% • hcp://www.policyalmanac.org/games/ aStarTutorial.htm%(you%will%implement%this% visualiza3on%as%project%3)% • hcp://www?cs?students.stanford.edu/~amitp/ gameprog.html%(great%resources%for%game%AI)%
Recommend
More recommend