580 likes | 711 Views
Existing and Possible Applications of Artificial Intelli gence in Computer Ga m es. 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.
E N D
Existing and Possible Applications of Artificial Intelligencein 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 • Quake • IGI Covert Strike • Need Formidable opponents • Need good Support characters • Adventure & RPG • Mist • NeverWinter 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 • Civilization 3 • WarCraft 3 • Need enemies with ability to plan, react and learn • “God-games” • SimCity • 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 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: mOLD(x) = {1 (if age(x)>100) } {0.01*age(x) otherwise) }
Fuzzy logic – cont’d • According to this definition: mOLD(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, mA(x) = 0.0 • A = B for all x: mA(x) = mB(x) • A’ : for all x: m(x)A' = 1 – m(x)A • A is CONTAINED in B for all x: mA(x) <= mB(x) • C = A ۷ B mC(x) = MAX(mA(x), mB(x)) • C = A ۸ B mC(x) = MIN(mA(x), mB(x))
Fuzzy logic – cont’d • Examples of last two definitions: • mOLD(Jane) = 0.7 • mSMART(Jane) = 0.6 • What is the degree of membership of Jane in the ‘old-or-smart’ set? • m[OLD ۷ SMART](Jane) = 0.7 • What is the degree of membership of Jane in the ‘old-and-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 COOPERATIVE treaty = 0.4 assist = 0.2 goodwill > 85 goodwill < 65 goodwill > 65 goodwill < 65 Neutral treaty = 0.1 attack = 0.1 assist = 0.05 goodwill > 85 30 < goodwill < 45 or gain > 60 goodwill < 50 and gain > 90 goodwill > 45 AGGRESIVE attack = 0.6 ceasefire = 0.3 peace = 0.8 HOSTILE attack = 0.95 ceasefire = 0.05 goodwill > 30 or gain > -50 gain >10
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
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 Get item in room Go through door Go to door Face item Stop moving to item Move to item Detect item missing Face door Align with door Record at door Move to door Slide to door Stop move to door Stop slide to door
Collect-Powerups Choose-best-item Get item Goto next room Get item in room Go through door Go to door Face item Stop moving to item Move to item Detect item missing Face door Align with door Record at door Move to door Slide to door Stop move to door Stop slide to door
Collect-Powerups Choose-best-item Get item Goto next room Get item in room Go through door Go to door Face item Stop moving to item Move to item Detect item missing Face door Align with door Record at door Move to door Slide to door Stop move to door Stop slide to door
Collect-Powerups Choose-best-item Get item Goto next room Get item in room Go through door Go to door Face item Stop moving to item Move to item Detect item missing Face door Align with door Record at door Move to door Slide to door Stop move to door Stop slide to door
Collect-Powerups Choose-best-item Get item Goto next room Get item in room Go through door Go to door Face item Stop moving to item Move to item Detect item missing Face door Align with door Record at door Move to door Slide to door Stop move to door Stop slide to door
Collect-Powerups Choose-best-item Get item Goto next room Get item in room Go through door Go to door Face item Stop moving to item Move to item Detect item missing Face door Align with door Record at door Move to door Slide to door Stop move to door Stop slide to door
Collect-Powerups Choose-best-item Get item Goto next room Get item in room Go through door Go to door Face item Stop moving to item Move to item Detect item missing Face door Align with door Record at door Move to door Slide to door Stop move to door Stop slide to door
Collect-Powerups Choose-best-item Get item Goto next room Get item in room Go through door Go to door Face item Stop moving to item Move to item Detect item missing Face door Align with door Record at door Move to door Slide to door Stop move to door Stop slide to door
Collect-Powerups Choose-best-item Get item Goto next room Get item in room Go through door Go to door Face item Stop moving to item Move to item Detect item missing Face door Align with door Record at door Move to door Slide to door Stop move to door Stop slide to door
Collect-Powerups Choose-best-item Get item Goto next room Get item in room Go through door Go to door Face item Stop moving to item Move to item Detect item missing Face door Align with door Record at door Move to door Slide to door Stop move to door Stop slide to door
Collect-Powerups Choose-best-item Get item Goto next room Get item in room Go through door Go to door Face item Stop moving to item Move to item Detect item missing Face door Align with door Record at door Move to door Slide to door Stop move to door Stop slide to door
‘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)