15-466 Computer Game Programming Intelligence I: Basic Decision-Making Mechanisms



Similar documents
CHAPTER 18 Programming Your App to Make Decisions: Conditional Blocks

Using Emergent Behavior to Improve AI in Video Games

Operating Systems. Virtual Memory

S. Muthusundari. Research Scholar, Dept of CSE, Sathyabama University Chennai, India Dr. R. M.

Sequential lmove Games. Using Backward Induction (Rollback) to Find Equilibrium

DM810 Computer Game Programming II: AI. Lecture 11. Decision Making. Marco Chiarandini

Developing an Artificial Intelligence Engine

Industrial Adoption of Automatically Extracted GUI Models for Testing

Big Data and Scripting. Part 4: Memory Hierarchies

Introduction to Learning & Decision Trees

OnGuard Online User Guide

BSc in Artificial Intelligence and Computer Science ABDAL MOHAMED

A flowchart is not a state machine

Operating Systems CSE 410, Spring File Management. Stephen Wagner Michigan State University

One pile, two pile, three piles

Programming Your App to Make Decisions: Conditional Blocks

SYSM 6304: Risk and Decision Analysis Lecture 5: Methods of Risk Analysis

The Taxman Game. Robert K. Moniot September 5, 2003

Binary Search Trees (BST)

Scheduling Home Health Care with Separating Benders Cuts in Decision Diagrams

M-way Trees and B-Trees

Outline: Operating Systems

Bachelor of Games and Virtual Worlds (Programming) Subject and Course Summaries

Java (12 Weeks) Introduction to Java Programming Language

Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R

Memory Allocation. Static Allocation. Dynamic Allocation. Memory Management. Dynamic Allocation. Dynamic Storage Allocation

Chapter 5. Regression Testing of Web-Components

Capturing Material. Section 3

Introduction to Machine Learning and Data Mining. Prof. Dr. Igor Trajkovski

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

Automatic Gameplay Testing for Message Passing Architectures

NATIONAL: THE GOOD AND MOSTLY BAD OF ARTIFICIAL INTELLIGENCE

Classifying Large Data Sets Using SVMs with Hierarchical Clusters. Presented by :Limou Wang

Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition

Distributed Version Control

Lottery Looper. User Manual

Access Tutorial 13: Event-Driven Programming Using Macros

1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D.

Better Business Analytics with Powerful Business Intelligence Tools

Offline 1-Minesweeper is NP-complete

Learning Object-Oriented Design by Creating Games 1

Course 395: Machine Learning

game development documentation game development documentation: concept document

Using Neural Networks to Control Agent Threat Response

Mathematical Induction

Formal Engineering for Industrial Software Development

ECON Game Theory Exam 1 - Answer Key. 4) All exams must be turned in by 1:45 pm. No extensions will be granted.

!"!!"#$$%&'()*+$(,%!"#$%$&'()*""%(+,'-*&./#-$&'(-&(0*".$#-$1"(2&."3$'45"

DATA STRUCTURES USING C

Lab Rat. Prototype Productions. Tech: Sean Halloran sjhalloran Art: Shane Stenson sjstenson Tech: Lindsay O Donnell lrodonnell

npsolver A SAT Based Solver for Optimization Problems

AI: A Modern Approach, Chpts. 3-4 Russell and Norvig

Book Review of Rosenhouse, The Monty Hall Problem. Leslie Burkholder 1

Probabilities. Probability of a event. From Random Variables to Events. From Random Variables to Events. Probability Theory I

Sources: On the Web: Slides will be available on:

Sense Making in an IOT World: Sensor Data Analysis with Deep Learning

Overview. Swarms in nature. Fish, birds, ants, termites, Introduction to swarm intelligence principles Particle Swarm Optimization (PSO)

Easy Casino Profits. Congratulations!!


Dr. Pat Mirenda. Software Design Specification Document

Temporal Logics. Computation Tree Logic

Classification/Decision Trees (II)

F-Secure Mobile Security for Business. Getting Started Guide

Static Analysis of Virtualization- Obfuscated Binaries

Summit Public Schools Summit, New Jersey Grade Level / Content Area: Mathematics Length of Course: 1 Academic Year Curriculum: AP Computer Science A

SD Memory Card Recorder Instructions. ver

Decision Trees from large Databases: SLIQ

Lecture 10: Regression Trees

1. Scope of Games and Game Systems. 2. Evolution of Current Game Designs. 3. New Game Forms Utilising New and Emerging Technical Media

CHAPTER 14 Understanding an App s Architecture

Introduction to Information Security

1. Relational database accesses data in a sequential form. (Figures 7.1, 7.2)

ROBOTRACKER A SYSTEM FOR TRACKING MULTIPLE ROBOTS IN REAL TIME. by Alex Sirota, alex@elbrus.com

CSC148 Lecture 8. Algorithm Analysis Binary Search Sorting

Tutorial: Creating Platform Games

HYBRID GENETIC ALGORITHMS FOR SCHEDULING ADVERTISEMENTS ON A WEB PAGE

Genetic programming with regular expressions

Full and Complete Binary Trees

Echidna: Efficient Clustering of Hierarchical Data for Network Traffic Analysis

M.S. Computer Science Program

CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 313]

Simulating the Structural Evolution of Software

VB.NET Programming Fundamentals

Chapter 20: Data Analysis

Decentralized Utility-based Sensor Network Design

Web Data Mining: A Case Study. Abstract. Introduction

2IOE0 Interactive Intelligent Systems

EXCEL FINANCIAL USES

Examination A0002N Safety 1

How To Use The Workstation Program On A Pc Or Mac Or Macbook Or Macintosh (Aero) With A Computer Or Ipa (A2) With An Ipa Or Ipad (A3) With The Powerpoint 2.

Web Data Extraction: 1 o Semestre 2007/2008

logic language, static/dynamic models SAT solvers Verified Software Systems 1 How can we model check of a program or system?

Transcription:

15-466 Computer Game Programming Intelligence I: Basic Decision-Making Mechanisms Maxim Likhachev Robotics Institute Carnegie Mellon University

AI Architecture from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 2

Decision-making Framework e.g., health level, availability of ammunition, e.g., attack, flee, explore the sound, e.g., map, see enemy, hear sound, from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 3

Decision-making Framework e.g., health level, availability of ammunition, e.g., attack, flee, explore the sound, e.g., map, see enemy, hear sound, Any ideas for how to implement decision-making? from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 4

Basic Decision-making Mechanisms for this Class Decision Trees Finite-state Machines Basic Behavior Trees Maxim Likhachev Carnegie Mellon University 5

Basic Decision-making Mechanisms for this Class Decision Trees Finite-state Machines Basic Behavior Trees Maxim Likhachev Carnegie Mellon University 6

Decision Trees Formalization of a set of nested if-then rules Very popular: easy-to-implement, intuitive (=easy-to-debug) and fast Require careful manual design (theoretically, learning trees is also possible) from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 7

Decision Trees Formalization of a set of nested if-then rules Very popular: easy-to-implement, intuitive (=easy-to-debug) and fast Require careful manual design (theoretically, learning trees is also possible) K-ary trees are possible but binary decision trees are much more common from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 8

Decision Trees Support for multi-valued input variables in binary decision-trees Example: Depending on the size of the enemy troops, attack, stand ground or retreat How to implement in a binary decision trees? Maxim Likhachev Carnegie Mellon University 9

Decision Trees Support for multi-valued input variables in binary decision-trees Example: Depending on the size of the enemy troops, attack, stand ground or retreat No Is N < 5? Yes No Stand Ground Is N < 2? Yes Attack N=size of the enemy troops Retreat Maxim Likhachev Carnegie Mellon University 10

Decision Trees Support for continuous input variables in binary decision-trees Example: Depending on the distance to the enemy, hand-to-hand combat, shoot, hide How to implement in a binary decision trees? Maxim Likhachev Carnegie Mellon University 11

Decision Trees Support for continuous input variables in binary decision-trees Example: Depending on the distance to the enemy, hand-to-hand combat, shoot, hide Is d < 20.0m? No No Shoot Is d < 5.0m? Yes Hand-to-hand combat Yes d=distance to enemy Hide Maxim Likhachev Carnegie Mellon University 12

Decision Trees Support for complex decision formulae Example: Attack whenever enemy is close OR (low-on-health AND not too far) Is enemy low-on-health? No No Yes Is enemy close? Yes Attack Do nothing No Is enemy too far? Yes Attack Do nothing Maxim Likhachev Carnegie Mellon University 13

Decision Trees Support for complex decision formulae Example: Attack whenever enemy is close OR (low-on-health AND not too far) Can we represent any Boolean formula with a binary decision tree? Proof? Is enemy low-on-health? No No Yes Is enemy close? Yes Attack Do nothing No Is enemy too far? Yes Attack Do nothing Maxim Likhachev Carnegie Mellon University 14

Decision Trees Support for complex decision formulae Example: Attack whenever Proof? enemy is close OR (low-on-health AND not too far) A OR (B AND C) Each row is a branch in the tree A B C Outcome 0 0 0 No 1 0 0 Yes 0 1 0 No 1 1 0 Yes True? Maxim Likhachev Carnegie Mellon University 15

Decision Trees Making the decision tree traversal fast is important Which decision tree is better for decision-making? vs. from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 16

Decision Trees Making the decision tree traversal fast is important Which decision tree is better for decision-making? What does it depend on? vs. from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 17

Decision Trees Making the decision tree traversal fast is important Which decision tree is better for decision-making? What does it depend on? vs. Frequency (probability) of outcome (e.g., what if A happens 99% of the time) The computational complexity of the test (e.g., what if testing for G is very expensive) from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 18

Decision Trees Making the decision tree traversal fast is important Merging the branches: from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 19

Decision Trees How to deal with the predictability of AI? Any ideas? Maxim Likhachev Carnegie Mellon University 20

Decision Trees How to deal with the predictability of AI? Random Decision Trees: To avoid switching every frame: use hysteresis (memory) from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 21

Basic Decision-making Mechanisms for this Class Decision Trees Finite-state Machines Basic Behavior Trees Maxim Likhachev Carnegie Mellon University 22

Finite State Machines Basic FSM Initial State from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 23

Finite State Machines Basic FSM Advantages over Decision Trees? Disadvantages over Decision Trees? from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 24

Finite State Machines Basic FSM How to introduce unpredictability? from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 25

Finite State Machines Hierarchical FSM How it changes to react to re-charge now alarm? from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 26

Finite State Machines Hierarchical FSM from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 27

Finite State Machines Hierarchical FSM What if an additional alarm? Upper bound on # of states for N alarms? from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 28

Finite State Machines Hierarchical FSM: strict hierarchy with only global alarms State: [State at Level i, State at Level 1] (for i active FSMs) All triggers get acted upon by FSM at level i Whenever FSM at Level i exits, FSM at level i-1 becomes dominant Its own FSM from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 29

Finite State Machines Hierarchical FSM: strict hierarchy with additional direct transitions Direct transitions between levels allow to leave the source state from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 30

Finite State Machines Hierarchical FSM: strict hierarchy with additional direct transitions Direct transitions between levels allow to Search leave state the is source left state When GetPower is done, Clean Up is entered from scratch from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 31

Finite State Machines Hierarchical FSM: strict hierarchy with additional direct transitions More complex example: from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 32

Finite State Machines Combining FSM and decision trees Why bother? from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 33

Basic Decision-making Mechanisms for this Class Decision Trees Finite-state Machines Basic Behavior Trees Maxim Likhachev Carnegie Mellon University 34

Basic Behavior Trees Became very popular after Halo 2 game [2004] Maxim Likhachev Carnegie Mellon University 35

Basic Behavior Trees Became very popular after Halo 2 game [2004] Especially, when coupled with graphical interfaces to edit them Screenshot of GameBrains GUI Maxim Likhachev Carnegie Mellon University 36

Basic Behavior Trees Collection of simple tasks arranged in a tree structure One of the main advantages: Tasks and sub-trees can be reused!!! Screenshot of GameBrains GUI Maxim Likhachev Carnegie Mellon University 37

Basic Behavior Trees Type of tasks: Conditions, Actions and Composites Each returning either success or failure Condition task tests for a condition Examples of behavior trees that consist of Conditions tasks only: Door open? Health level OK? Enemy close-by? Maxim Likhachev Carnegie Mellon University 38

Basic Behavior Trees Type of tasks: Conditions, Actions and Composites Each returning either success or failure Action task alters the state of the game Examples of behavior trees that consist of Actions tasks only: Move to room Find a path Play audio sound Talk to the player Maxim Likhachev Carnegie Mellon University 39

Basic Behavior Trees Type of tasks: Conditions, Actions and Composites Each returning either success or failure Condition and Action tasks are always at the leafs of the tree Composite task sequences through them Maxim Likhachev Carnegie Mellon University 40

Basic Behavior Trees Type of tasks: Conditions, Actions and Composites Each returning either success or failure Condition and Action tasks are always at the leafs of the tree Composite task sequences through them Two types of Composite tasks: Selector returns as soon as the first leaf task is successful? Attack Flee Declare defeat Maxim Likhachev Carnegie Mellon University 41

Basic Behavior Trees Type of tasks: Conditions, Actions and Composites Each returning either success or failure Condition and Action tasks are always at the leafs of the tree Composite task sequences through them Two types of Composite tasks: Selector returns as soon as the first leaf task is successful Sequencer returns as soon as the first leaf task fails? Attack Flee Declare defeat Door open? Move (into room) Maxim Likhachev Carnegie Mellon University 42

Basic Behavior Trees Type of tasks: Conditions, Actions and Composites Each returning either success or failure Condition and Action tasks are always at the leafs of the tree Composite task sequences through them Two types of Composite tasks: Selector returns as soon as the first leaf task is successful? Sequencer returns as soon as the first leaf task fails Tasks are often parameterized Attack Flee Declare defeat Door open? Move (into room) Maxim Likhachev Carnegie Mellon University 43

Basic Behavior Trees Type of tasks: Conditions, Actions and Composites Each returning either success or failure Example:? What does it do? Door open? Move (into room) Move (to door) Open door Move (into room) Maxim Likhachev Carnegie Mellon University 44

Basic Behavior Trees Type of tasks: Conditions, Actions and Composites Each returning either success or failure Example:? What does it do? Door open? Move (into room) Move (to door)? Move (into room) Door unlocked? Open door Door locked? Barge door Maxim Likhachev Carnegie Mellon University 45

Basic Behavior Trees Type of tasks: Conditions, Actions and Composites Each returning either success or failure Example:? Can the tree always be structured so that sequence and selector levels alternate? Door open? Move (into room) Move (to door)? Move (into room) Door unlocked? Open door Door locked? Barge door Maxim Likhachev Carnegie Mellon University 46

Basic Behavior Trees Type of tasks: Conditions, Actions and Composites Each returning either success or failure Example:? How to reduce predictability of the behavior? Door open? Move (into room) Move (to door)? Move (into room) Door unlocked? Open door Door locked? Barge door Maxim Likhachev Carnegie Mellon University 47

Basic Behavior Trees Behavior trees with Order Randomization for some Sequencers and Selectors Example: How to reduce predictability of the behavior? from Artificial Intelligence for Games by I. Millington & J. Funge Maxim Likhachev Carnegie Mellon University 48