Applying Blackboard Systems to First Person Shooters Jeff Orkin Monolith Productions

Slides:



Advertisements
Similar presentations
The Halo 2 AI In 10 Minutes or Less Damián Isla Bungie Studios
Advertisements

Chapter 09 AI techniques in different game genres (Puzzle/Card/Shooting)
An Introduction to Knowledge Representation Damián Isla, Naimad Games Peter Gorniak, Rockstar.
Object Persistence for Synthetic Characters Damian Isla Bungie Studios Microsoft Corp. Bruce Blumberg Synthetic Characters MIT Media Lab.
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.
Heuristic Search techniques
ARCHITECTURES FOR ARTIFICIAL INTELLIGENCE SYSTEMS
The Zebra Striped Network File System Presentation by Joseph Thompson.
CS 61B Data Structures and Programming Methodology July 31, 2008 David Sun.
Artificial Intelligence in Game Design Intelligent Decision Making and Decision Trees.
Software Engineering and Design Principles Chapter 1.
A Behavioral Pattern. Problem: Simple enough right? Object.
A Summary of the Article “Intelligence Without Representation” by Rodney A. Brooks (1987) Presented by Dain Finn.
S.R.F.E.R.S. State, Regional, and Federal Enterprise Retrieval System Inter-Agency & Inter-State Integration Using GJXML.
RED DEAD REVOLVER Artificial Intelligence Critique By Mitchell C. Dodes CIS 588.
SOS OOP Fall 2001 Object Oriented Programming in Java Week 1 Read a design Design a small program Extract a design Run a VAJ program Change that program,
1 Data Structures Data Structures Topic #2. 2 Today’s Agenda Data Abstraction –Given what we talked about last time, we need to step through an example.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
INTRODUCTION TO SCRATCH. About Me Resources Scratch Website Learn Scratch Washington-Lee Computer.
Xavier Otero Keil.  Animation  Control characters body  makes sure that animation fits situation  handles requests to perform actions  Combat  Possibly.
Toward Real-Time Planning in Games Jeff Orkin Monolith Productions.
Fuzzy control of a mobile robot Implementation using a MATLAB-based rapid prototyping system.
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.
Creating A 3-D Game With Spark Engine Lauren Bissett, Dan Maguire, and Nicholas Woodfield.
1 CMPT 275 High Level Design Phase Architecture. Janice Regan, Objectives of Design  The design phase takes the results of the requirements analysis.
Robotica Lecture 3. 2 Robot Control Robot control is the mean by which the sensing and action of a robot are coordinated The infinitely many possible.
Agent Architecture Considerations for Real-Time Planning in Games Jeff Orkin Monolith Productions.
Introduction GAM 376 Robin Burke Winter Outline Introductions Syllabus.
Survey of AI for games. AI vs. AI for games Traditional AI: – Made to handle unseen inputs, large state space – Too many options possible to compute an.
Computer Science CPSC 322 Lecture 3 AI Applications 1.
1 CO Games Development 1 Week 6 Introduction To Pathfinding + Crash and Turn + Breadth-first Search Gareth Bellaby.
“Low Level” Intelligence for “Low Level” Character Animation Damián Isla Bungie Studios Microsoft Corp. Bruce Blumberg Synthetic Characters MIT Media Lab.
Chapter 17 GRASP: Designing Objects with Responsibilities. 1CS6359 Fall 2011 John Cole.
August 31, 2005 Game Developer Conference Europe Killzone’s AI: Dynamic Procedural Tactics Guerrilla Games - 1 Killzone’s AI: Dynamic Procedural Tactics.
Robotica Lecture 3. 2 Robot Control Robot control is the mean by which the sensing and action of a robot are coordinated The infinitely many possible.
1 CS 350 Data Structures Chaminade University of Honolulu.
GRASP: Designing Objects with Responsibilities
Motion Planning in Games Mark Overmars Utrecht University.
Qualitative Spatial Analysis Chris Mansley. Qualitative Quantitative items are known, definable quantities (x,y) coordinates Remaining health Location.
Jumping, Climbing, and Tactical Reasoning Section 2.5 Tom Schaible CSE 497 – AI & Game Programming.
Game Programming Patterns Event Queue From the book by Robert Nystrom
“The perfect project plan is possible if one first documents a list of all the unknowns.” Bill Langley.
Autonomous AI Steve Hookway 9/13/04. Outline Constraining Autonomous Behavior (3.1) Simple Techniques for Coordinated Behavior (3.2) Synthetic Adversaries.
8:15 AM Tuesday September 15, 2009 Karl Frank, Point of Contact for Constellation Projects Validating Integration Requirements Diagrams for illustrative.
Games Development 2 Overview & Entity IDs and Communication CO3301 Week 1.
6.5 Implementing a State Machine Language. State Machine in game AI The most used software pattern Simple to program Easy to comprehend Easy to debug.
3 States and a Plan: The AI of F.E.A.R. Jeff Orkin Monolith Productions/ MIT Media Lab.
F.E.A.R. Game AI Evaluation by Robert Rak. What is F.E.A.R. ? FEAR is a First Person Shooter game Player takes on the role of an elite strike force team.
Lesson 2: Reading a program. Remember: from yesterday We learned about… Precise language is needed to program Actors and Classes Methods – step by step.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
More on OO Programming Our programs will no longer just be a main method or a main which calls a collection of other methods –instead, a program will be.
Software Engineering Principles Practical Advice and Steps for Managing Your Project.
1 DIG 3134 Lecture 6: Maintaining State Michael Moshell University of Central Florida Media Software Design.
Week 9, Day 2 Object-oriented Design Acknowledgement: These slides by Dr. Hasker SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors:
CS162 - Topic #10 Lecture: Recursion –The Nature of Recursion –Tracing a Recursive Function –Work through Examples of Recursion Programming Project –Discuss.
Pirates & Ninjas. P&N: Plan Project summary Architecture User Interface World Creation (town) World Content Creation Game Play Artificial Intelligence.
Finite State Machines Logical and Artificial Intelligence in Games Lecture 3a.
Lecture 6: Basic Entities TEALS MINECRAFT PROJECT.
/16 Final Project Report By Facializer Team Final Project Report Eagle, Leo, Bessie, Five, Evan Dan, Kyle, Ben, Caleb.
Goal-Oriented Game AI Purpose and Utilizations Research Organized by: Evan Schipellite.
Team Member AI in an FPS and Goal Oriented Action Planning.
Flexible and Purposeful NPC Behaviors using Real-Time Genetic Control
Applying the Principles
Simple Techniques for Coordinated Behavior
3D Game Development Time and game loop Jernej Vičič.
Introduction to Design Patterns
Applying Use Cases (Chapters 25,26)
Unity Game Development
Presentation transcript:

Applying Blackboard Systems to First Person Shooters Jeff Orkin Monolith Productions

No One Lives Forever 2: A Spy in H.A.R.M.’s Way aka NOLF2 A.I. Systems re-used: – TRON 2.0 – Contract J.A.C.K.

No One Lives Forever 2: A Spy in H.A.R.M.’s Way

Agenda Blackboards are wicked cool. What is a blackboard? Inter-agent coordination Intra-agent coordination

What if there was an architecture that… …was simple to implement. …was flexible & maintainable. …handled coordinated behavior: – Coordinated timing of behaviors. – Coordinated pathfinding. – Coordinated tactics.

But wait! There’s more! …simplifies agent architecture. …reduces code bloat. …facilitates AI LOD system. …facilitates variations, re-use, and sharing. …allows complex reasoning.

Blackboards: the magical animal Homer: “What about bacon?” Lisa: “No!” Homer: “Ham?” Lisa: “No!” Homer: “Pork chops?!?” Lisa: “Dad! Those all come from the same animal!” Homer: “Yeah right Lisa. A wonderful magical animal.”

What is a blackboard?

A blackboard is a metaphor Physical blackboard – Publicly read/writeable. – Possibly organized. Maybe more like a bulletin board – Post requests and information. – Respond to items of interest.

A blackboard is shared memory Read/write memory Working memory Like a hard-drive Like a database No processing (other than sorting)

A blackboard is a means of communication Centralized communication Agents communicate Sub-systems of an agent communicate

A blackboard is an architecture Changes how agents and/or sub-systems interact Like an interface Reduces coupling of sub-systems

Blackboard implementation There’s no wrong way to eat a blackboard. Two flavors: – Static – Dynamic

Static blackboards class CBlackboard { private: Vectorm_vPos; Vectorm_vVelocity; intm_nHealth; // etc… public: // access functions… };

Static blackboards (cont.) Predetermined data to share. Static amount of data. Best for intra-agent coordination.

Dynamic blackboards struct BBRECORD { … }; typedef std::vector BBRECORD_LIST; class CBlackboard { private: BBRECORD_LISTm_lstBBRecords; public: // query functions… };

Dynamic blackboards (cont.) struct BBRECORD { ENUM_BBRECORD_TYPEeType; HANDLEhSubject; HANDLEhTarget; floatfData; };

Dynamic blackboards (cont.) enum ENUM_BBRECORD_TYPE { kBB_Invalid = -1, kBB_Attacking, kBB_Crouching, kBB_NextDisappearTime, kBB_ReservedVolume, // etc… };

Dynamic blackboards (cont.) // query functions int CountRecords( ENUM_BBRECORD_TYPE eType ); int CountRecords( ENUM_BBRECORD_TYPE eType, HANDLE hTarget ); floatGetRecordData( ENUM_BBRECORD_TYPE eType ); floatGetRecordData( ENUM_BBRECORD_TYPE eType, HANDLE hTarget );

Dynamic blackboards (cont.) Data to share is not predetermined. Dynamic amount of data. Best for inter-agent coordination. Also useful for intra-agent complex reasoning.

Inter-agent Coordination Using a blackboard to solve coordination problems on NOLF2.

Inter-agent Coordination Problems 1. Agents doing the same thing at the same time. 2. Agents doing things too often. 3. Special constraints for tactics. 4. Agents take same paths. 5. Agents clump at destinations.

NOLF2 Blackboard Add Records: – Enumerated type – Subject ID – Optional Target ID – Optional float data Remove Records: – Specific by type and Subject ID – All by type Replace Records

NOLF2 Blackboard (cont.) Query: – Count matching records – Retrieve data from matching records

Problem #1: Agents doing same thing at same time Examples: Soldiers Crouching – Random chance of crouch – Dodge roll into crouch – Crouch to get out of firing line Ninja Lunging

Blackboard Solution: Agents doing same thing at same time Should I crouch? if( g_pAIBB->CountRecords( kBB_Crouching ) == 0 ) { // Crouch… g_pAIBB->AddRecord( kBB_Crouching, m_hObject ); }

Problem #2: Agents doing things too often Examples: Soldiers going Prone Ninja Disappear-Reappear Combat/Search sounds

Blackboard Solution: Agents doing things too often Should I go prone? if( fCurTime > g_pAIBB->GetRecordFloat( kBB_NextProneTime ) ) { // Go prone… g_pAIBB->ReplaceRecord( kBB_NextProneTime, m_hObject, fCurTime + fDelay ); }

Problem #3: Tactical behavior has special constraints Example: Ninja only attacks from a rooftop if two other ninja are already attacking on ground, and no one is on a roof.

Blackboard Solution: Tactical behavior has special constraints Should I attack from the roof? if( g_pAIBB->CountRecords( kBB_AttackingRoof, m_hTarget ) > 0 ) { return false; }

Blackboard Solution: Tactical behavior has special constraints (cont.) if( g_pAIBB->CountRecords( kBB_Attacking, m_hTarget ) < 2 ) { return false; } // Attack from the roof… g_pAIBB->AddRecord( kBB_Attacking, m_hObject, m_hTarget ); g_pAIBB->AddRecord( kBB_AttackingRoof, m_hObject, m_hTarget );

Problem #4: Agents take same paths Example: Player runs around the corner, and characters follow in a congo line and get killed one by one.

Problem #4: Agents take same paths (cont.) NOLF2 AIVolume system:

Problem #4: Agents take same paths (cont.) NOLF2 AIVolume system:

Problem #4: Agents take same paths (cont.) NOLF2 AIVolume system:

Problem #4: Agents take same paths (cont.) NOLF2 AIVolume system:

Problem #4: Agents take same paths (cont.) NOLF2 AIVolume system:

Blackboard Solution: Agents take same paths Volume reservation system: Reserve the Volume before the destination. Reserved Volume Cost == Cost + 500

Blackboard Solution: Agents take same paths (cont.) Volume reservation system:

Blackboard Solution: Agents take same paths (cont.) Volume reservation system:

Blackboard Solution: Agents take same paths (cont.) Volume reservation system:

Blackboard Solution: Agents take same paths (cont.) // Pathfinding if( g_pAIBB->CountRecords( kBB_ReservedVolume, hVolume ) > 0 ) { fNodeCost += 500.f; }

Blackboard Solution: Agents take same paths (cont.) // Movement g_pAIBB->RemoveRecord( kBB_ReservedVolume, m_hObject ); g_pAIBB->AddRecord( kBB_ReservedVolume, m_hObject, hVolume );

Problem #5: Agents crowd at destination Examples: Player knocks over a bottle. Characters converge on bottle position. Characters discover dead body and converge.

Blackboard Solution: Agents crowd at destination First agent claims volume for investigation. Other agents stop at edge of volume.

Blackboard Solution: Agents crowd at destination (cont.)

// AI reached the dest volume first. if( g_pAIBB->CountRecords( kBB_InvestigatingVolume, hVolume ) == 0 ) { g_pAIBB->AddRecord( kBB_InvestigatingVolume, m_hObject ); } // AI did not reach the dest volume first. else { // Look at dest. }

Einstein says… “Hang in there, we’re half-way done!”

Why use blackboards??

“Less is more”: Less to debug Less to maintain Less to port Less to compile Less to document Less to learn Less data (per volume)

Why use blackboards?? Decouple data from game-specific purpose: Designs change Re-use systems in other games (other genres?) OO design is not always the right choice.

What about performance?! Problem: Pathfinder needs to look up Volume Reservation status every iteration thru A*.

What about performance?! (cont.) Solution: A* flags array char astarFlags[NUM_VOLUMES]; enum ASTAR_FLAGS { kNone= 0x00, kOpen= 0x01, kClosed= 0x02, };

What about performance?! (cont.) Solution: A* flags array char astarFlags[NUM_VOLUMES]; enum ASTAR_FLAGS { kNone= 0x00, kOpen= 0x01, kClosed= 0x02, kReserved = 0x04, };

What about performance?! (cont.) RunAStar() { ClearFlags(); Search(); }

What about performance?! (cont.) RunAStar() { ClearFlags(); MarkReserved(); Search(); }

Intra-agent Coordination

A character is an entire world. Sub-systems are characters in the world. – Navigation – Movement – Target/Attention selection – Senses – Animation – Weapons – Decision-Making

NOLF2 Agent Architecture

Blackboard Agent Architecture

class AgentBlackBoard { private: Vectorm_vDest; NAV_STATUSm_eNavStatus; HANDLEm_hTarget; AISensesm_aSenses[MAX_SENSES]; // etc… public: // Access functions… }

Benefits of Decoupling Sub-systems Benefits of Decoupling: 1. Development/Maintenance 2. Flexibility 3. Performance

Benefit #1: Development/Maintenance Benefits Problem: Difficult to upgrade or replace old systems. Example: Re-writing navigation system

Benefit #1: Development/Maintenance (cont.) Various calls to sub-system: pAI->GetPathManager()->SetPath(vDest); pAI->GetPathManager()->UpdatePath(); if( pAI->GetPathManager()->IsPathDone() )... AIVolume* GetNextVolume(AIVolume* pVolume, AIVolume::EnumVolumeType eVolumeType);

Benefit #2: Flexibility Problem: Different characters have different needs. Example: Humans plan paths to a dest. Rats and Rabbits wander randomly to a dest.

Benefit #2: Flexibility (cont.) Example (cont.): AIStatePatrol::Update( AI* pAI ) { pAI->GetPathManager()->SetPath(vDest); if( pAI->GetPathManager()->IsPathComplete() ) { // etc… }

Benefit #2: Flexibility (cont.) Blackboard Solution: AIStatePatrol::Update( AI* pAI ) { pAI->GetAIBlackboard()->SetDest(vDest); if( pAI->GetAIBlackboard()->GetNavStatus() == kNavStatus_Done ) { // etc… }

Benefit #2: Flexibility (cont.) Example: Humans need a lot of sensory information to make complex goal-based decisions. Rats and Rabbits need very little info for simplistic behavior.

Benefit #2: Flexibility (cont.)

Benefit #3: Performance Problem: All characters in NOLF2 are active all of the time, regardless of player location. Example: Characters are pathfinding, moving, animating, and sensing as they work at desks, go to the bathroom, etc.

Benefit #3: Performance (cont.) Blackboard Solution: Sub-systems communicate through the blackboard. LOD system swaps sub-systems behind the scenes.

Benefit #3: Performance (cont.) LOD 5:

Benefit #3: Performance (cont.) LOD 5:

Benefit #3: Performance (cont.) LOD 5:

Benefit #3: Performance (cont.) LOD 2:

Benefit #3: Performance (cont.) LOD 2:

Don’t run away… We’re almost done!

Intra-agent Dynamic Blackboard MIT Media Lab Synthetic Characters Group C4 GDC 2001 Creature Smarts: The Art and Architecture of the Virtual Brain

Intra-agent Dynamic Blackboard (cont.)

Percept Memory Records: Only form of knowledge representation. – Game objects (characters, objects of interest, etc) – Desires – Damage – AI hints (AINodes, AIVolumes) – Tasks Can group multiple records for same object.

Intra-agent Dynamic Blackboard (cont.) Benefits: Keep track of multiple types of information in a consistent way. Open-ended architecture: different games may use different data in different ways. Complex reasoning.

Intra-agent Dynamic Blackboard: Complex Reasoning Queries: “Is there food near me?” Find the “red object that is making the most noise.” “Find an object that is humanoid-shaped and go to it.”

Intra-agent Dynamic Blackboard: Complex Reasoning (cont.) Spatial Reasoning: Agent is more alarmed if multiple disturbances are found near each other.

Intra-agent Dynamic Blackboard: Complex Reasoning (cont.) Temporal Reasoning: Anticipation and surprise.

Intra-agent Dynamic Blackboard: Complex Reasoning (cont.) Deductive Reasoning: Agent sees dead body. Agent sees player with a gun. Agent draws the conclusion that the player was the killer.

Intra-agent Dynamic Blackboard: Complex Reasoning (cont.) Multi-tasking: Agent targets enemyA. Agent targets enemyB. Agent kills enemyB. Agent is aware that he was also fighting enemyA.

Take-away Use blackboard systems! – Less is more. – Decouple your data from its game-specific purpose. – Decouple your subsystems.

More Information December 2003: AI Game Programming Wisdom 2 “Simple Techniques for Coordinated Behavior”

More Information NOLF2 Source, Toolkit & SDK: ( AICentralKnowledgeMgr == Blackboard ) Slides:

Questions? NOLF2 Source, Toolkit & SDK: ( AICentralKnowledgeMgr == Blackboard ) Slides: