beyond finite state machines beyond finite state machines
play

Beyond Finite State Machines Beyond Finite State Machines Managing - PDF document

Beyond Finite State Machines Beyond Finite State Machines Managing Complex, Intermixing Behavior Hierarchies Managing Complex, Intermixing Behavior Hierarchies Michael Mateas Michael Mateas Andrew Stern Andrew Stern Georgia Institute of


  1. Beyond Finite State Machines Beyond Finite State Machines Managing Complex, Intermixing Behavior Hierarchies Managing Complex, Intermixing Behavior Hierarchies Michael Mateas Michael Mateas Andrew Stern Andrew Stern Georgia Institute of Technology Georgia Institute of Technology Interactivestory.net Interactivestory.net, College of Computing & LCC College of Computing & LCC Zoesis Zoesis Studios Studios www.lcc.gatech.edu/~mateas www.lcc.gatech.edu/~mateas www.interactivestory.net www.interactivestory.net www.grandtextauto.org www.grandtextauto.org New programming constructs for New programming constructs for believable characters believable characters • In creating Façade, we developed programming constructs In creating Façade, we developed programming constructs for believable characters for believable characters • We created a new language to support these constructs We created a new language to support these constructs A B ehavior ehavior L anguage anguage– ABL ABL • Based on the CMU Oz-project language Hap • Reactive-planning: characters organized as goals and behaviors • Lessons from these constructs can be generalized beyond ABL A different way of thinking than imperative languages A different way of thinking than imperative languages (e.g. C++, Java) (e.g. C++, Java) 1

  2. Façade Façade Dramatic world inhabited by • computer controlled characters (believable agents) The user (player) plays a • protagonist within the story, first-person point of view The player experiences a story • with a dramatic arc Façade character requirements Façade character requirements • Moment Moment-by by-moment believability moment believability Body movements, facial expression, behavior mixing • Tightly coordinated action Tightly coordinated action Characters work closely together to perform story • Conversational behavior Conversational behavior Longer-term, non-linear dialog flow that preserves reactivity 2

  3. Code support for character Code support for character requirements requirements • Goals and behaviors Goals and behaviors Sequencing + reactivity, behavior mixing, hierarchy • Joint goals and behaviors Joint goals and behaviors Protocol supporting multi-character teamwork • Meta Meta-behaviors behaviors Canonical behavior sequences are modified by player interaction Façade architecture Façade architecture Drama Manager (sequences beats) History Bag of beats Recognizers beat beat beat Previous action time beat beat beat Current beat beat beat beat story Selected beat values Activity not part of a beat Desired value arc(s) Behavior-based surface text discourse acts agents used here Trip discourse acts reactions Grace Player Natural Language Processing Story World 3

  4. A behavior-based agent A behavior-based agent Behavior library Active Behavior Tree Behavior 1 Behavior n Behavior 2 Root behavior Goal 1 Goal 2 Working memory Seq. Par. Behavior 1 WME 1 WME n Behavior 2 WME 2 Sensors Sensor 1 Mental Act Goal 3 Available for execution World Features of our behavior-based agents Features of our behavior-based agents • Characters organized as goals and sequential & parallel Characters organized as goals and sequential & parallel behaviors behaviors • Joint (synchronized) goals and behaivors Joint (synchronized) goals and behaivors Reflection (meta Reflection (meta-behaviors) behaviors) • • Generalization of sensory Generalization of sensory-motor connections motor connections • Multiple named working memories Multiple named working memories • Atomic behaviors (useful for atomic WM updates) Atomic behaviors (useful for atomic WM updates) 4

  5. Behaviors Behaviors Behaviors consist of steps Behaviors consist of steps • Similar to the scripts or functions associated with FSM states, but • Can be parallel as well as sequential • Mix together as multiple behaviors are pursued Behaviors are chosen to accomplish a goals Behaviors are chosen to accomplish a goals • Similar to function calls but • Are dynamically chosen given current game conditions • Can be re-chosen if the first choice doesn’t work out Example behaviors Example behaviors sequential behavior AnswerTheDoor () { To answer the door: WME w; 1. Wait for knock with success_test { w = (KnockWME) } wait ; act sigh(); 2. Sigh subgoal OpenDoor(); 3. Open the door subgoal GreetGuest(); mental_act { deleteWME(w); } 4. Greet the guest } sequential behavior O p e n D o o r () { precondition { (KnockWME doorID :: door) If there is knock and the (PosWME spriteID == door pos :: doorPos) (PosWME spriteID == me pos :: myPos) door is too far away, (Util.computeDistance(doorPos, myPos) > 100) yell for guest to come in. } subgoal YellAndWaitForGuestToEnter(doorID); } 5

  6. Steps Steps Subgoal Subgoal – chooses behaviors chooses behaviors • Act – does a physical act in the world Act does a physical act in the world • • Mental act Mental act – a bit of computation (e.g. change memory) a bit of computation (e.g. change memory) Wait Wait – used with conditions to accomplish demons used with conditions to accomplish demons • All steps succeed or fail All steps succeed or fail Behavior finished when all steps succeed or one step fails Behavior finished when all steps succeed or one step fails Behavior success and failure propagates up ABT Behavior success and failure propagates up ABT Continuously monitored conditions Continuously monitored conditions • Success tests Success tests – spontaneously make a spontaneously make a • step succeed if test is satisfied step succeed if test is satisfied • Context conditions Context conditions – spontaneously make spontaneously make • a behavior fail if test is satisfied a behavior fail if test is satisfied • Makes behaviors immediately reactive to Makes behaviors immediately reactive to • changes in the world changes in the world 6

  7. Success and failure propagation Success and failure propagation ABT Root behavior Success Test Goal 2 Goal 2 Goal 2 Succeeds Seq. Seq. Par. Remove behavior 1 behavior 1 behavior 2 Remove Mental Mental Act 1 Goal 3 Goal 3 Seq. Seq. Fail behavior 3 behavior 3 Act 2 Act 2 Fail Example: Making a drink Example: Making a drink Code example showing basic sequential Code example showing basic sequential behavior plus hierarchical subgoaling behavior plus hierarchical subgoaling. 7

  8. Example: Interrupting Example: Interrupting Code example using a continuous condition Code example using a continuous condition to interrupt activity. to interrupt activity. Example: Low-level parallelism Example: Low-level parallelism Performance behavior example. Performance behavior example. 8

  9. Example: High-level behavior mixing Example: High-level behavior mixing Example showing two high level behaviors Example showing two high level behaviors blending together (making a drink + dialog blending together (making a drink + dialog performance). Demonstrates conflicts and performance). Demonstrates conflicts and priorities. priorities. Joint goals and behaviors Joint goals and behaviors Characters sometimes need to coordinate action Characters sometimes need to coordinate action Some approaches Some approaches • Coordinate through sensing (but plan Coordinate through sensing (but plan recog recog. hard) . hard) • Explicitly communicate (but ad hoc) Explicitly communicate (but ad hoc) • Build it into architecture (but not flexible) Build it into architecture (but not flexible) Architecture coordinates author-specified joint action Architecture coordinates author specified joint action 9

  10. Negotiation Negotiation Agent 1 ’s ABT Agent 2 ’s ABT Intention to enter G 2 Root Root behavior behavior Joint Joint Goal 1 Goal 5 Goal 2 Goal 2 Intention to enter G 2 Seq. Seq. Joint Joint Behavior 1 Behavior 5 Behavior 2 Behavior 6 Mental Act Conflicting intentions Conflicting intentions Problem: Problem: asynchronous asynchronous agents enter conflicting states agents enter conflicting states Agent 1 ’s ABT Agent 2 ’s ABT Agent 3 ’s ABT Root Root Root behavior behavior behavior Suspends Succeeds Joint Joint Goal 3 Goal 4 Goal 1 Goal 2 Goal 2 Seq. Seq. Joint Joint Behavior 1 Behavior 3 Behavior 2 Behavior 4 Joint Goal 2 Fails Mental Act Goal 5 Act Resolution: intentions are precedence ordered Resolution: intentions are precedence ordered 10

  11. Inconsistent subtree execution Inconsistent subtree execution ABT Problem: Problem: continuing continuing execution execution Root leads to ABT inconsistencies leads to ABT inconsistencies behavior Succeeds Joint G 2 Goal 1 Joint Behavior 2 Resolution: freeze subtree Resolution: freeze subtree Joint Goal 2 • Initiate exit intention at the subtree root Seq. • Remove all leaf steps Behavior 1 • Deactivate all monitored conditions • Negotiate removal of all joint goals Act • Commit to exit intention at subtree root Variably coupled agents Variably coupled agents A tunable spectrum between one-mind and many A tunable spectrum between one mind and many-minds minds Agent 1 ’s ABT Agent 2 ’s ABT Root Root behavior behavior Effects propagate Joint Joint Goal 1 Goal 3 Goal 2 across ABTs Goal 2 Effects Seq. Joint Seq. Joint propagate Behavior 1 Behavior 2 Behavior 3 Behavior 4 within ABTs Mental Act Goal 4 Mental 11

Recommend


More recommend