consciens: social and organizational framework for gaming ai
TRANSCRIPT
23/12/2011
ALIVE EU FUNDED PROJECT
IA
cOncienS Sergio AlvarezIgnasi GómezJavier VázquezJoão dfasdf
23/12/2011 | 1
ALIVE EU FUNDED PROJECT
IA
Sergio Alvarez-‐Napagao(1), Ignasi Gómez-‐SebasCà (1),Javier Vázquez-‐Salceda (1)
(1){salvarez,igomez,jvazquez}@lsi.upc.edu
Universitat Politècnica de Catalunya
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
Commercial games AI
•Main objecCve...to deliver the illusion of intelligence
• Categories:– Movement (pathfinding, collision, visibility)– Individual Behaviour (NPCs)– CollecCve Strategy (NPCs groups)
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
Pathfinding
• A* (Dijkstra 1959; Hart, Nilsson, Raphael 1968)– SCll improving, sCll used in the industry– Aligned with academic AI: D*, IDA*, GAA*, ...– Example: StarcraV 2 (A* + Queueing)
martes 3 de enero de 12
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
So what about behavior and strategy?
In commercial games, not much...
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
So what about behavior and strategy?
Scripting
private function UpgradeEx takes nothing returns nothing local unit u = GetTriggerUnit() local integer id = GetUnitTypeId(u) call DisableTrigger(trg_upgrade) call IssueImmediateOrderById(u, 851976)endfunction
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
So what about behavior and strategy?
Hash Tables
std::map< int, CB > hashTable;
hashTable[ 1 ] = UpgradeEx;...hashTable[ 40000 ] = AttackUnit;
(*(hashTable[ a ]))();
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
So what about behavior and strategy?
Finite State Machines
doSomething1()doSomething2()
doSomething3()
doSomething4000()
...
a = 1
a = 2
a = 3a = 3
a = 3
a = N
a = 4000
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
So what about behavior and strategy?
Rule Engines(defrule! (goal 16 0)! (can-research-with-escrow ri-ballistics)=>! (release-escrow wood)! (release-escrow food)! (release-escrow gold)! (release-escrow stone)! (research ri-ballistics))
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
So what about behavior and strategy?
Decision Trees
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
So what about behavior and strategy?
Where is the reasoning?
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
So what about behavior and strategy?
Where is the reasoning?
IT’S GIVEN/HARDCODED BY THE DEVELOPER AT DESIGN TIME!
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
What is usually seen in commercial games?
• Blind specificaCons: HOW to act, not WHYLack of flexibility and adapCvenessStrange, predictable behaviourLow reusabilityHaving more reusable AI engines would make companies invest more in developing be_er AI engines?
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
What is usually seen in commercial games?
• Blind specificaCons: HOW to act, not WHY– Lack of flexibility and adapCveness– Strange, predictable behaviorLow reusabilityHaving more reusable AI engines would make companies invest more in developing be_er AI engines?
martes 3 de enero de 12
• Blind specifications: HOW to act, not WHY
• Lack of flexibility and adaptiveness
• Strange, predictable behaviour
Low reusability
Having more reusable AI engines would make companies invest more in developing better AI engines?
martes 3 de enero de 12
• Blind specifications: HOW to act, not WHY
• Lack of flexibility and adaptiveness
• Strange, predictable behaviour
Low reusability
Having more reusable AI engines would make companies invest more in developing better AI engines?
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
What is usually seen in commercial games?
• Blind specificaCons: HOW to act, not WHY– Lack of flexibility and adapCveness– Strange, predictable behavior
• Low reusabilityHaving more reusable AI engines would make companies invest more in developing be_er AI engines?
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
Example: RTS scripEngWarcraV 3(JASS)
private function UpgradeEx takes nothing returns nothing local unit u = GetTriggerUnit() local integer id = GetUnitTypeId(u) call DisableTrigger(trg_upgrade) call IssueImmediateOrderById(u, 851976)endfunction
Age of Mythology (XSScript)
rule getNextGathererUpgrade { int upgradeTechID=kbTechTreeGetCheapestUnitUpgrade(gathererTypeID, cUpgradeTypeWorkRate, -1, dropSiteFilterID, false, affectedUnitType); int planID=aiPlanCreate("nextGathererUpgrade - "+id, cPlanProgression); aiPlanSetVariableInt(planID, cProgressionPlanGoalTechID, 0, upgradeTechID); aiPlanSetDesiredPriority(planID, 25); aiPlanSetEscrowID(planID, cEconomyEscrowID); aiPlanSetActive(planID);}
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
Example: RTS scripEngStarcraV (Broodwar AI)
wait_build 2 forgeupgrade 1 p_ground_weapon 70upgrade 1 p_plasma_shield 70wait 2700wait_build 1 cybernetics_coreupgrade 1 p_armor 70upgrade 2 p_plasma_shield 70wait 3600
Age of Empires II -‐ AOK (ScriptED)
(defrule (goal 16 0) (can-research-with-escrow ri-ballistics)=> (release-escrow wood) (release-escrow food) (release-escrow gold) (release-escrow stone) (research ri-ballistics))
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
Example: RTS scripEng
WarcraV III StarcraV AoM AoK
Common concepts:unit, building, a_ack, defend, group, patrol, train,
research, resource...
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
What is usually seen in commercial games?
Having more reusable (higher-‐level) AI engines would make companies invest more in developing be_er AI engines?
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
There is some hope
• Planning: reasoning to achieve goals with ac2ons• HTN (Hierarchical Task Networks)• GOAP (Goal-‐Oriented AcOon Planning, Orkin 2005)– F.E.A.R, Condemned, Fallout 3, Empire: Total War, Deus Ex 3, Just Cause 2, ...
– This idea has been slowly adapted into other engines• AI engines are starOng to be reused in a consistent basis– Radiant AI, gamebyro
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
Goal-‐Oriented AcEon Planning
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
Goal-‐Oriented AcEon Planning
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
Goal-‐Oriented AcEon Planning
(Condition + Priority)Search
(Goal state description)
(Condition + Priority)AttackFromCover
(Goal state description)
(Condition + Priority)Investigate
(Goal state description)
(Condition + Priority)Patrol
(Goal state description)
Semantically annotated actions(pre- and post-conditions)
“STRIPS-like” planner
martes 3 de enero de 12
martes 3 de enero de 12
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
Goal-‐Oriented AcEon Planning
• Dynamic planning and re-‐planning– Outperforms FSMs!
• Allows to reason about WHAT to do– BUT sCll not about WHY
• Plans only cannot properly model social behavior– Need for organizaEonal structures
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
Our proposal: going even higher
• It is possible to elaborate soluCons for the issues of– behaviour control– strategy techniques
• ... by integraCng models based on OrganisaEonal TheoreEcal methods
• Expected outcomes– Methodology and tools for Game AI developers– to model gaming scenarios using social structures
• Case studies: commercial games– Cheaper, faster, more visible
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
HOW?(available services)
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
WHAT?(possible actions, plans)
HOW?(available services)
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
WHY?(motivations)
WHAT?(possible actions, plans)
HOW?(available services)
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
What could ALIVE provide?
• High-‐level schemas to reason and jusEfy acCons taken by NPCs– Roles, objecCves, norms, plans...
• Clearly decouple implementaCon and design– Reusable designs· Minimal changes (e.g. vocabulary)· Lower adaptaCon cost
– Dynamic re-‐organizaCon techniques• Not a replacement!
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
GAME ENGINE
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
Case studies
• We have connected ALIVE to several games– Sandbox game: GTA IV– Real-‐Time Strategy: WarcraV III, Lincity, StarcraV– Turn-‐Based Strategy: CivilizaCon IV– MMORPG: WoW– Other: Sims 3
• EvaluaCon of proposal– Realism, flexibility, adaptability
• Use games as inputs for OrganisaConal Research
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
How to connect with games?
• ScripCng languages with I/O support (e.g. LUA)
• DLL InjecCon• Source code
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
How to connect with games?
• ScripCng languages with I/O support (e.g. LUA)
• DLL InjecCon• Source code
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
WarcraP III
• Design of an organizaEonal model• ImplementaCon of ALIVE-‐aware agents (pure Java)• ConnecCon: DLL InjecCon + sockets• RTS games are interesCng for us:– Armies in RTS are directly translatable into ALIVE models
– These models can be shared through games– ReorganizaEon techniques can be applied– Visual interface for real-‐Cme simulaEon
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
WarcraP III: Models
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
WarcraP III: Agent
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
WarcraP III: Agent
ALIVE project
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
WarcraP III: Agent
• The ALIVE framework provides the mechanisms for:– Perceiving a “state of the world” by the interpretaEon of events
– Reasoning about the acEons declared in the CoordinaCon Level
– Taking into account the organizaEonal structures: roles, plans, norms· Following them if the organizaConal constraints are self-‐beneficial!
– Enact acEons in the game, through the patched Service Level
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
World of WarcraP• Emergent narra2ve use-‐case• The objecCve is to break the concepEon of linear narraEve as the only way for humans to author a story
• Basic idea:– To balance character models, events sequences and narraCve
landmarks to create a more open narraEve• Main challenge:– Virtual environments (games) and narraCves exist on different
ontological levels– Difficult to treat them jointly– Emergent narraCve is a direct result of the acEons of characters– To give an illusion of personality to both players and non-‐players
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
World of WarcraP: architecture
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
World of WarcraP: player classificaEon• Play styles taxonomy based on interacCon between players– Achievers, Explorers, Socializers, Killers [Bartle]
• During gameplay, players’ behaviours are monitored and analized to classify them into play styles– AcCons, chat logs, achievements, staCsCcs
• AcCons and states are tagged at design Cme in terms of play styles– achiever : distractGatekeeper– killer : killGatekeeper
• These tags are used by Character Agents when selecCng the acCons to reach a landmark
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
World of WarcraP: plot generaEon and modificaEon
• InteracOvity is achieved by giving enough choices to the player to give an illusion of free will
• The Plot Agent parCally influences the player via missions• If the player gets too far from the storyline, its Character Agent can negoEate changes in the environment to keep acCon within boundaries– Problem: the plot counted on the player to kill a dragon to get the gem, but the player doesn’t kill it
– SoluCon: infer an alternaCve way to bring the gem to the player
martes 3 de enero de 12
martes 3 de enero de 12
martes 3 de enero de 12
martes 3 de enero de 12
martes 3 de enero de 12
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
Where are we in literature?• OrganizaConal modeling has been explored for serious games
• AdapCveness in games is not new...– ...but we propose to introduce another level of abstracCon
• GOAP is an example of a higher-‐level mechanism being successful
• Opportunity to tackle the upcoming real challenges of industry gaming AI [Jonathan Schaeffer @IJCAI’11]:– RealisCc NPC behaviour– Emergent narraCve
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
Conclusions
• Main advantage: specify behavior in terms of why to do something
• ObjecCve: to provide a methodology and tools for Game AI developers– Release game enactors as open-‐source
• We prioriCze behaviour improvement over performance
martes 3 de enero de 12
23/12/2011
ALIVE EU FUNDED PROJECT
IA
What are we doing right now?• Emergent narraCve in MMORPGs:– Player personality analysis· Data mining techniques over public data + voluntary surveys
– Missions, quests will adapt to the player’s gaming style· Killer, Socializer, Achiever, Explorer [Bartle]
– Socially-‐aware· NPCs are aware of their social role· Roles can be changed, society can evolve
• CreaCng more complex models for improved realism• Finding metrics for correct evaluaCon of our proposal– Ba_le ALIVE vs ALIVE with organizaConal adaptaCon
• h_p://kemlg.github.com/consciens
martes 3 de enero de 12