Chapter 1 Introduction to Game AI April 11, 2013 1.

Slides:



Advertisements
Similar presentations
Approaches, Tools, and Applications Islam A. El-Shaarawy Shoubra Faculty of Eng.
Advertisements

Chapter 09 AI techniques in different game genres (Puzzle/Card/Shooting)
Chasing, Evading, Intercepting, Pattern Movements
7.2. AI E NGINE AND S TEERING B EHAVIOUR I Design of an AI Engine and introduction to steering in game AI.
7.1. O SCARS & A RTIFICIAL I NTELLIGENCE Interim awards and introduction to game AI.
AI Pathfinding Representing the Search Space
Tetris – Genetic Algorithm Presented by, Jeethan & Jun.
Flocking and more.  NPC groups can move in cohesive groups not just independently ◦ Meadow of sheep grazing? ◦ Hunting flock of birds? ◦ Ants? Bees?
Pathfinding Basic Methods.
Steering Behaviors GAM 376 Robin Burke Winter 2008.
CSE 380 – Computer Game Programming Pathfinding AI
Better Group Behaviors in Complex Environments using Global Roadmaps O. Burchan Bayazit, Jyh-Ming Lien and Nancy M. Amato Presented by Mohammad Irfan Rafiq.
1 CO Games Development 2 Week 22 Flocking Gareth Bellaby.
OBJECT-ORIENTED THINKING CHAPTER Topics  The Object-Oriented Metaphor  Object-Oriented Flocks of Birds –Boids by Craig W. Reynolds  Modularity.
Optimizing Flocking Controllers using Gradient Descent
Florian Klein Flocking Cooperation with Limited Communication in Mobile Networks.
Behavioral Animation Procedural Animation Type?. Behavioral Animation Introduced by C. Reynolds (1987) Animating many things at one time –A group of the.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Dynamic Path Planning, Flocking Spring 2012.
Artificial Intelligence in Game Design Intelligent Decision Making and Decision Trees.
Artificial Intelligence in Game Design Introduction to Learning.
1 Reactive Pedestrian Path Following from Examples Ronald A. Metoyer Jessica K. Hodgins Presented by Stephen Allen.
1 AI for Computer Game Developers Finite state machines Path finding and waypoints A-Star path finding.
Soul Envoy Final Year Project 22nd April 2006 By Zhu Jinhao.
John S Gero Agents – Agent Simulations AGENT-BASED SIMULATIONS.
CS 4730 Game AI CS 4730 – Computer Game Design Some slides courtesy Tiffany Barnes, NCSU.
Better Group Behaviors in Complex Environments using Global Roadmaps O. Burchan Bayazit, Jyh-Ming Lien and Nancy M. Amato Andreas Edlund.
Using a GA to Create Prey Tactics Presented by Tony Morelli on 11/29/04.
And Just Games etc.. EVOLUTION OF COMPUTER GAMES PongOdyssey Beginning of the use of microprocessors ATARI VCS system bit.
Artificial Intelligence in Game Design Probabilistic Finite State Machines.
Artificial Intelligence CSE 191A: Seminar on Video Game Programming Lecture 7: Artificial Intelligence UCSD, Spring, 2003 Instructor: Steve Rotenberg.
CS274 Spring 01 Lecture 5 Copyright © Mark Meyer Lecture V Higher Level Motion Control CS274: Computer Animation and Simulation.
Real-time Crowd Movement On Large Scale Terrains Speaker: Alvin Date:4/26/2004From:TPCG03.
Steering Behaviors For Autonomous Characters
Yingcai Xiao Artificial Intelligence in Game Development Yingcai Xiao.
Artificial Intelligence in Game Design Problems and Goals.
Game AI Fundamentals. What is Artificial Intelligence (AI)? Not easy to answer… “Ability of a computer or other machine to perform those activities that.
Developing the Game Functionality Lesson 6. Exam Objective Matrix Skills/ConceptsMTA Exam Objectives Programming the Components Understand Components.
Flow Fields Hao Li and Howard Hamilton. Motivation for Flow Fields Multiple AI algorithms in a computer game can produce conflicting results. The AI must.
Artificial Intelligence in Game Design
For games. 1. Control  Controllers for robotic applications.  Robot’s sensory system provides inputs and output sends the responses to the robot’s motor.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Event Driven Programming, The.
CSE 380 – Computer Game Programming Artificial Intelligence Murloc, Blizzard Entertainment.
AI in Computer Gaming: The first person shooter Tyler Hulburd.
Exploring Complex Systems through Games and Computer Models Santa Fe Institute – Project GUTS
Machine Learning for an Artificial Intelligence Playing Tic-Tac-Toe Computer Systems Lab 2005 By Rachel Miller.
Chasing, Evading, Intercepting, Pattern Movements
Controlling the Behavior of Swarm Systems Zachary Kurtz CMSC 601, 5/4/
1 AI and Game Programming CIS 487/587 Bruce R. Maxim UM-Dearborn.
Computational theory techniques in interactive video games.
Intelligent Database Systems Lab 國立雲林科技大學 National Yunlin University of Science and Technology 1 Evolving Reactive NPCs for the Real-Time Simulation Game.
School of Systems, Engineering, University of Reading rkala.99k.org April, 2013 Motion Planning for Multiple Autonomous Vehicles Rahul Kala Conclusions.
REFERENCES: FLOCKING.
Decision Making Under Uncertainty - Bayesian Techniques.
Artificial Intelligence in Game Design Influence Maps and Decision Making.
Pedagogical Possibilities for the 2048 Puzzle Game Todd W. Neller.
CSCI 4310 Lecture 5: Steering Behaviors in Raven.
Evolutionary Computing Systems Lab (ECSL), University of Nevada, Reno 1 Authors : Siming Liu, Christopher Ballinger, Sushil Louis
11/13/03CS679 - Fall Copyright Univ. of Wisconsin Last Time A* Improvements Hierarchical planning Pre-Planning.
The Game Development Process: Artificial Intelligence.
Students: Yossi Turgeman Avi Deri Self-Stabilizing and Efficient Robust Uncertainty Management Instructor: Prof Michel Segal.
Review IMGD Engine Architecture Types Broadly, what are the two architecture types discussed for game engines? What are the differences?
Bbm421 – Computer Games Technology
Modelling and Simulating Social Systems with MATLAB
Enemy and Friendly AIs Richard Gesick.
CIS 488/588 Bruce R. Maxim UM-Dearborn
Motion Planning for Multiple Autonomous Vehicles
CIS 488/588 Bruce R. Maxim UM-Dearborn
CIS 488/588 Bruce R. Maxim UM-Dearborn
Interaction with artificial intelligence in games
Genetic Algorithm Soft Computing: use of inexact t solution to compute hard task problems. Soft computing tolerant of imprecision, uncertainty, partial.
Presentation transcript:

Chapter 1 Introduction to Game AI April 11,

Defining AI “The ability of a computer or other machine to perform those activities that are normally thought to require intelligence”. Game AI techniques : deterministic and nondeterministic –Deterministic behavior or performance is specified and predictable –Nondeterministic behavior is the opposite of deterministic behavior. Behavior has a degree of uncertainty and is somewhat unpredictable 2

Established Game AI Cheating Finite state machines Fuzzy logic Effective and efficient pathfinding Scripting, rules-based system 3

The future The game should evolve, learn, and adapt the more it's played Decision trees, neural networks, genetic algorithms, and probabilistic methods 4

Chapter 2 Chasing and Evading 5

Application A spaceship shooter, a strategy simulation, or a role-playing game, video. Make your game's non-player characters (NPC) either chase down or run from your player character 6

Outline Basic Chasing and Evading Line-of-Sight Chasing Line-of-Sight Chasing in Tiled Environments Line-of-Sight Chasing in Continuous Environments Intercepting 7

Basic Chasing if (predatorX > preyX) predatorX--; else if (predatorX < preyX) predatorX++; if (predatorY > preyY) predatorY--; else if (predatorY < preyY) predatorY++; 8

Basic Evading if (predatorX > preyX) predatorX++; else if (predatorX < preyX) predatorX--; if (predatorY > preyY) predatorY++; else if (predatorY < preyY) predatorY--; 9

Basic tile-based chase example if (predatorCol > preyCol) predatorCol--; else if (predatorCol < preyCol) predatorCol++; if (predatorRow> preyRow) predatorRow--; else if (predatorRow<preyRow) predatorRow++; 10

Basic tile-based chase 11

Line-of-Sight Chasing 12

Bresenham's algorithm One of the more efficient methods for drawing a line in a pixel-based environment 13

14

Line-of-Sight Chasing in Continuous Environments game entities—airplanes, spaceships, hovercraft, etc.—are driven by applied forces and torques. Physics for Game Developers (O'Reilly). The player controls his vehicle by applying thrust for forward motion and steering forces for turning. 15

u = VRotate2D(-Predator.fOrientation, (Prey.vPosition - Predator.vPosition)); u.Normalize(); if (u.x < -_TOL) left = true; else if (u.x > _TOL) right = true; Predator.SetThrusters(left, right); 16

Global & Local Coordinate Systems 17

Steering force test 18

Intercepting 19

DoIntercept Vr = Prey.vVelocity - Predator.vVelocity; Sr = Prey.vPosition - Predator.vPosition; tc = Sr.Magnitude() / Vr.Magnitude(); St = Prey.vPosition + (Prey.vVelocity * tc); 20

21

22

General Considerations This function should be called every time through the game loop or physics engine loop so that the predator constantly updates the predicted interception point and its own trajectory 23

General Considerations Sometimes interceptions are not possible For example, if the predator is slower than the prey and if the predator somehow ends up behind the prey 24

3. Pattern Movement 25

Pattern Movement The NPCs move according to some predefined pattern that makes it appear as though they are performing complex Takes the desired pattern and encodes the control data into an array or set of arrays 26

Control instructions ControlData { double turnRight; double turnLeft; double stepForward; double stepBackward; }; 27

Pattern initialization Pattern[0].turnRight = 0; Pattern[0].turnLeft = 0; Pattern[0].stepForward = 2; Pattern[0].stepBackward = 0; Pattern[1].turnRight = 0; Pattern[1].turnLeft = 0; Pattern[1].stepForward = 2; Pattern[1].stepBackward = 0; Pattern[2].turnRight = 10; Pattern[2].turnLeft = 0; Pattern[2].stepForward = 0; Pattern[2].stepBackward = 0; Pattern[3].turnRight = 10; Pattern[3].turnLeft = 0; Pattern[3].stepForward = 0; Pattern[3].stepBackward = 0; Pattern[4].turnRight = 0; Pattern[4].turnLeft = 0; Pattern[4].stepForward = 2; Pattern[4].stepBackward = 0; Pattern[5].turnRight = 0; Pattern[5].turnLeft = 0; Pattern[5].stepForward = 2; Pattern[5].stepBackward = 0; Pattern[6].turnRight = 0; Pattern[6].turnLeft = 10; Pattern[6].stepForward = 0; Pattern[6].stepBackward = 0; … 28

Pattern Movement in Tiled Environments Paths will be made up of line segments. Each new segment will begin where the previous one ended. 29

Rectangular pattern movement 30

entityList[1].InitializePathArrays(); entityList[1].BuildPathSegment(10, 3, 18, 3); entityList[1].BuildPathSegment(18, 3, 18, 12); entityList[1].BuildPathSegment(18, 12, 10, 12); entityList[1].BuildPathSegment(10, 12, 10, 3); entityList[1].NormalizePattern(); entityList[1].patternRowOffset = 5; entityList[1].patternColOffset = 2; 31

Complex tile pattern movement 32

Track pattern movement (add random factor) 33

Pattern Movement in Physically Simulated Environments Isn't conducive to forcing a physically simulated object to follow a specific pattern of movement Apply appropriate control forces to the object to coax it Your input in the form of steering forces and thrust modulation, for example, is processed by the physics engine 34

Control Structures struct ControlData { bool PThrusterActive; bool SThrusterActive; double dHeadingLimit; double dPositionLimit; bool LimitHeadingChange; bool LimitPositionChange; }; 35

Square path 36

Zigzag path 37

4. Flocking 38

Flocking Often in video games, NPC must move in cohesive groups rather than independently. Craig Reynolds,1987, "Flocks, Herds, and Schools: A Distributed Behavioral Model." Collective Intelligence 39

Classic Flocking Cohesion –Have each unit steer toward the average position of its neighbors. Alignment –Have each unit steer so as to align itself to the average heading of its neighbors. Separation –Have each unit steer to avoid hitting its neighbors. 40

Aware of neighbors Each unit is aware of its local surroundings It knows the average location, heading, and separation between it and the other units in the group in its immediate vicinity. 41

Neighbors 42

Wide versus narrow field-of-view flock formations 43

Flocking Example we're going to treat each unit as a rigid body and apply a net steering force at the front end of the unit. This net steering force will point in either the starboard or port direction relative to the unit Will be the accumulation of steering forces determined by application of each flocking rule 44

Cohesion 45

Alignment each unit should steer so as to try to assume a heading equal to the average heading of its neighbors 46

Separation 47

Obstacle Avoidance The units to see ahead of them and then apply appropriate steering forces to avoid obstacles in their paths 48

Follow the Leader Follow-the-leader rule Let some simple rules sort out who should be or could be a leader Not leaving the flock leaderless in the event the leader gets destroyed or somehow separated from his flock Add other AI to the leaders to make their leading even more intelligent 49

5. Potential Function-Based Movement 50

How Can You Use Potential Functions for Game AI? Calculate the force between the two units—the computer-controlled unit and the player in this case Then apply that force to the front end of the computer-controlled unit, where it essentially acts as a steering force 51

Lenard-Jones Potential Function 52

Chasing/Evading Use the potential function to calculate the force of attraction (or repulsion) between the two units, applying the result as a steering force to the computer-controlled unit 53

Potential chase and evade (A) (B) A  (C) A  (D) B  54

Obstacle Avoidance we set the A parameter, the attraction strength, to 0 to leave only the repulsion component. We then can play with the B parameter to adjust the strength of the repulsive force and the m exponent to adjust the attenuation 55

Obstacle Avoidance 56

Swarming calculate the Lenard-Jones force between each unit in the swarm 57

Optimization Suggestions Complexity: N 2 not perform the force calculation for objects that are too far away from the unit to have any influence on it divide your game domain into a grid containing cells of some prescribed size. –perform calculations only between the unit and those obstacles contained within that cell and the immediately adjacent cells 58

6. Basic Pathfinding and Waypoints 59

Basic Pathfinding Chapter 2 60

Obstacle Avoidance Random Movement Obstacle Avoidance –works particularly well in an environment with relatively few obstacles 61

6.2.2 Tracing Around Obstacles 62

63

6.2 Breadcrumb Pathfinding 64

65

66

6.3 Path Following 67

68

69

6.4 Wall Tracing 70

71

6.5 Waypoint Navigation 72

73

74

75