Existing and Possible Applications of Artificial Intelligence in
Existing and Possible Applications of Artificial Intelligence in Computer Games Ori Liel
In this lecture • A few words about the industry • Current AI technologies applied in games • “Fuzzy logic” • Soar Quake-bot • Interesting projects and possible future applications
The computer (and console) game industry • Multi-Billion $ industry • Growing fast • Main trends: – Increasing # of games with multi-player options – Movement towards console games – Emerging trend - increasing investment in AI • Graphics and sound can’t make ground-breaking leaps • More CPU power available: – Hardware improvements – Graphics cards carry the burden
Need for AI – different game geners • Action – – v v Quake IGI Covert Strike Need Formidable opponents Need good Support characters • Adventure & RPG v v Mist Never. Winter Nights – Need Believable NPC’s • Have beliefs, desires and intentions • Are able to formulate and carry out plans – New notion: plot management
Need for AI – cont’d • Strategy v Civilization v War. Craft 3 3 – Need enemies with ability to plan, react and learn • “God-games” v Sim. City v Populous – Need Believable environments
Need for AI – cont’d • Why are agents suitable? • For all the reasons which were mentioned before: – First of all: agents as a natural metaphor – Modularity – Decentralization – Changeability – Open environments
Current State of AI in games • AI is not taken very seriously (yet…) – Budget goes to graphics – Usually put off until late in development – Not enough expertise in the industry • From an industrial point of view AI is a means, not an end.
Current AI technologies applied in games
Current technology - FSM • Finite State Machines: – States & transformation rules – Agent behavior: • deterministic • reactive – Can be improved by adding intelligent-looking scripted behavior
Current technology – Flocking • Flocking algorithms – Simulate realistic movement in a group – Based on studies of flocks of birds, and schools of fish – Essence of algorithms: • Maintain a minimum distance from other agents • Move towards center of mass • Keep your alignment similar to other agents’ “follow the leader” flocking
Current technology – others • Pursuit-evasion algorithms – AI character in pursuit – AI character escaping • Path-finding - A* algorithm – Used by units to find their way around in the environment
“Fuzzy” logic (And it’s application in game AI)
Fuzzy logic • Development of fuzzy logic: – Plato said it first: there is something between ‘true’ and ‘false’ – Since then • Three-valued logic [-1, 0, 1] • N-valued logic • Finally, infinite-valued logic
Fuzzy logic – cont’d • The idea: – the universe is made of fuzzy sets. • “The fuzzy set of old people” • “The fuzzy set of red objects” – and a membership function ‘m’ m: STATEMENT VALUE
Fuzzy logic – cont’d • An example: – Jane is 70 years old. Is Jane old? Depends on who you’re asking. – Assume that membership in ‘old’ is defined as follows: m. OLD(x) = {1 (if age(x)>100) } {0. 01*age(x) otherwise) }
Fuzzy logic – cont’d • According to this definition: m. OLD(Jane) = 0. 7 – Question: • What does this mean? – Answer: • Jane’s degree of membership within the set of old people is 0. 7 – Not to be confused with probabilistic approach
Fuzzy logic – cont’d • Basic definitions (A and B are sets): § § § A is EMPTY for all x, m. A(x) = 0. 0 A = B for all x: m. A(x) = m. B(x) A’ : for all x: m(x)A' = 1 – m(x)A A is CONTAINED in B for all x: m. A(x) <= m. B(x) C = A ۷ B m. C(x) = MAX(m. A(x), m. B(x)) C = A ۸ B m. C(x) = MIN(m. A(x), m. B(x))
Fuzzy logic – cont’d • Examples of last two definitions: – – – m. OLD(Jane) = 0. 7 m. SMART(Jane) = 0. 6 What is the degree of membership of Jane in the ‘oldor-smart’ set? • m[OLD ۷ SMART](Jane) = 0. 7 – What is the degree of membership of Jane in the ‘oldand-smart’ set? • m[OLD ۸ SMART](Jane) = 0. 6
Fuzzy logic – applications • Fuzzy-logic introduces a random element into decision -making – Opponent’s personalities in Civilization 3 are defined in this way: • • • m[aggressive] (Japan) = 0. 7 m[scientific](Japan) = 0. 4 m[expansionistic](Japan) = 0. 6 – A probabilistic function uses these values (among others) to determine Japan’s next move, depending on Japan’s present state.
Probabilistic Fuzzy-State machine goodwill < 85 ALLIED treaty = 0. 8 assist = 0. 8 goodwill > 85 30 < goodwill < 45 or gain > 60 goodwill > 85 goodwill < 65 goodwill > 65 Neutral treaty = 0. 1 attack = 0. 1 assist = 0. 05 COOPERATIVE treaty = 0. 4 assist = 0. 2 goodwill < 65 goodwill < 50 and gain > 90 goodwill > 45 AGGRESIVE attack = 0. 6 ceasefire = 0. 3 peace = 0. 8 goodwill > 30 or gain > -50 gain >10 HOSTILE attack = 0. 95 ceasefire = 0. 05
The ‘Soar’ Quake-bot
Quake II • Quake II – a first person shooter – The Quake II environment • Levels: sets of rooms and passages • Weapons: from knife to RPG • Power-ups – Quake II Death-Match
Quake II - mods • ‘mods’ are modified versions of existing games – – – • New game-play features • Altered laws of physics, changes to environment • Improved (or at least different) AI Can be created by company or by players. In Quake II, id software released some source code, and mods were created by players Favorite use of code: The creation of “Quake-bots” for death-matches.
Quake II - Quake-bots Bots simulate human perception Status of the targets: target In range visible In front A Yes No Yes B Yes No No C Yes Yes D No N/A E Yes No No
The ‘Soar’ Quake-Bot • The Soar bot’s decision cycle:
‘Soar’ Quake-Bot – cont’d • Evaluation, proposal and operator selection take into account: • Internal state – Health level – Current weapon – Knowledge of map • Some pre-defined ordering among operators, which is unique to the version of the robot.
‘Soar’ Quake-Bot – cont’d • Operator application – Operators can be: • primitive actions (move, shoot) • internal actions (remember location) • abstract actions (collect power-ups) – If an abstract operator has been selected, it is immediately regarded as a goal
Collect-Powerups Choose-best-item Get item Goto next room Go through door Face door Align with door Get item in room Go to door Record at door Move to door Face item Slide to door Stop moving to item Stop move to door Move to item Stop slide to door Detect item missing
Collect-Powerups Choose-best-item Get item Goto next room Go through door Face door Align with door Get item in room Go to door Record at door Move to door Face item Slide to door Stop moving to item Stop move to door Move to item Stop slide to door Detect item missing
Collect-Powerups Choose-best-item Get item Goto next room Go through door Face door Align with door Get item in room Go to door Record at door Move to door Face item Slide to door Stop moving to item Stop move to door Move to item Stop slide to door Detect item missing
Collect-Powerups Choose-best-item Get item Goto next room Go through door Face door Align with door Get item in room Go to door Record at door Move to door Face item Slide to door Stop moving to item Stop move to door Move to item Stop slide to door Detect item missing
Collect-Powerups Choose-best-item Get item Goto next room Go through door Face door Align with door Get item in room Go to door Record at door Move to door Face item Slide to door Stop moving to item Stop move to door Move to item Stop slide to door Detect item missing
Collect-Powerups Choose-best-item Get item Goto next room Go through door Face door Align with door Get item in room Go to door Record at door Move to door Face item Slide to door Stop moving to item Stop move to door Move to item Stop slide to door Detect item missing
Collect-Powerups Choose-best-item Get item Goto next room Go through door Face door Align with door Get item in room Go to door Record at door Move to door Face item Slide to door Stop moving to item Stop move to door Move to item Stop slide to door Detect item missing
Collect-Powerups Choose-best-item Get item Goto next room Go through door Face door Align with door Get item in room Go to door Record at door Move to door Face item Slide to door Stop moving to item Stop move to door Move to item Stop slide to door Detect item missing
Collect-Powerups Choose-best-item Get item Goto next room Go through door Face door Align with door Get item in room Go to door Record at door Move to door Face item Slide to door Stop moving to item Stop move to door Move to item Stop slide to door Detect item missing
Collect-Powerups Choose-best-item Get item Goto next room Go through door Face door Align with door Get item in room Go to door Record at door Move to door Face item Slide to door Stop moving to item Stop move to door Move to item Stop slide to door Detect item missing
Collect-Powerups Choose-best-item Get item Goto next room Go through door Face door Align with door Get item in room Go to door Record at door Move to door Face item Slide to door Stop moving to item Stop move to door Move to item Stop slide to door Detect item missing
‘Soar’ Quake-Bot – Anticipation • Robot anticipates player’s moves by: – Forming an internal model of player • Player status – Health – Weapon level • Player’s beliefs (current perception of the world) – Projecting its own behavior on player
‘Soar’ Quake-Bot – Anticipation (cont’d) • Why should anticipation be used? – Ambush – Hunt (pursuit-evasion) – Deny power-ups • When should anticipation be used? – Not all the time • Requires lots of CPU for reasoning. • May interfere with regular mechanisms – Should be used when • Sensing enemy (some knowledge of enemy state) • Enemy is far away and not facing the bot
His Distance: 1 My Distance: 1
His Distance: 2 My Distance: 2
His Distance: 2 My Distance: 2
His Distance: 3 My Distance: 1 (but hall)
His Distance: 4 My Distance: 0 Ambush!
* Bot remembers successful sequences (learning)
Other interesting projects
“Haunt 2” http: //winter. eecs. umich. edu/haunt/overview. html • Situation: player is a ghost-like • • • energy creature trapped in a house Goal: escape Problem: player is severely limited in manipulating the environment Game-play: get house residents (AI characters) to do things for you by: – frightening – enticing – cajoling – Threatening Game-play entirely based on interaction with AI characters!
“Haunt 2” – cont’d • AI characters must have: – Personality – Goals and motivations – Very believable reactions to environment • Example of AI characters: – Evil scientist • Driven by desire to capture ghost • Personality: Immune to fear, can’t stand cold – Lost hitchhiker • Driven by curiosity • Personality: Easily frightened, physically strong
Cyphesis http: //www. worldforge. org/wf/dev/eng/servers/cyphesis • Idea: characters in virtual worlds alive, all NPCs have ambitions • Between multi-player and single-player • Scripting and planning in use • A thought: how to make it computationally feasible?
Kemal Enver’s project http: //www. multiagent. tk • A variation of capture the flag with tank fights – A* path-finding – Reactive behavior – Communication between agents
Idea for a game • Set in a fantasy D&D-like environment • (As in Cyphesis) World full of self-interested • • NPCs. (As in “Haunt 2”) AI cooperation is very important Achieve cooperation by: – Negotiation – Threats – Building trust and friendship
Idea for a project • Simplified case of last idea • Setting: a zoo – – – Paths Cages Obstacles Exits Items: tranquilizer gun, riding horse, security passes – – – Players (BDI, communication skills) Animals (reactive, subsumption architecture or FSM) Guards? • Agents:
Idea for a project – cont’d • Game-play: – Zoo is set randomly – Missions are assigned randomly • • Release Tiger into the wild Move animal Bear from cage ‘a’ to cage ‘b’ Keep at least ‘n’ animals in their cages (maintenance task) Protect the Monkey at all costs! • Agents have goals agents have tasks. So game can be seen as task-oriented domain – Players don’t know about each other’s missions (an opportunity to incorporate learning!) – Run simulation and see how fast, if at all, human player completes task.
- Slides: 58