0
Applying Blackboard Systems to First Person Shooters Jeff Orkin Monolith Productions http://www.jorkin.com
No One Lives Forever 2: A Spy in H.A.R.M.’s Way <ul><li>aka NOLF2 </li></ul><ul><li>A.I. Systems  </li></ul><ul><li>re-use...
No One Lives Forever 2: A Spy in H.A.R.M.’s Way
Agenda <ul><li>Blackboards are wicked cool. </li></ul><ul><li>What is a blackboard? </li></ul><ul><li>Inter -agent coordin...
What if there was an architecture that… <ul><li>…was simple to implement. </li></ul><ul><li>…was flexible & maintainable. ...
But wait!  There’s more! <ul><li>…simplifies agent architecture. </li></ul><ul><li>…reduces code bloat. </li></ul><ul><li>...
Blackboards: the magical animal <ul><li>Homer:  “What about bacon?” </li></ul><ul><li>Lisa:  “No!” </li></ul><ul><li>Homer...
What  is  a blackboard?
A blackboard is a metaphor <ul><li>Physical blackboard </li></ul><ul><ul><li>Publicly read/writeable. </li></ul></ul><ul><...
A blackboard is shared memory <ul><li>Read/write memory </li></ul><ul><li>Working memory </li></ul><ul><li>Like a hard-dri...
A blackboard is a means of communication <ul><li>Centralized communication </li></ul><ul><li>Agents communicate </li></ul>...
A blackboard is an architecture <ul><li>Changes how agents and/or sub-systems interact </li></ul><ul><li>Like an interface...
Blackboard implementation <ul><li>There’s no wrong way to eat a blackboard. </li></ul><ul><li>Two flavors: </li></ul><ul><...
Static blackboards <ul><li>class CBlackboard </li></ul><ul><li>{ </li></ul><ul><li>private: </li></ul><ul><li>Vector m_vPo...
Static blackboards (cont.) <ul><li>Predetermined data to share. </li></ul><ul><li>Static amount of data. </li></ul><ul><li...
Dynamic blackboards <ul><li>struct BBRECORD { … }; </li></ul><ul><li>typedef std::vector<BBRECORD*> BBRECORD_LIST; </li></...
Dynamic blackboards (cont.) <ul><li>struct BBRECORD </li></ul><ul><li>{ </li></ul><ul><li>ENUM_BBRECORD_TYPE eType; </li><...
Dynamic blackboards (cont.) <ul><li>enum ENUM_BBRECORD_TYPE </li></ul><ul><li>{ </li></ul><ul><li>kBB_Invalid = -1, </li><...
Dynamic blackboards (cont.) <ul><li>// query functions </li></ul><ul><li>int  CountRecords(  ENUM_BBRECORD_TYPE eType  ); ...
Dynamic blackboards (cont.) <ul><li>Data to share is not predetermined. </li></ul><ul><li>Dynamic amount of data. </li></u...
Inter-agent Coordination <ul><li>Using a blackboard to solve coordination </li></ul><ul><li>problems on NOLF2. </li></ul>
Inter-agent Coordination Problems <ul><li>Agents doing the same thing at the same time. </li></ul><ul><li>Agents doing thi...
NOLF2 Blackboard <ul><li>Add Records: </li></ul><ul><ul><li>Enumerated type </li></ul></ul><ul><ul><li>Subject ID </li></u...
NOLF2 Blackboard (cont.) <ul><li>Query: </li></ul><ul><ul><li>Count matching records </li></ul></ul><ul><ul><li>Retrieve d...
Problem #1: Agents doing same thing at same time <ul><li>Examples: </li></ul><ul><li>Soldiers Crouching </li></ul><ul><ul>...
Blackboard Solution: Agents doing same thing at same time <ul><li>Should I crouch? </li></ul><ul><li>if(  g_pAIBB->CountRe...
Problem #2: Agents doing things too often <ul><li>Examples: </li></ul><ul><li>Soldiers going Prone </li></ul><ul><li>Ninja...
Blackboard Solution: Agents doing things too often <ul><li>Should I go prone? </li></ul><ul><li>if( fCurTime > </li></ul><...
Problem #3: Tactical behavior has special constraints <ul><li>Example: </li></ul><ul><li>Ninja only attacks from a rooftop...
Blackboard Solution: Tactical behavior has special constraints <ul><li>Should I attack from the roof? </li></ul><ul><li>if...
Blackboard Solution: Tactical behavior has special constraints (cont.) <ul><li>if(  g_pAIBB->CountRecords( kBB_Attacking, ...
Problem #4: Agents take same paths <ul><li>Example: </li></ul><ul><li>Player runs around the corner, and characters follow...
Problem #4: Agents take same paths (cont.) <ul><li>NOLF2 AIVolume system: </li></ul>
Problem #4: Agents take same paths (cont.) <ul><li>NOLF2 AIVolume system: </li></ul>
Problem #4: Agents take same paths (cont.) <ul><li>NOLF2 AIVolume system: </li></ul>
Problem #4: Agents take same paths (cont.) <ul><li>NOLF2 AIVolume system: </li></ul>
Problem #4: Agents take same paths (cont.) <ul><li>NOLF2 AIVolume system: </li></ul>
Blackboard Solution: Agents take same paths <ul><li>Volume reservation system: </li></ul><ul><li>Reserve the Volume  befor...
Blackboard Solution: Agents take same paths (cont.) <ul><li>Volume reservation system: </li></ul>
Blackboard Solution: Agents take same paths (cont.) <ul><li>Volume reservation system: </li></ul>
Blackboard Solution: Agents take same paths (cont.) <ul><li>Volume reservation system: </li></ul>
Blackboard Solution: Agents take same paths (cont.) <ul><li>// Pathfinding </li></ul><ul><li>if(  g_pAIBB->CountRecords( k...
Blackboard Solution: Agents take same paths (cont.) <ul><li>// Movement </li></ul><ul><li>g_pAIBB->RemoveRecord(  kBB_Rese...
Problem #5: Agents crowd at destination <ul><li>Examples: </li></ul><ul><li>Player knocks over a bottle.  Characters conve...
Blackboard Solution: Agents crowd at destination <ul><li>First agent claims volume for investigation. </li></ul><ul><li>Ot...
Blackboard Solution: Agents crowd at destination (cont.)
Blackboard Solution: Agents crowd at destination (cont.)
Blackboard Solution: Agents crowd at destination (cont.)
Blackboard Solution: Agents crowd at destination (cont.) <ul><li>// AI reached the dest volume first. </li></ul><ul><li>if...
Einstein says… <ul><li>“ Hang in there, we’re half-way done!” </li></ul>
Why use blackboards??
Why use blackboards?? <ul><li>“ Less is more”: </li></ul><ul><li>Less to debug </li></ul><ul><li>Less to maintain </li></u...
Why use blackboards?? <ul><li>Decouple data from game-specific purpose: </li></ul><ul><li>Designs change </li></ul><ul><li...
What about performance?! <ul><li>Problem: </li></ul><ul><li>Pathfinder needs to look up Volume Reservation status every it...
What about performance?! (cont.) <ul><li>Solution: </li></ul><ul><li>A* flags array </li></ul><ul><li>char astarFlags[NUM_...
What about performance?! (cont.) <ul><li>Solution: </li></ul><ul><li>A* flags array </li></ul><ul><li>char astarFlags[NUM_...
What about performance?! (cont.) <ul><li>RunAStar() </li></ul><ul><li>{ </li></ul><ul><li>ClearFlags(); </li></ul><ul><li>...
What about performance?! (cont.) <ul><li>RunAStar() </li></ul><ul><li>{ </li></ul><ul><li>ClearFlags(); </li></ul><ul><li>...
Intra-agent Coordination
Intra-agent Coordination <ul><li>A character is an entire world. </li></ul><ul><li>Sub-systems are characters in the world...
NOLF2 Agent Architecture
NOLF2 Agent Architecture
Blackboard Agent Architecture
Blackboard Agent Architecture <ul><li>class AgentBlackBoard </li></ul><ul><li>{ </li></ul><ul><li>private: </li></ul><ul><...
Benefits of Decoupling  Sub-systems <ul><li>Benefits of Decoupling: </li></ul><ul><li>Development/Maintenance </li></ul><u...
Benefit #1: Development/Maintenance Benefits <ul><li>Problem: </li></ul><ul><li>Difficult to upgrade or replace old system...
Benefit #1: Development/Maintenance (cont.) <ul><li>Various calls to sub-system: </li></ul><ul><li>pAI->GetPathManager()->...
Benefit #2: Flexibility <ul><li>Problem: </li></ul><ul><li>Different characters have different needs. </li></ul><ul><li>  ...
Benefit #2: Flexibility (cont.) <ul><li>Example (cont.): </li></ul><ul><li>AIStatePatrol::Update( AI* pAI ) </li></ul><ul>...
Benefit #2: Flexibility (cont.) <ul><li>Blackboard Solution: </li></ul><ul><li>AIStatePatrol::Update( AI* pAI ) </li></ul>...
Benefit #2: Flexibility (cont.) <ul><li>Example: </li></ul><ul><li>Humans need a lot of sensory information to make comple...
Benefit #2: Flexibility (cont.)
Benefit #2: Flexibility (cont.)
Benefit #2: Flexibility (cont.)
Benefit #3: Performance <ul><li>Problem: </li></ul><ul><li>All characters in NOLF2 are active all of the time, regardless ...
Benefit #3: Performance (cont.) <ul><li>Blackboard Solution: </li></ul><ul><li>Sub-systems communicate through the blackbo...
Benefit #3: Performance (cont.) <ul><li>LOD 5: </li></ul>
Benefit #3: Performance (cont.) <ul><li>LOD 5: </li></ul>
Benefit #3: Performance (cont.) <ul><li>LOD 5: </li></ul>
Benefit #3: Performance (cont.) <ul><li>LOD 2: </li></ul>
Benefit #3: Performance (cont.) <ul><li>LOD 2: </li></ul>
Don’t run away… <ul><li>We’re almost done! </li></ul>
Intra-agent Dynamic Blackboard <ul><li>MIT Media Lab </li></ul><ul><li>Synthetic Characters Group </li></ul><ul><li>C4 </l...
Intra-agent Dynamic Blackboard (cont.)
Intra-agent Dynamic Blackboard (cont.)
Intra-agent Dynamic Blackboard (cont.) <ul><li>Percept Memory Records: </li></ul><ul><li>Only  form of knowledge represent...
Intra-agent Dynamic Blackboard (cont.) <ul><li>Benefits: </li></ul><ul><li>Keep track of multiple types of information in ...
Intra-agent Dynamic Blackboard: Complex Reasoning <ul><li>Queries: </li></ul><ul><li>“Is there food near me?” </li></ul><u...
Intra-agent Dynamic Blackboard: Complex Reasoning (cont.) <ul><li>Spatial Reasoning: </li></ul><ul><li>Agent is more alarm...
Intra-agent Dynamic Blackboard: Complex Reasoning (cont.) <ul><li>Temporal Reasoning: </li></ul><ul><li>Anticipation and s...
Intra-agent Dynamic Blackboard: Complex Reasoning (cont.) <ul><li>Deductive Reasoning: </li></ul><ul><li>Agent sees dead b...
Intra-agent Dynamic Blackboard: Complex Reasoning (cont.) <ul><li>Multi-tasking: </li></ul><ul><li>Agent targets enemyA. <...
Take-away <ul><li>Use blackboard systems! </li></ul><ul><ul><li>Less is more. </li></ul></ul><ul><ul><li>Decouple your dat...
More Information <ul><li>December 2003: </li></ul><ul><li>AI Game Programming Wisdom 2 </li></ul><ul><li>“ Simple Techniqu...
More Information <ul><li>NOLF2 Source, Toolkit & SDK: </li></ul><ul><li>http://nolf2.sierra.com </li></ul><ul><li>( AICent...
Questions? <ul><li>NOLF2 Source, Toolkit & SDK: </li></ul><ul><li>http://nolf2.sierra.com </li></ul><ul><li>( AICentralKno...
Upcoming SlideShare
Loading in...5
×

Applying Blackboard Systems to First Person Shooters

771

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
771
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Applying Blackboard Systems to First Person Shooters"

  1. 1. Applying Blackboard Systems to First Person Shooters Jeff Orkin Monolith Productions http://www.jorkin.com
  2. 2. No One Lives Forever 2: A Spy in H.A.R.M.’s Way <ul><li>aka NOLF2 </li></ul><ul><li>A.I. Systems </li></ul><ul><li>re-used: </li></ul><ul><ul><li>TRON 2.0 </li></ul></ul><ul><ul><li>Contract J.A.C.K. </li></ul></ul>
  3. 3. No One Lives Forever 2: A Spy in H.A.R.M.’s Way
  4. 4. Agenda <ul><li>Blackboards are wicked cool. </li></ul><ul><li>What is a blackboard? </li></ul><ul><li>Inter -agent coordination </li></ul><ul><li>Intra -agent coordination </li></ul>
  5. 5. What if there was an architecture that… <ul><li>…was simple to implement. </li></ul><ul><li>…was flexible & maintainable. </li></ul><ul><li>…handled coordinated behavior: </li></ul><ul><ul><li>Coordinated timing of behaviors. </li></ul></ul><ul><ul><li>Coordinated pathfinding. </li></ul></ul><ul><ul><li>Coordinated tactics. </li></ul></ul>
  6. 6. But wait! There’s more! <ul><li>…simplifies agent architecture. </li></ul><ul><li>…reduces code bloat. </li></ul><ul><li>…facilitates AI LOD system. </li></ul><ul><li>…facilitates variations, re-use, and sharing. </li></ul><ul><li>…allows complex reasoning. </li></ul>
  7. 7. Blackboards: the magical animal <ul><li>Homer: “What about bacon?” </li></ul><ul><li>Lisa: “No!” </li></ul><ul><li>Homer: “Ham?” </li></ul><ul><li>Lisa: “No!” </li></ul><ul><li>Homer: “Pork chops?!?” </li></ul><ul><li>Lisa: “Dad! Those all come from the same animal!” </li></ul><ul><li>Homer: “Yeah right Lisa. A wonderful magical animal.” </li></ul>
  8. 8. What is a blackboard?
  9. 9. A blackboard is a metaphor <ul><li>Physical blackboard </li></ul><ul><ul><li>Publicly read/writeable. </li></ul></ul><ul><ul><li>Possibly organized. </li></ul></ul><ul><li>Maybe more like a bulletin board </li></ul><ul><ul><li>Post requests and information. </li></ul></ul><ul><ul><li>Respond to items of interest. </li></ul></ul>
  10. 10. A blackboard is shared memory <ul><li>Read/write memory </li></ul><ul><li>Working memory </li></ul><ul><li>Like a hard-drive </li></ul><ul><li>Like a database </li></ul><ul><li>No processing (other than sorting) </li></ul>
  11. 11. A blackboard is a means of communication <ul><li>Centralized communication </li></ul><ul><li>Agents communicate </li></ul><ul><li>Sub-systems of an agent communicate </li></ul>
  12. 12. A blackboard is an architecture <ul><li>Changes how agents and/or sub-systems interact </li></ul><ul><li>Like an interface </li></ul><ul><li>Reduces coupling of sub-systems </li></ul>
  13. 13. Blackboard implementation <ul><li>There’s no wrong way to eat a blackboard. </li></ul><ul><li>Two flavors: </li></ul><ul><ul><li>Static </li></ul></ul><ul><ul><li>Dynamic </li></ul></ul>
  14. 14. Static blackboards <ul><li>class CBlackboard </li></ul><ul><li>{ </li></ul><ul><li>private: </li></ul><ul><li>Vector m_vPos; </li></ul><ul><li>Vector m_vVelocity; </li></ul><ul><li>int m_nHealth; </li></ul><ul><li>// etc… </li></ul><ul><li>public: </li></ul><ul><li>// access functions… </li></ul><ul><li>}; </li></ul>
  15. 15. Static blackboards (cont.) <ul><li>Predetermined data to share. </li></ul><ul><li>Static amount of data. </li></ul><ul><li>Best for intra -agent coordination. </li></ul>
  16. 16. Dynamic blackboards <ul><li>struct BBRECORD { … }; </li></ul><ul><li>typedef std::vector<BBRECORD*> BBRECORD_LIST; </li></ul><ul><li>class CBlackboard </li></ul><ul><li>{ </li></ul><ul><li>private: </li></ul><ul><li>BBRECORD_LIST m_lstBBRecords; </li></ul><ul><li>public: </li></ul><ul><li>// query functions… </li></ul><ul><li>}; </li></ul>
  17. 17. Dynamic blackboards (cont.) <ul><li>struct BBRECORD </li></ul><ul><li>{ </li></ul><ul><li>ENUM_BBRECORD_TYPE eType; </li></ul><ul><li>HANDLE hSubject; </li></ul><ul><li>HANDLE hTarget; </li></ul><ul><li>float fData; </li></ul><ul><li>}; </li></ul>
  18. 18. Dynamic blackboards (cont.) <ul><li>enum ENUM_BBRECORD_TYPE </li></ul><ul><li>{ </li></ul><ul><li>kBB_Invalid = -1, </li></ul><ul><li>kBB_Attacking, </li></ul><ul><li>kBB_Crouching, </li></ul><ul><li>kBB_NextDisappearTime, </li></ul><ul><li>kBB_ReservedVolume, </li></ul><ul><li>// etc… </li></ul><ul><li>}; </li></ul>
  19. 19. Dynamic blackboards (cont.) <ul><li>// query functions </li></ul><ul><li>int CountRecords( ENUM_BBRECORD_TYPE eType ); </li></ul><ul><li>int CountRecords( ENUM_BBRECORD_TYPE eType , HANDLE hTarget ); </li></ul><ul><li>float GetRecordData( ENUM_BBRECORD_TYPE eType ); </li></ul><ul><li>float GetRecordData( ENUM_BBRECORD_TYPE eType, </li></ul><ul><li> HANDLE hTarget ); </li></ul>
  20. 20. Dynamic blackboards (cont.) <ul><li>Data to share is not predetermined. </li></ul><ul><li>Dynamic amount of data. </li></ul><ul><li>Best for inter -agent coordination. </li></ul><ul><li>Also useful for intra-agent complex reasoning. </li></ul>
  21. 21. Inter-agent Coordination <ul><li>Using a blackboard to solve coordination </li></ul><ul><li>problems on NOLF2. </li></ul>
  22. 22. Inter-agent Coordination Problems <ul><li>Agents doing the same thing at the same time. </li></ul><ul><li>Agents doing things too often. </li></ul><ul><li>Special constraints for tactics. </li></ul><ul><li>Agents take same paths. </li></ul><ul><li>Agents clump at destinations. </li></ul>
  23. 23. NOLF2 Blackboard <ul><li>Add Records: </li></ul><ul><ul><li>Enumerated type </li></ul></ul><ul><ul><li>Subject ID </li></ul></ul><ul><ul><li>Optional Target ID </li></ul></ul><ul><ul><li>Optional float data </li></ul></ul><ul><li>Remove Records: </li></ul><ul><ul><li>Specific by type and Subject ID </li></ul></ul><ul><ul><li>All by type </li></ul></ul><ul><li>Replace Records </li></ul>
  24. 24. NOLF2 Blackboard (cont.) <ul><li>Query: </li></ul><ul><ul><li>Count matching records </li></ul></ul><ul><ul><li>Retrieve data from matching records </li></ul></ul>
  25. 25. Problem #1: Agents doing same thing at same time <ul><li>Examples: </li></ul><ul><li>Soldiers Crouching </li></ul><ul><ul><li>Random chance of crouch </li></ul></ul><ul><ul><li>Dodge roll into crouch </li></ul></ul><ul><ul><li>Crouch to get out of firing line </li></ul></ul><ul><li>Ninja Lunging </li></ul>
  26. 26. Blackboard Solution: Agents doing same thing at same time <ul><li>Should I crouch? </li></ul><ul><li>if( g_pAIBB->CountRecords( kBB_Crouching ) == 0 ) </li></ul><ul><li>{ </li></ul><ul><li>// Crouch… </li></ul><ul><li>g_pAIBB->AddRecord( kBB_Crouching, m_hObject ); </li></ul><ul><li>} </li></ul>
  27. 27. Problem #2: Agents doing things too often <ul><li>Examples: </li></ul><ul><li>Soldiers going Prone </li></ul><ul><li>Ninja Disappear-Reappear </li></ul><ul><li>Combat/Search sounds </li></ul>
  28. 28. Blackboard Solution: Agents doing things too often <ul><li>Should I go prone? </li></ul><ul><li>if( fCurTime > </li></ul><ul><li> g_pAIBB->GetRecordFloat( kBB_NextProneTime ) ) </li></ul><ul><li>{ </li></ul><ul><li>// Go prone… </li></ul><ul><li>g_pAIBB->ReplaceRecord( kBB_NextProneTime, </li></ul><ul><li> m_hObject, </li></ul><ul><li> fCurTime + fDelay ); </li></ul><ul><li>} </li></ul>
  29. 29. Problem #3: Tactical behavior has special constraints <ul><li>Example: </li></ul><ul><li>Ninja only attacks from a rooftop if two other ninja are already attacking on ground, and no one is on a roof. </li></ul>
  30. 30. Blackboard Solution: Tactical behavior has special constraints <ul><li>Should I attack from the roof? </li></ul><ul><li>if( g_pAIBB->CountRecords( kBB_AttackingRoof, m_hTarget ) > 0 ) </li></ul><ul><li>{ </li></ul><ul><li>return false; </li></ul><ul><li>} </li></ul>
  31. 31. Blackboard Solution: Tactical behavior has special constraints (cont.) <ul><li>if( g_pAIBB->CountRecords( kBB_Attacking, m_hTarget ) < 2 ) </li></ul><ul><li>{ </li></ul><ul><li>return false; </li></ul><ul><li>} </li></ul><ul><li>// Attack from the roof… </li></ul><ul><li>g_pAIBB->AddRecord( kBB_Attacking, m_hObject, m_hTarget ); </li></ul><ul><li>g_pAIBB->AddRecord( kBB_AttackingRoof, m_hObject, m_hTarget ); </li></ul>
  32. 32. Problem #4: Agents take same paths <ul><li>Example: </li></ul><ul><li>Player runs around the corner, and characters follow in a congo line and get killed one by one. </li></ul>
  33. 33. Problem #4: Agents take same paths (cont.) <ul><li>NOLF2 AIVolume system: </li></ul>
  34. 34. Problem #4: Agents take same paths (cont.) <ul><li>NOLF2 AIVolume system: </li></ul>
  35. 35. Problem #4: Agents take same paths (cont.) <ul><li>NOLF2 AIVolume system: </li></ul>
  36. 36. Problem #4: Agents take same paths (cont.) <ul><li>NOLF2 AIVolume system: </li></ul>
  37. 37. Problem #4: Agents take same paths (cont.) <ul><li>NOLF2 AIVolume system: </li></ul>
  38. 38. Blackboard Solution: Agents take same paths <ul><li>Volume reservation system: </li></ul><ul><li>Reserve the Volume before the destination. </li></ul><ul><li>Reserved Volume Cost == Cost + 500 </li></ul>
  39. 39. Blackboard Solution: Agents take same paths (cont.) <ul><li>Volume reservation system: </li></ul>
  40. 40. Blackboard Solution: Agents take same paths (cont.) <ul><li>Volume reservation system: </li></ul>
  41. 41. Blackboard Solution: Agents take same paths (cont.) <ul><li>Volume reservation system: </li></ul>
  42. 42. Blackboard Solution: Agents take same paths (cont.) <ul><li>// Pathfinding </li></ul><ul><li>if( g_pAIBB->CountRecords( kBB_ReservedVolume, hVolume ) > 0 ) </li></ul><ul><li>{ </li></ul><ul><li>fNodeCost += 500.f; </li></ul><ul><li>} </li></ul>
  43. 43. Blackboard Solution: Agents take same paths (cont.) <ul><li>// Movement </li></ul><ul><li>g_pAIBB->RemoveRecord( kBB_ReservedVolume, </li></ul><ul><li> m_hObject ); </li></ul><ul><li>g_pAIBB->AddRecord( kBB_ReservedVolume, </li></ul><ul><li> m_hObject, </li></ul><ul><li> hVolume ); </li></ul>
  44. 44. Problem #5: Agents crowd at destination <ul><li>Examples: </li></ul><ul><li>Player knocks over a bottle. Characters converge on bottle position. </li></ul><ul><li>Characters discover dead body and converge. </li></ul>
  45. 45. Blackboard Solution: Agents crowd at destination <ul><li>First agent claims volume for investigation. </li></ul><ul><li>Other agents stop at edge of volume. </li></ul>
  46. 46. Blackboard Solution: Agents crowd at destination (cont.)
  47. 47. Blackboard Solution: Agents crowd at destination (cont.)
  48. 48. Blackboard Solution: Agents crowd at destination (cont.)
  49. 49. Blackboard Solution: Agents crowd at destination (cont.) <ul><li>// AI reached the dest volume first. </li></ul><ul><li>if( g_pAIBB->CountRecords( kBB_InvestigatingVolume, </li></ul><ul><li> hVolume ) == 0 ) </li></ul><ul><li>{ </li></ul><ul><li>g_pAIBB->AddRecord( kBB_InvestigatingVolume, </li></ul><ul><li> m_hObject ); </li></ul><ul><li>} </li></ul><ul><li>// AI did not reach the dest volume first. </li></ul><ul><li>else { // Look at dest. } </li></ul>
  50. 50. Einstein says… <ul><li>“ Hang in there, we’re half-way done!” </li></ul>
  51. 51. Why use blackboards??
  52. 52. Why use blackboards?? <ul><li>“ Less is more”: </li></ul><ul><li>Less to debug </li></ul><ul><li>Less to maintain </li></ul><ul><li>Less to port </li></ul><ul><li>Less to compile </li></ul><ul><li>Less to document </li></ul><ul><li>Less to learn </li></ul><ul><li>Less data (per volume) </li></ul>
  53. 53. Why use blackboards?? <ul><li>Decouple data from game-specific purpose: </li></ul><ul><li>Designs change </li></ul><ul><li>Re-use systems in other games (other genres?) </li></ul><ul><li>OO design is not always the right choice. </li></ul>
  54. 54. What about performance?! <ul><li>Problem: </li></ul><ul><li>Pathfinder needs to look up Volume Reservation status every iteration thru A*. </li></ul>
  55. 55. What about performance?! (cont.) <ul><li>Solution: </li></ul><ul><li>A* flags array </li></ul><ul><li>char astarFlags[NUM_VOLUMES]; </li></ul><ul><li>  </li></ul><ul><li>enum ASTAR_FLAGS </li></ul><ul><li>{ </li></ul><ul><li>kNone = 0x00, </li></ul><ul><li>kOpen = 0x01, </li></ul><ul><li>kClosed = 0x02, </li></ul><ul><li>}; </li></ul>
  56. 56. What about performance?! (cont.) <ul><li>Solution: </li></ul><ul><li>A* flags array </li></ul><ul><li>char astarFlags[NUM_VOLUMES]; </li></ul><ul><li>  </li></ul><ul><li>enum ASTAR_FLAGS </li></ul><ul><li>{ </li></ul><ul><li>kNone = 0x00, </li></ul><ul><li>kOpen = 0x01, </li></ul><ul><li>kClosed = 0x02, </li></ul><ul><li>kReserved = 0x04, </li></ul><ul><li>}; </li></ul>
  57. 57. What about performance?! (cont.) <ul><li>RunAStar() </li></ul><ul><li>{ </li></ul><ul><li>ClearFlags(); </li></ul><ul><li>Search(); </li></ul><ul><li>} </li></ul><ul><li>  </li></ul>
  58. 58. What about performance?! (cont.) <ul><li>RunAStar() </li></ul><ul><li>{ </li></ul><ul><li>ClearFlags(); </li></ul><ul><li>MarkReserved(); </li></ul><ul><li>Search(); </li></ul><ul><li>} </li></ul><ul><li>  </li></ul>
  59. 59. Intra-agent Coordination
  60. 60. Intra-agent Coordination <ul><li>A character is an entire world. </li></ul><ul><li>Sub-systems are characters in the world. </li></ul><ul><ul><li>Navigation </li></ul></ul><ul><ul><li>Movement </li></ul></ul><ul><ul><li>Target/Attention selection </li></ul></ul><ul><ul><li>Senses </li></ul></ul><ul><ul><li>Animation </li></ul></ul><ul><ul><li>Weapons </li></ul></ul><ul><ul><li>Decision-Making </li></ul></ul>
  61. 61. NOLF2 Agent Architecture
  62. 62. NOLF2 Agent Architecture
  63. 63. Blackboard Agent Architecture
  64. 64. Blackboard Agent Architecture <ul><li>class AgentBlackBoard </li></ul><ul><li>{ </li></ul><ul><li>private: </li></ul><ul><li>Vector m_vDest; </li></ul><ul><li>NAV_STATUS m_eNavStatus; </li></ul><ul><li>HANDLE m_hTarget; </li></ul><ul><li>AISenses m_aSenses[MAX_SENSES]; </li></ul><ul><li>// etc… </li></ul><ul><li>public: </li></ul><ul><li>// Access functions…  </li></ul><ul><li>} </li></ul>
  65. 65. Benefits of Decoupling Sub-systems <ul><li>Benefits of Decoupling: </li></ul><ul><li>Development/Maintenance </li></ul><ul><li>Flexibility </li></ul><ul><li>Performance </li></ul>
  66. 66. Benefit #1: Development/Maintenance Benefits <ul><li>Problem: </li></ul><ul><li>Difficult to upgrade or replace old systems. </li></ul><ul><li>  </li></ul><ul><li>Example: </li></ul><ul><li>Re-writing navigation system </li></ul>
  67. 67. Benefit #1: Development/Maintenance (cont.) <ul><li>Various calls to sub-system: </li></ul><ul><li>pAI->GetPathManager()->SetPath(vDest); </li></ul><ul><li>pAI->GetPathManager()->UpdatePath(); </li></ul><ul><li>if( pAI->GetPathManager()->IsPathDone() ) </li></ul><ul><li>... </li></ul><ul><li>AIVolume* GetNextVolume(AIVolume* pVolume, AIVolume::EnumVolumeType eVolumeType); </li></ul>
  68. 68. Benefit #2: Flexibility <ul><li>Problem: </li></ul><ul><li>Different characters have different needs. </li></ul><ul><li>  </li></ul><ul><li>Example: </li></ul><ul><li>Humans plan paths to a dest. </li></ul><ul><li>Rats and Rabbits wander randomly to a dest. </li></ul>
  69. 69. Benefit #2: Flexibility (cont.) <ul><li>Example (cont.): </li></ul><ul><li>AIStatePatrol::Update( AI* pAI ) </li></ul><ul><li>{ </li></ul><ul><li>pAI->GetPathManager()->SetPath(vDest); </li></ul><ul><li>if( pAI->GetPathManager()->IsPathComplete() ) </li></ul><ul><li>{ </li></ul><ul><li>// etc… </li></ul><ul><li>} </li></ul>
  70. 70. Benefit #2: Flexibility (cont.) <ul><li>Blackboard Solution: </li></ul><ul><li>AIStatePatrol::Update( AI* pAI ) </li></ul><ul><li>{ </li></ul><ul><li>pAI->GetAIBlackboard()->SetDest(vDest); </li></ul><ul><li>if( pAI->GetAIBlackboard()->GetNavStatus() </li></ul><ul><li>== kNavStatus_Done ) </li></ul><ul><li>{ </li></ul><ul><li>// etc… </li></ul><ul><li>} </li></ul>
  71. 71. Benefit #2: Flexibility (cont.) <ul><li>Example: </li></ul><ul><li>Humans need a lot of sensory information to make complex goal-based decisions. </li></ul><ul><li>Rats and Rabbits need very little info for simplistic behavior. </li></ul>
  72. 72. Benefit #2: Flexibility (cont.)
  73. 73. Benefit #2: Flexibility (cont.)
  74. 74. Benefit #2: Flexibility (cont.)
  75. 75. Benefit #3: Performance <ul><li>Problem: </li></ul><ul><li>All characters in NOLF2 are active all of the time, regardless of player location. </li></ul><ul><li>  </li></ul><ul><li>Example: </li></ul><ul><li>Characters are pathfinding, moving, animating, and sensing as they work at desks, go to the bathroom, etc. </li></ul>
  76. 76. Benefit #3: Performance (cont.) <ul><li>Blackboard Solution: </li></ul><ul><li>Sub-systems communicate through the blackboard. </li></ul><ul><li>LOD system swaps sub-systems behind the scenes. </li></ul>
  77. 77. Benefit #3: Performance (cont.) <ul><li>LOD 5: </li></ul>
  78. 78. Benefit #3: Performance (cont.) <ul><li>LOD 5: </li></ul>
  79. 79. Benefit #3: Performance (cont.) <ul><li>LOD 5: </li></ul>
  80. 80. Benefit #3: Performance (cont.) <ul><li>LOD 2: </li></ul>
  81. 81. Benefit #3: Performance (cont.) <ul><li>LOD 2: </li></ul>
  82. 82. Don’t run away… <ul><li>We’re almost done! </li></ul>
  83. 83. Intra-agent Dynamic Blackboard <ul><li>MIT Media Lab </li></ul><ul><li>Synthetic Characters Group </li></ul><ul><li>C4 </li></ul><ul><li>GDC 2001 </li></ul><ul><li>Creature Smarts: The Art and Architecture of the </li></ul><ul><li>Virtual Brain </li></ul>
  84. 84. Intra-agent Dynamic Blackboard (cont.)
  85. 85. Intra-agent Dynamic Blackboard (cont.)
  86. 86. Intra-agent Dynamic Blackboard (cont.) <ul><li>Percept Memory Records: </li></ul><ul><li>Only form of knowledge representation. </li></ul><ul><ul><li>Game objects (characters, objects of interest, etc) </li></ul></ul><ul><ul><li>Desires </li></ul></ul><ul><ul><li>Damage </li></ul></ul><ul><ul><li>AI hints (AINodes, AIVolumes) </li></ul></ul><ul><ul><li>Tasks </li></ul></ul><ul><li>Can group multiple records for same object. </li></ul>
  87. 87. Intra-agent Dynamic Blackboard (cont.) <ul><li>Benefits: </li></ul><ul><li>Keep track of multiple types of information in a consistent way. </li></ul><ul><li>Open-ended architecture: different games may use different data in different ways . </li></ul><ul><li>Complex reasoning. </li></ul>
  88. 88. Intra-agent Dynamic Blackboard: Complex Reasoning <ul><li>Queries: </li></ul><ul><li>“Is there food near me?” </li></ul><ul><li>Find the “red object that is making the most noise.” </li></ul><ul><li>“Find an object that is humanoid-shaped and go to it.” </li></ul>
  89. 89. Intra-agent Dynamic Blackboard: Complex Reasoning (cont.) <ul><li>Spatial Reasoning: </li></ul><ul><li>Agent is more alarmed if multiple disturbances are found near each other. </li></ul>
  90. 90. Intra-agent Dynamic Blackboard: Complex Reasoning (cont.) <ul><li>Temporal Reasoning: </li></ul><ul><li>Anticipation and surprise. </li></ul>
  91. 91. Intra-agent Dynamic Blackboard: Complex Reasoning (cont.) <ul><li>Deductive Reasoning: </li></ul><ul><li>Agent sees dead body. </li></ul><ul><li>Agent sees player with a gun. </li></ul><ul><li>Agent draws the conclusion that the player was the killer. </li></ul>
  92. 92. Intra-agent Dynamic Blackboard: Complex Reasoning (cont.) <ul><li>Multi-tasking: </li></ul><ul><li>Agent targets enemyA. </li></ul><ul><li>Agent targets enemyB. </li></ul><ul><li>Agent kills enemyB. </li></ul><ul><li>Agent is aware that he was also fighting enemyA. </li></ul>
  93. 93. Take-away <ul><li>Use blackboard systems! </li></ul><ul><ul><li>Less is more. </li></ul></ul><ul><ul><li>Decouple your data from its game-specific purpose. </li></ul></ul><ul><ul><li>Decouple your subsystems. </li></ul></ul>
  94. 94. More Information <ul><li>December 2003: </li></ul><ul><li>AI Game Programming Wisdom 2 </li></ul><ul><li>“ Simple Techniques for Coordinated Behavior” </li></ul>
  95. 95. More Information <ul><li>NOLF2 Source, Toolkit & SDK: </li></ul><ul><li>http://nolf2.sierra.com </li></ul><ul><li>( AICentralKnowledgeMgr == Blackboard ) </li></ul><ul><li>Slides: </li></ul><ul><li>http://www.jorkin.com/talks/UT_blackboards.zip </li></ul><ul><li>[email_address] </li></ul>
  96. 96. Questions? <ul><li>NOLF2 Source, Toolkit & SDK: </li></ul><ul><li>http://nolf2.sierra.com </li></ul><ul><li>( AICentralKnowledgeMgr == Blackboard ) </li></ul><ul><li>Slides: </li></ul><ul><li>http://www.jorkin.com </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×