Artificial Intelligence CGDD 4003. Artificial Intelligence Human-level intelligence - an unsolved problem AI “describes the intelligence embodied in any.

Slides:



Advertisements
Similar presentations
Heuristic Search techniques
Advertisements

7.1. O SCARS & A RTIFICIAL I NTELLIGENCE Interim awards and introduction to game AI.
AI Pathfinding Representing the Search Space
October 1, 2012Introduction to Artificial Intelligence Lecture 8: Search in State Spaces II 1 A General Backtracking Algorithm Let us say that we can formulate.
Artificial Intelligence in Game Design Representing NPCs as Finite State Machines.
CSE 380 – Computer Game Programming Pathfinding AI
Flocking Behaviors Presented by Jyh-Ming Lien. Flocking System What is flocking system? – A system that simulates behaviors of accumulative objects (e.g.
Artificial Intelligence in Game Design Intelligent Decision Making and Decision Trees.
Artificial Intelligence in Game Design Introduction to Learning.
Artificial Intelligence in Game Design Hierarchical Finite State Machines.
1 AI for Computer Game Developers Finite state machines Path finding and waypoints A-Star path finding.
Chapter 10 Artificial Intelligence © 2007 Pearson Addison-Wesley. All rights reserved.
CS 4730 Game AI CS 4730 – Computer Game Design Some slides courtesy Tiffany Barnes, NCSU.
Using Search in Problem Solving
Artificial Intelligence CSE 191A: Seminar on Video Game Programming Lecture 7: Artificial Intelligence UCSD, Spring, 2003 Instructor: Steve Rotenberg.
Trading optimality for speed…
Chapter 5.4 Artificial Intelligence: Pathfinding.
Tactical AI in Real Time Supervisor: Aleks Jakulin Crew: Damir Arh, Matija Jekovec, Mitja Luštrek Gregor Leban, Martin Žnidaršič, Uroš Čibej Translation:
State-Space Searches.
Informed Search Idea: be smart about what paths to try.
Chapter 5.4 Artificial Intelligence: Pathfinding.
CS 4730 AI and Pathfinding CS 4730 – Computer Game Design Some slides courtesy Tiffany Barnes, NCSU.
Chapter 11: Artificial Intelligence
Artificial Intelligence in Game Design Problems and Goals.
Chapter 10 Artificial Intelligence. © 2005 Pearson Addison-Wesley. All rights reserved 10-2 Chapter 10: Artificial Intelligence 10.1 Intelligence and.
1 Game AI Path Finding. A Common Situation of Game AI A Common Situation of Game AI Path Planning Path Planning –From a start position to a destination.
Video Game AI. Classical Games – Focus on optimal players using computationally expensive search techniques Video Game AI – Refers to games such as First.
Developing the Game Functionality Lesson 6. Exam Objective Matrix Skills/ConceptsMTA Exam Objectives Programming the Components Understand Components.
1 CO Games Development 1 Week 6 Introduction To Pathfinding + Crash and Turn + Breadth-first Search Gareth Bellaby.
Artificial Intelligence in Game Design Behavior Trees.
Introduction to AI Engine & Common Used AI Techniques Created by: Abdelrahman Al-Ogail Under Supervision of: Dr. Ibrahim Fathy.
Artificial Intelligence Techniques Artificial Stupidity?
AI in games Roger Crawfis/Eric Fosler-Lussier CSE 786 Game Design.
AI in Computer Gaming: The first person shooter Tyler Hulburd.
State-Space Searches. 2 State spaces A state space consists of A (possibly infinite) set of states The start state represents the initial problem Each.
IMGD 1001: Programming Practices; Artificial Intelligence.
Artificial Intelligence in Game Design Dynamic Path Planning Algorithms.
CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play.
Artificial Intelligence in Game Design Complex Steering Behaviors and Combining Behaviors.
AI in games Roger Crawfis CSE 786 Game Design. AI vs. AI for games AI for games poses a number of unique design challenges AI for games poses a number.
Artificial Intelligence for Games Finite State Machines
Computational theory techniques in interactive video games.
AI Evaluation David Nowell CIS 588 2/14/05 Baldur’s Gate.
Basic Game AI IMGD 4000 With material from: Ian Millington and John Funge. Artificial Intelligence for Games, Morgan Kaufmann, (Chapter 5)
1 CO Games Development 1 Week 13 - Revision Lecture AI Revision Gareth Bellaby.
REFERENCE: “ARTIFICIAL INTELLIGENCE FOR GAMES”, IAN MILLINGTON. A* (A-STAR)
Artificial Intelligence in Game Design Influence Maps and Decision Making.
Artificial Intelligence in Game Design Lecture 8: Complex Steering Behaviors and Combining Behaviors.
1 CO Games Development 1 Week 3 Game Agents 2 Gareth Bellaby.
CSCE 552 Spring 2010 AI (III) By Jijun Tang. A* Pathfinding Directed search algorithm used for finding an optimal path through the game world Used knowledge.
Artificial Intelligence in Game Design Lecture 20: Hill Climbing and N-Grams.
Finite State Machines Logical and Artificial Intelligence in Games Lecture 3a.
CSCE 552 Fall 2012 AI By Jijun Tang. Homework 3 List of AI techniques in games you have played; Select one game and discuss how AI enhances its game play.
The Game Development Process: Artificial Intelligence.
Review IMGD Engine Architecture Types Broadly, what are the two architecture types discussed for game engines? What are the differences?
Chapter 5.4 Artificial Intelligence: Pathfinding
Enemy and Friendly AIs Richard Gesick.
Artificial Intelligence in Game Design
Maze Implementation, Analysis and Design to find Shortest Paths
CO Games Development 2 Week 19 Extensions to Finite State Machines
Finite State Machines in Games
CIS 488/588 Bruce R. Maxim UM-Dearborn
Interaction with artificial intelligence in games
Team 17c ****** Pathfinding
CO Games Development 1 Week 8 Depth-first search, Combinatorial Explosion, Heuristics, Hill-Climbing Gareth Bellaby.
IMGD 1001: Programming Practices; Artificial Intelligence
CSCE 552 Spring 2009 AI (III) By Jijun Tang.
Presentation transcript:

Artificial Intelligence CGDD 4003

Artificial Intelligence Human-level intelligence - an unsolved problem AI “describes the intelligence embodied in any manufactured device”* Need AI for both enemies and allies *again, your text, chapter 5.3

AI for Games AI must be intelligent, yet purposely flawed – Opponents must present a challenge – Must keep the game fun – Must lose to the player in a fun manner AI must have no intended weaknesses – No “golden paths” for defeating the AI – AI must not fail or appear “dumb”

AI for Games AI must perform within CPU/memory of game – Real time – Receives only 10%-20% of frame time AI must be configurable – Designers can adjust the difficulty AI must hit the shipping date – Actually, AI techniques must be proven early – If AI can evolve, it must be thoroughly tested

AI AI has perfect data, yet… Goal is not perfect AI – Perfect AI is no fun and expensive to compute – Goal is fun AI that is extensible/customizable How many AI developers? – AAA/RTS: maybe 3 full time? – Others: maybe one part time?

Game Agents A.k.a. Non-Player Characters (NPCs) 1.Sensing – Have perfect info, so must cripple! – Vision – limit distance (human limitations) – Hearing – distance, shots fired – Communication with other agents – Reaction times (must delay)

Game Agents 2.Thinking (making decisions) – Expert knowledge (simple rules, finite state machines, decision trees) – Search – use an algorithm to derive a near- optimal solution (e.g. path finding) – Machine Learning (not used often) – neural networks, genetic algorithms, decision trees – Flip-flopping – deciding every frame (stick with your decision!)

Game Agents 3. Acting – if your NPC is intelligent, the user must see/hear intelligent things – Picking up weapons, running for cover – If agent knows it will die, it should scream (to show comprehension)! Learning/Remembering – agent gets better – Smart terrain can be marked as “dangerous”

Game Agents Easy to make AI too hard. Instead: – Make less accurate – Longer reaction times – One-on-one fighting (think Kung-Fu) Agent cheating: – Agents can be omniscient – AI can have unfair advantage to make it harder – Should you let the player know?

Finite State Machines Most common AI Simple to understand, implement, debug Basic idea: change from state to state based on input (and maybe some randomness) Extending – Can store states in a stack when returning to previous tasks – Can transition to a new FSM – Can have multiple FSMs – Visualize state by displaying state above head

Finite State Machines

Code Example (but not scalable, uses “polling” instead of events, and in C instead of Lua) enum states {WANDER, ATTACK, FLEE}; void RunLogic (int* state) { switch (*state) { case WANDER: Wander(); if (SeeEnemy()) {*state = ATTACK;} break; case ATTACK: Attack(); if (LowOnHealth()) {*state = FLEE;} if (NoEnemy()) {*state = WANDER;} break; case FLEE: Flee(); if (NoEnemy()) {*state = WANDER;} break; }

Common Game AI A* pathfinding – fast at finding cheapest path Behavior Tree – hierarchical FSM – Non-leaves determine when – Leaves do actual work – Halo 2 and 3 Command Hierarchy – military hierarchies – General makes high-level decision – Foot soldier fights

Common Game AI Dead reckoning – “leading the target” Emergent behavior – behavior from simpler behaviors Flocking – moving groups of creatures – Separation – Alignment towards average heading of flock – Steer towards average position of flock Formations – similar to flocking, but keep formation

Flocking Avoidance – steer to avoid crowding Alignment – steer towards average heading of flock Cohesion (midpoint) – steer toward midpoint of flock From

Common Game AI Influence mapping – cell-based weighting to determine the power within the game – Assign a value based on number of units+neighbors – Good for path planning Level-of-Detail AI – closer == better AI Manager Task Assignment – Have a manager to prioritize tasks – Put the best candidate on that job

Common Game AI Obstacle Avoidance (must avoid clutter) Terrain Analysis – identifying strategic locations

Path Setup (Working our way up to A*) Grid – each cell marked as passible or not

Path Setup Waypoint Graphs – “I walk the line”

Path Setup NavMesh - If an edge isn’t shared, you shall not pass!

Random Trace Algorithm Move towards goal, then trace around obstacle (CW or CCW)

Fundamentals Each cell has – A position – A pointer to another cell (which cell led us to this cell) Store an open and closed list – Open – all paths that still need to be processed – Closed – nodes that aren’t the goal but have been processed

The Four Algorithms The difference is in which node in the open list it decides to process – Breadth-First – waiting the longest – Best-First – closest to goal – Dijkstra – cheapest to reach from start cell – A* - cheap AND close to goal

Breadth-First Search Ply-by-ply, pushing new nodes on back of queue Memory hog (exhaustive search)

Best-First Node that is closest to the goal is processed (heuristic search)

Limitations of Best-First Breadth/Dijkstra Best-First

Dijkstra Similar to breadth-first, but calculates cost to get to a node Can understand weighted regions (e.g sand vs swamp vs road vs water) May find new/better paths for each node Exhaustive and always find optimal path!

A* Combines best-first and Dijkstra – Cost paid to get to that node (given cost - Dijkstra) – Has an estimated cost (heuristic cost – best) – Heuristic cost is usually the distance Final cost=Given cost + (Heuristic cost*Heuristic weight)

A* From Wikipedia.org

1) Create the rootNode - set its x and y according to the startPoint - set its parent to NULL - set its given cost to 0 2) Push the rootNode onto the open list 3) While the open list is not empty A) pop the node with the lowest givenCost from the open list and assign it to the currentNode B) if the currentNode’s x and y correspond to the goalPoint then goto step 4 C) foreach nearbyPoint around the currentNode a) if this nearbyPoint is in a spot that is impassible then skip to next nearbyPoint b) create the successorNode - set its x and y according to the nearbyPoint - set its parent to the currentNode - set its givenCost to currentNode’s givenCost + cost of going from currentNode to successorNode c) if a node for this nearbyPoint has been created before then if successorNode is better than oldNode then pop the oldNode and delete it else skip to next nearbyPoint D) push the currentNode onto the closed list 4) If the while loop exits without finding the goal, goalPoint must be unreachable