Introduction to Game AI CS 395 Game Design Spring 2003.

Slides:



Advertisements
Similar presentations
Soar and StarCraft By Alex Turner. What is StarCraft: Brood War? A Real-Time Strategy (RTS) computer game released in A sci-fi war simulation Continually.
Advertisements

Heuristic Search techniques
7.1. O SCARS & A RTIFICIAL I NTELLIGENCE Interim awards and introduction to game AI.
1 Optimizing compilers Managing Cache Bercovici Sivan.
Adversarial Search We have experience in search where we assume that we are the only intelligent being and we have explicit control over the “world”. Lets.
Game AI Kevin Dill Senior AI Engineer Blue Fang Games
Artificial Intelligence for Games Patrick Olivier & John Shearer
1 Interactive Fiction CIS 487/587 Bruce R. Maxim UM-Dearborn.
Half life 2/ Counter Strike: Source bot Charlie Cross CIS
Michael Zyda Finite State Machines Michael Zyda
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2008.
CSE 380 – Computer Game Programming Pathfinding AI
Adversarial Search Chapter 5.
Application of Artificial intelligence to Chess Playing Capstone Design Project 2004 Jason Cook Bitboards  Bitboards are 64 bit unsigned integers, with.
Finite State Machine for Games Fall 2012 Ref: Chenney, CS679 lectures AI Game Programming Wisdom 2.
Artificial Intelligence in Game Design Intelligent Decision Making and Decision Trees.
Game Design Serious Games Miikka Junnila.
Artificial Intelligence in Game Design Introduction to Learning.
Using Cellular Automata and Influence Maps in Games
CS-378: Game Technology Lecture #16: AI Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica Hodgins.
Games with Chance Other Search Algorithms CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 3 Adapted from slides of Yoonsuck Choe.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 580 Artificial Intelligence Ch.6: Adversarial Search Fall 2008 Marco Valtorta.
1 search CS 331/531 Dr M M Awais A* Examples:. 2 search CS 331/531 Dr M M Awais 8-Puzzle f(N) = g(N) + h(N)
10/30/2001CS 638, Fall 2001 Today AI –Overview –State Machines.
AI – Week 8 AI + 2 Player Games Lee McCluskey, room 3/10
ICS-271:Notes 6: 1 Notes 6: Game-Playing ICS 271 Fall 2006.
Games & Adversarial Search Chapter 6 Section 1 – 4.
CS 370 Computer Game Design Introduction Ken Forbus Spring 2003
1 Adversary Search Ref: Chapter 5. 2 Games & A.I. Easy to measure success Easy to represent states Small number of operators Comparison against humans.
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
Raven Robin Burke GAM 376. Soccer standings Burke, 7 Ingebristen, 6 Buer, 6 Bukk, 6 Krishnaswamy, 4 Lobes, 3 Borys, 2 Rojas, 2 Bieneman, 2.
Artificial Intelligence in Game Design Problems and Goals.
Finite State Machine for Games Spring 2005 Ref: Chenney, CS679 lectures AI Game Programming Wisdom 2.
Introduction GAM 376 Robin Burke Winter Outline Introductions Syllabus.
Game Playing Chapter 5. Game playing §Search applied to a problem against an adversary l some actions are not under the control of the problem-solver.
Starcraft Opponent Modeling CSE 391: Intro to AI Luciano Cheng.
Artificial Intelligence Techniques Artificial Stupidity?
Ch 7.2: Performing Qualitative Terrain Analysis in MoO3.
SKULLS OF THE SHOGUn AI POST-MORTEM Borut Pfeifer Developer: Haunted Temple Studios Publisher: Microsoft Platforms: XBLA, Windows Phone, Windows 8 Release.
Games. Adversaries Consider the process of reasoning when an adversary is trying to defeat our efforts In game playing situations one searches down the.
Motion Planning in Games Mark Overmars Utrecht University.
Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming.
Artificial Intelligence for Games Finite State Machines
Today’s Topics Playing Deterministic (no Dice, etc) Games –Mini-max –  -  pruning –ML and games? 1997: Computer Chess Player (IBM’s Deep Blue) Beat Human.
Finite State Machines (FSM) OR Finite State Automation (FSA) - are models of the behaviors of a system or a complex object, with a limited number of defined.
Chess Strategies Component Skills Strategies Prototype Josh Waters, Ty Fenn, Tianyu Chen.
Learning to Play the Game of GO Lei Li Computer Science Department May 3, 2007.
ARTIFICIAL INTELLIGENCE (CS 461D) Princess Nora University Faculty of Computer & Information Systems.
Graph Search II GAM 376 Robin Burke. Outline Homework #3 Graph search review DFS, BFS A* search Iterative beam search IA* search Search in turn-based.
Finite State Machines GAM 376 Robin Burke Winter 2006.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
CS-424 Gregory Dudek Lecture 10 Annealing (final comments) Adversary Search Genetic Algorithms (genetic search)
Finite State Machines GAM 376 Robin Burke Fall 2006.
Finite State Machines Logical and Artificial Intelligence in Games Lecture 3a.
10/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Terrain Generation We’re pretty much done with the graphics part of the course.
Understanding AI of 2 Player Games. Motivation Not much experience in AI (first AI project) and no specific interests/passion that I wanted to explore.
The Game Development Process: Artificial Intelligence.
Finite State Machines GAM 376 Robin Burke Winter 2008.
Decision Making: Decision Tree & State Machines Session 07
CS Fall 2016 (Shavlik©), Lecture 11, Week 6
Artificial Intelligence and Computer Games
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Games with Chance Other Search Algorithms
Capriccio – A Thread Model
CIS 488/588 Bruce R. Maxim UM-Dearborn
Graph Coverage for Specifications CS 4501 / 6501 Software Testing
Search.
Search.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning
Presentation transcript:

Introduction to Game AI CS 395 Game Design Spring 2003

Expectations on term projects Designing and implementing a full game from scratch can be too hard Exceptions: Text-based interactive fiction, arcade games, … What to do?

Solution One: Leverage –We’re supplying toolkits and resources for some projects Neverworld3 Self-explanatory simulator compiler –There are lots of resources around if you look Game engines Graphics frameworks Games with available source code (e.g., FreeCiv) –Building on top of such software is strongly recommended.

Solution Two: Extension an existing game Extensions to existing games can be acceptable (aka “mods”) –Must involve significant design work, including analysis of tradeoffs and portfolio of experiments generated in the course of design –Must be substantially larger than a typical homework problem

Term Project To Do List Identify your teammates early Identify your project area early Request for Proposals will be made very soon (Thursday)

Overview Why AI is important for games –And why it needs improving Roles for AIs in games –The opponent –Characters –The World Example credits: –Spatial reasoning in MOO3 Thanks to Kevin Dill for screenshots and example –Tactical decision making in first-person shooters Thanks to John Laird, Mike VanLent, for their GDC 2001 tutorial material

Why AI is important for games Essential to the modeled world –NPC’s of all types: opponents, helpers, extras, … –Unrealistic characters  reduced immersion –Stupid, lame behaviors  reduced fun –Superhuman behaviors  reduced fun Until recently, given short shrift by developers –Graphics ate almost all the resources –Can’t start developing the AI until the modeled world was ready to run AI development always late in development cycle Situation rapidly changing –AI now viewed as helpful in selling the product –Still one of the key constraints on game design

Interview with Soren Johnson, GameSpin: What about the [civ3] AI? One of the complaints that players have always had about the AI is that it cheats. Does it still cheat? Johnson: The AI has been totally reworked. We started from scratch. We stretched out the difficulty levels. Chieftain is easier than it was in Civ II and Deity is now harder. Does the AI cheat? Yes, but sometimes in favor of the player! Below Prince level it cheats for the player, and above Prince level it cheats against the player. At Prince level there is no cheating. Right now, no one at Firaxis can beat the AI at Deity level, though we certainly expect players to find ways to do so within a few months of the game being released. When we rewrote the AI we threw out the old AI completely. We also looked at some popular tactics like ICS -- infinite city sprawl -- that some players used to beat the AI in Civ II at Deity level. These won't work in Civ III.

AI in game marketing “It may be hard to believe that the future of 21st century art is represented by a giant bipedal tiger who farts, break dances and flings livestock around when he's bored.” –Review of Black and White in Salon.com, 4/10/2000 “The most versatile 3D Batman yet, with over 500 animated movements, special fighting moves and a multi-functional cape with its own A.I.” –from

Game flaws engendered by bad AI Mindless hordes of opponents –“ Life is much, much easier thanks to random numbers ” Rampant cheating by computer opponents Focus on violence as principle mode of interaction

Roles for AIs in games The opponent Characters The world

The opponent Emphasis: Outsmarting you Example: Classic board games Questions: –What problems do they have to solve? –How do they work?

Opponents in classic board games Move generator figures out what moves are possible Static evaluator figures out how good each move is, based on changes in board position Search algorithms look ahead, in a simple form of mental simulation, to figure out the best alternative based counter-moves and counter- moves

Example Current board position

Example Your possible moves, as produced by move generator How good each move looks in terms of its immediate results, as computed by the static evaluator 618-2

Example Your opponent’s possible countermoves What position these countermoves leave you in

Example This process can be continued until resources run out Use minimax to estimate your best move

Minimax Example Run static evaluator on leaves

Minimax Example Propagate scores upward by taking max when your turn

Minimax Example Propagate scores upward taking min when opponent’s turn

Minimax Example Select best option based on deeper estimate

Search issues Lots of techniques for more efficient search –Alpha-beta pruning, “book” openings, stability measures, conspiracy numbers Basic problem is still exponential –Search and brute force only go so far –Q: Why did Deep Blue win? Knowledge/search tradeoff –Simon & Chase experiments: Chess experts use spatial memory for board positions –Standard patterns as encoding lessons from experience/deeper search?

Opponents in turn-based strategy games Examples: Many strategy war games, Civilization- style games What problems do they have to solve? How are they similar to, and different from, board games?

nuSketch Battlespace

Comic Graphs provide visualization of alternatives, support for AAR

Example from MOO3 Homeworld Colony Enemy Colony Where should you put your next colony?

Understanding your terrain is key Homeworld Colony Enemy Colony Inside your empire

Understanding borders prioritizes threats Homeworld Colony Enemy Colony Good choice for blocking threats

Multiple ways to deal with threats Homeworld Colony Enemy Colony

Example: eTDG10 Map

SR Regions for eTDG10 map (hand- sketched)

Hard constraints from SR regions

Voronoi diagram for free space

Junctions provide seeds for open regions

Regions extended from seeds

Edges outside regions form corridor seeds

Combined results for eTDG10

The coordination problem Telling your brigades to attack Scum Division will generally lead to them all being slaughtered

The coordination problem Lack of coordination will lead them down same path, each being wiped out one at a time, even though a coordinated attack would have succeeded What if they had a richer, non-local understanding of space?

The coordination problem Enable player to communicate intent via sketching and language, specifying paths and synchronization Visually identify paths (mobility corridors, avenues of approach) as part of terrain analysis

Richer spatial reasoning will lead to better opponents

Narrow route with no side ways out Funnel for focusing combat power

Characters Examples: First-person shooters, adventure/action games What problems do they have to solve?

The World Common trick: Share AI computations between computer characters –Pathfinding and navigation –Awareness of player actions and alignment –Strategic thinking Examples: More than you might think

Types of Behavior to Capture Wander randomly if don’t see or hear an enemy. When see enemy, attack When hear an enemy, chase enemy When die, respawn When health is low and see an enemy, retreat Extensions: –When see power-ups during wandering, collect them.

Execution Flow of an AI Engine Sense Think Act GAMEGAME ? Finite-state machines Decision trees Neural nets Fuzzy logic Rule-based systems Planning systems

Conflicting Goals for AI in Games Goal Driven Reactive Human Characteristics Knowledge Intensive Low CPU & Memory Usage Fast & Easy Development

Complexity Complexity of Execution –How fast does it run as more knowledge is added? –How much memory is required as more knowledge is added? Complexity of Specification –How hard is it to write the code? –As more “knowledge” is added, how much more code needs to be added?

Expressiveness of Specification What can easily be written? Propositional: –Statements about specific objects in the world – no variables –Jim is in room7, Jim has the rocket launcher, the rocket launcher does splash damage. –Go to room8 if you are in room7 through door14. Predicate Logic: –Allows general statement – using variables –All rooms have doors –All splash damage weapons can be used around corners –All rocket launchers do splash damage –Go to a room connected to the current room.

Example FSM Events: E=Enemy Seen S=Sound Heard D=Die Spawn D Wander -E, -S, -D D -E E -S Attack E, -D E -E Chase S, -E, -D S D E D S Action (callback) performed when a transition occurs Code …

Example FSM Events: E=Enemy Seen S=Sound Heard D=Die Spawn D Wander -E, -S, -D D -E E -S Attack E, -D E -E Chase S, -E, -D S D E D S Problem: No transition from attack to chase

Example FSM - Better Events: E=Enemy Seen S=Sound Heard D=Die Attack-S E, -D, S S -E -S S E Attack E, -D, -S E -E Spawn D Wander -E, -S, -D D -E Chase S, -E, -D D D S ED

Example FSM with Retreat Spawn D (-E,-S,-L) Wander -E,-D,-S,-L E -S Attack-E E,-D,-S,-L E Chase -E,-D,S,-L S D S D Events: E=Enemy Seen S=Sound Heard D=Die L=Low Health Each feature with N values can require N times as many states D Retreat-E E,-D,-S,L L -E Retreat-S -E,-D,S,L Wander-L -E,-D,-S,L Retreat-ES E,-D,S,L Attack-ES E,-D,S,-L E E -E -L S -S L -E E L -L L D

Hierarchical FSM Expand a state into its own FSM Wander Die S/-S E/-E Attack Chase Spawn Start Turn Right Go-through Door Pick-up Powerup

Non-Deterministic Hierarchical FSM (Markov Model) Attack Die No enemy Wander Start Approach Aim & Jump & Shoot Aim & Slide Left & Shoot Aim & Slide Right & Shoot

Implementation Compile into an array of state-name, event state-name := array[state-name, event] Uses state-name to call execution logic Add buffers to queue up events in case get simultaneous events event state Hierarchical Create array for every FSM Have stack of states Classify events according to stack Update state which is sensitive to current event

FSM Evaluation Advantages: –Very fast – one array access –Can be compiled into compact data structure Dynamic memory: current state Static memory: state diagram – array implementation –Can create tools so non-programmer can build behavior –Non-deterministic FSM can make behavior unpredictable Disadvantages: –Number of states can grow very fast Exponentially with number of events: s=2 e –Number of arcs can grow even faster: a=s 2 –Propositional representation Difficult to put in “pick up the better powerup”, attack the closest enemy

References Web references: – htm –csr.uvic.ca/~mmania/machines/intro.htm – /doc/design_principles/fsm.html – – ategy_game_AIs_A3ISS_2001.PDFhttp:// ategy_game_AIs_A3ISS_2001.PDF Deloura, Game Programming Gems, Charles River Media, 2000, Section 3.0 & 3.1, pp