1 / 21

Lecture 24 – Decision Making

Lecture 24 – Decision Making. CS 490/590 Wesley Kerr. Quiz. On a piece of paper – no computers write code to complete the following task: Write a program that prints the numbers from 1 to 100. For multiples of five print “Fizz” instead of the number

yaron
Download Presentation

Lecture 24 – Decision Making

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 24 – Decision Making CS 490/590 Wesley Kerr

  2. Quiz • On a piece of paper – no computers write code to complete the following task: • Write a program that prints the numbers from 1 to 100. • For multiples of five print “Fizz” instead of the number • For multiples of seven print “Buzz” instead of the number • For multiples of five and seven print “FizzBuzz” • You have 10 minutes.

  3. Review • Decision Trees • State Machines • Hierarchical State Machines • Goal-Driven Behavior • Planning • Rule-Based Systems • And all combinations…

  4. Behavior Trees ? ? ? ? S P S S

  5. Motivations • Bigger environments • Greater numbers of entities • More accurate physics • Better sensory systems • Advanced animation

  6. Acknowledgements • Alex J. Champanard, AIGameDev.com • We are using his notation for behavior trees • Some slides based on is Behavior Tree talks

  7. Requirements • Designers • They want to micro manage every decision in the game • This allows them to put their own touch on each situation • Also allows them to create cinematic experiences • …but they don’t want to do all of their work on their own • The AI needs to behave autonomously as well • AI • Should be goal directed • They each need to have personal motivations • These motivations manifest themselves as purposeful behaviors • …but also able to respond to events • Reactive when the situation demands it.

  8. Holy Trinity HFSM Good: Simple and intuitive Low-level reactive control Bad: Labor intensive Not easy to build goal-directed behavior Scripting C++/Lua/Ruby Planner (HTN) Good: Turing complete Widespread experience Bad: Difficult to analyze Not accessible to designers Good: Use search for automation Goal directed by default Bad: Disconnected from real world Ignores control and execution

  9. Holy Trinity HFSM Behavior Trees Scripting C++/Lua/Ruby Planner (HTN)

  10. Behavior Trees ? ? ? ? S P S S

  11. Leaf Nodes Actions Actions are the way that the agent changes the world Every action should return succeed or fail Examples move, turn, animate, sound Conditions Conditions are leaves in the Behavior Tree They check information from the world by accessing the world model Conditions are tests that return succeed or fail to the parent task Examples actor state, collision, entity queries

  12. Adding Complexity • Add branches to manage the leaves • Accomplished with composite tasks / nodes

  13. Logical Control • Sequence Nodes • Sequences execute child nodes in the order supplied • As long as each child behavior succeeds, the sequence continues it’s execution. • If a child has an unexpected error, the sequence breaks and returns the child’s error bail out S keep going • Parallel Nodes • Parallel nodes executes each child task concurrently • Failure Policy: How many children must fail before the parallel fails? • Completion Policy: How many children must finish before the parallel finishes? P

  14. Parallel Node • Often it is useful to have a scheduler to manage the behaviors without having to do micromanagement in the Behavior Tree • Parallel trees work better with independent behaviors • For example: one behavior is movement and the second would be animation • Common Pattern: One parallel node with multiple conditions as children and a single action. • Conditions do not modify the world • Single action so no concern about dependence between behaviors • Safe to use parallel nodes with completely different trees • Example: Agent on patrol has one behavior tree for the head of the agent and a second behavior tree for deciding where to go

  15. Logical Control bail out • Priority Selector Nodes • Try to execute children in order • If the current child fails, fall back to the next one • If a child succeeds and finishes, then the selector node finishes ? 1 2 • Random Selector Nodes • Randomly select a child node based on some probability distribution • Continue selecting children until one succeeds. ? 0.25 0.75

  16. Sequences and Selectors • Programming language basics • Statements and conditionals • Very powerful model for computation

  17. Update ? 3 1 2 ? ? ? 2 1 S P S S

  18. Concrete Example – Dog AI • What do dogs do? • walk, run, sit, stand idle, rest, sleep, eat, poop, chase tail, scratch, etc. • Break these down into three categories • Bodily • rest, sleep, eat, poop, etc. • Active • walking around, running, chasing tail, scratching, etc. • Passive • sitting, lying down, standing idle, etc.

  19. ? 1. bodily 2. active 3. passive ? ? ? S P S S walk to food play eat animation play poop animation create new objects

  20. Remaining Issues • We may spend a lot of time in leaves, so what happens if a higher priority node becomes active? • Option 1: • Search the tree from the root with low frequency • If new task found • invalidate the old task • begin the new task • Option 2: • Event driven interrupts • How do we handle parallel tasks? • Requires implementing a scheduler ? 2 1 P S S

  21. Behavior Tree Resources • AIGameDev.com • Single greatest source of information for Game AI • Building AI for a Simulation from the Ground Up • Series of tutorials written for AIGameDev.com • Damian Isla • Handling Complexity in the Halo 2 AI. Gamasutra • Building a Better Battle. Bungie • Behavior Trees: Three Ways of Cultivating Game AI. GDC 2010 • Behavior Trees: Branching Paths with Selectors. Arges Systems • Introduction to Behavior Trees

More Related