Individual NPC Behavior - Lehigh CSE

Individual NPC Behavior - Lehigh CSE

Individual NPC Behavior Elizabeth Carter CSE 348 2/11/2010 Agenda Realistic Character Animation Responding to the Player Simulated Animals Autonomous Characters

More Humanlike NPCs Realistic Animation Realistic Character Animation No longer acceptable to animate one part at a time Want character to be able to do multiple things at once Walk, wave, hair blown by breeze

Layering of animation Two methods Animation Controller Layered / prioritized animation system Animation Controller and Layering Animation Controller approach Use separate animation controller for each body part

Can lead to over complicated code and interdependencies Layering Made possible via skeletal animation systems Layers categorized by regions of body that they affect Prioritization and Categorization Each animation receives priority and

category In implementation discussed Priority Integer, with zero being lowest Category Bit flag enumerator describing affected body area Animation Controller for Priory and Categorization In one implementation

Animation controller class has one Member variable Map of animation instances Animation instance = struct storing animation resource file refrance and instance data Sorted by category Core function Requests play of animation Priority utilized to determine if it should be allowed to play

Important Assumptions Each frame stored as list of bone rotations [p 66] Rotations stored relative to same default pose Applying animation to bone overrides any previously applied animation bone rotations Keeping the Motion Natural Blend between animations during transition

Keeps animation from becoming choppy Implementation Store array of quaternions (cache) Quaternion algebra is method for representing 3 dimensional orientation Animation refers to array to gradually blend the animation Reputation

Responding to the Player NPCs should React to players ability React in situation appropriate manner One way to implement this Reputation system Prevents NPC Omniscience

NPC Bob shouldnt know what happened with NPC Larry if not involved Types of Reputation Systems Create global reputations based on average of others opinions Use Centralized authorities to create global reputations inherited by all Problems with Existing

Systems Identity Usually every individual has one known identity Problem identity easily faked Ratings Excessive negative or positive ratings with no substantiation Surreal Software

Implementation Event Driven Data Structures Event Template Reputation Event

Master Event List Long Term Memory (per NPC) Reputation Table (per NPC) Only stores Events involving player Events where NPC killed someone Reputation Event Triggered when player does something that has positive or negative affect on their

reputation Example Kills NPCs friend Kills NPCs enemy Master Event List Holds all important actions NPCs privy to Stored as list of Reputation Events Reputation Event added to this when its created Stores complete information about all

events Events no NPC knows about deleted to keep list small Multiple copies of same event receive one Long Term Memory References all events in Master Event List that NPC in question was involved in Witnessed Heard About

Reputation Table Stores NPCs opinion of player Each NPC has own opinions Is list of groups Group for Player Group for members of each group On recognition of reputation event, reputation effect applied Reputation Details

Implemented via dynamic array Contains reputation meters One meter for each group One meter for player Meter has Group ID 2 Float Variables Like Hate

Long Term Memory Contains compressed versions of Reputation events known to NPC Data Event ID Magnitude of event Time encountered Long Term Memory Example

NPC Bob and NPC Lisa witness the same event Lisa watches to see player kill another NPC Bob runs away Lisa remembers Killed Bob remembers ShootAt Long Term Memory Physical Memory Management Table consists of references instead of the actual

data Dont let NPC learn something they shouldnt know Not witness or recipient of information, shouldnt know it If a tree falls in a forest and no one is there to hear it... the NPC doesnt remember the sound of it falling Let NPC forget Choke Points

How Learning Occurs Event Announcers Sharing Information Memory Match and Updates Event Announcers Spawned by actions at position of object of event On NPC Bobs death event announced immediately Announcer at body stays and continually

announces Bobs death Sharing Let the NPCs Gossip If Eve likes Lisa, theyll share If Eve dislikes Lisa shell keep the info to herself Memory Match and Update For each event NPC checks to see if this event matches

something its already stored Checks subject group, verb, object group, object individual What needs to match Check group, verb, etc, exactly Group, verb, object match but not individual ID Unknown subject group but matches everything else

Seven Rules For Updating (1) Ignore: 1. MagnitudenewEvent <= MagnitudeoldEvent

New Event Subject group Unknown Same subject group for both Object individual ID the same for both events 2. Subject groups match and are already known Old event has maximum magnitude Seven Rules for Updating (2)

Update Magnitude in Long Term Memory, apply reputation effects MagnitudeNewEvent > MagnitudeOldEvent New Event contains unknown subject group or subject groups equal Object individual IDs the same

Seven Rules for Updating (3) Remove existing event and add the one with the greater magnitude, applying reputation effects 1. New event subject group known

Existing event subject group unknown Object individual IDs match New Event has new information 2. Subject groups known and match New event has maximum magnitude

Seven Rules for Updating (4) Add new event and apply reputation effects 1. Subject groups for either or both unknown Object individual IDs different 2. Subject groups known and match Object individual IDs different Neither even has maximum magnitude Applying Updates and

Incomplete Information Applying Update Modifies own Long Term Memory first Then notifies Master Event List If exists there already, update and increase reference count Incomplete Information Complete the information with peer data Bob has an event with an unknown subject group Lisa has a matching event with a known subject

group Simulating Animals Animal NPC Behavior Usage Ambient animals Scenery Secondary animals Some interaction but not focus

Chickens in Zelda Primary animals Primary focus of a game Hunting situations Real Life behavior must be taken into account Behavior Simple Animals Bugs, Solitary Animals, Flocks of Birds,

Schools of Fish General behaviors studied and mimicked Birds and fish unique because travel in flocks/schools Allow for low level multiagent system behavior Behavior Primary and Secondary Animals Generally concerns large mammals Real behavior more varied and intelligent than that of bugs, fish, etc

Best programmed via state machines FSMs adequate Fuzzy logic presents more realistic behavior Autonomous Characters Autonomous Characters Emergent Gameplay Players have freedom to explore and solve

problems without restraint Game world responds appropriately Player rewarded for creativity and exploration Example: The Sims, NOLF2 Controlling Autonomous Characters (1) Need to not stray too far from what it was meant for Ownership of objects prevents NPC Bob from stealing Lisas desk when she uses the

restroom Dependencies Couple two items together to create atomic behavior Toilet usage and hand washing Controlling Autonomous Characters (2) Responsibility Helps player decide what to do appropriately

Relevance NPCs understanding of relevance to the storyline helps decrease overreaction of system Example: NOLF2 rabbit being scared off triggered very intense music, this is undesirable Priority High priority implies urgency to NPC Controlling Autonomous

Characters (3) State of Consciousness If character is sleeping or unconscious it shouldnt be responding to sensory input Expected State Character might expect compatriot to be patrolling, therefore expects to see patrolling behavior Unconsciousness would be unexpected and dealt with according to the game

Character Introspection Suggested questions that agent should ask itself in an emergent environment Ownership is this mine? Dependency is there something I need to do before x? Responsibility what am I supposed to be doing? Relevance how will my actions affect gameplay? Priority whats most important right now?

Consciousness am I conscious? Expected state is everything as I expect it to be? Others how will what I do affect other NPCs Coordinated Behavior Splitting Up Dont have all agents take the same path Solutions Reserve path

Agents reserve pathfinding nodes for themselves so that everyone doesnt go the same way Adopt maximum occupancy rule Only allow a certain number of agents at a given location Use inter-agent communication to find out what other agents are doing and plan accordingly

Getting Out Of The Way Obstruction by ally can be resolved in 4 ways (regarding firing) Do nothing Fire anyway (killing ally)

Agent moves Ally moves Inter Agent Communication Efficient and intelligent utilization of inter agent communication can enable the agents to behave, as a group, much more intelligently than they otherwise might NPC can share knowledge with another NPC NPCs can coordinate behavior

More Humanlike NPCs Sensory Perception (1) First step in making an NPC more humanlike Tactile Achieved through collision detection systems and smart terrain Range Immediate surrounding area on all sides

Sensory Perception (2) Visual Need to model NPC visual system after a person Sensing region should be cone shaped should extend to limited distance in front of agent to simulate binocular vision Lighting conditions can effect NPCs sight realistically Audio Sound attenuates with distance therefore NPC hearing should degrade with distance from sound

NPC should be able to hear same things player can hear Sensory Perception (3) Olfactory Smell should be emitted across some radius depending on strength of smell Smell should deteriorate over time as disperses or get stronger over time if appropriate Corpse smells worse as time goes by

Taste aka Gustatory sensing Not used very often, could be used for game beasts they could get more aggressive when taste raw meat Memory Humans have 3 different kinds of memory Sensory, short term, long term NPC memory

Sensory memory linked to sensory input Short term memory accomplished by utilizing timestamp degradation and importance levels Many ways to implement long term memory Size management can become an issue Personality Model The Big Five Extraversion, agreeableness, conscientiousness, neuroticism, openness

Implement via a desirability algorithm Add bias to decision algorithms depending on agent personality Emotions Eight primary emotions in people Joy, acceptance, fear, surprise, sadness, disgust, anger, anticipation Current game emotions generally scripted

Could implement such that different actions instill different emotions Killing an NPC could invoke sadness, disgust, fear, etc Emotions An Implementation One way that Emotions could be given to an agent is by providing an emotional model to the system Could be divided into 3 parts

Input Internal reaction External Reaction Human Emotions Are three popular theories to how we interpret emotion from external stimulus After external stimulus emotional state alters as result of physiological state change Physiological and emotional states simultaneously affected after receipt of

stiumuls Emotional states determined by perceived cause of stiumulus NPC Emotion Example implementation from IPD for Emotional NPC Societies in Games 5 basic emotions modeled Fear, anger, disgust, sadness, happiness Implementation of Norms was included to

include social acceptability of an action as a consideration Drives included to simulate real world stimulus Social, energy, rest, and heat Physiological Stressors Anything that causes significant change in human body to occur Muscle fatigue, pain, health, anxiety/fear, exposure to cold/hot/chemicals, hunger

If agent is hot, should be sweating If agent comes into contact with chemicals, should receive chemical burns

Recently Viewed Presentations

  • Parts of a Friendly Letter - Mrs. McCloud

    Parts of a Friendly Letter - Mrs. McCloud

    Mrs. K. Lewis Parts of a Friendly Letter 5 Parts of a Friendly Letter The Heading The Greeting The Body The Closing The Signature Heading Heading ---> 455 East Main Street Mableton, GA 30126 December 1, 2009 The heading of...
  • Planning your analysis - sheffield.ac.uk

    Planning your analysis - sheffield.ac.uk

    Statistical Analysis Cycle. Some useful approaches to analysing data. By the end of this session you should be able to: ... this is the total number of hours I slept during the week. Then I apply a method to calculate...
  • Applying Online to Colleges in Ontario

    Applying Online to Colleges in Ontario

    APPLYING ONLINE TO COLLEGES IN ONTARIO REASONS TO ATTEND COLLEGE Diversity of programs and locations Tuition savings Smaller class sizes Hands on work experience 84% of students found employment within 6 months of graduation Offer University degree programs with easier...
  • AA - idop.org

    AA - idop.org

    Imprisonment Murder. Physical abuse. Rape. Death Threats. Emotional abuse. Destroying places of worship. Assassination Attempts. Economic Persecution(the deliberate imposition of substantial economic disadvantage)
  •  Describe the object. What does it look like?

    Describe the object. What does it look like?

    Sneaky Info. Shot. the use of the template pattern sentences, combined into the piece in such a way that the reader doesn't recognize the original template pattern sentences. Example: I love my playful dog. Although he is nearly the size...
  • Advances in therapy in Diffuse Large Cell B

    Advances in therapy in Diffuse Large Cell B

    Advances in therapy in Diffuse Large Cell B cell and Follicular Lymphoma Dr Robert Marcus Kings College Hospital London * This was a RCT of 4 chemotherapy regimens developed for treatment of DLBC lymphoma.
  • Blockchain Loyalty 1Commercial-in-Confidence 2017 LoyaltyX The problem: Loyalty

    Blockchain Loyalty 1Commercial-in-Confidence 2017 LoyaltyX The problem: Loyalty

    University Of NSW (Sydney) Q4-17. Members earned Ether cryptocurrency for transacting at 12 campus retailers. vs . 59%. for their favourite loyalty program. 78%. rating. for motivating spend at retailers. vs . 57%. for their favourite loyalty program. 85% ....
  • Pointer Authentication

    Pointer Authentication

    ARM 8.3-A Pointer Authentication. 64-bit pointer. Pointer Authentication Codes (PAC) Tweakable MAC. Set in unused bits of virtual address. Key/configuration set at higher privilege level. Instrument with new PAC handling instructions. Opcode determines used key. Operands set PA modifier (tweak...