NPC Perception Design

From PSwiki
Revision as of 23:20, 12 October 2010 by Talad (talk | contribs) (Created page with 'See Behaviors_and_Reactions for most up to date description of perceptions. ---- This embodies any perception an NPC might have, or any game event of interest. Reaction obj…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

See Behaviors_and_Reactions for most up to date description of perceptions.


This embodies any perception an NPC might have, or any game event of interest. Reaction objects below will subscribe to these events, and the networking system will publish them. Examples would be "attacked", "collided", "talked to", "hear cry".



NPC Perceptions

RangePerception

TimePerception

The Game Server sends a Time perception once per game hour to all superclients, with a number from 0 to 23 indicating the hour. If a superclient needs more fine-grained time reactions, the superclient can generate time perceptions of its own in between and react accordingly.

This perception allows npcs to change behaviors or state depending on the time of day. For example, you could have nocturnal hunting creatures who sleep during the day, or npc city merchants who are in their shops during the day and at home at night.


Example:

 <react event="time" value="8,0,,,"  behavior="go_other_sector1" delta="20" />

FactionPerception

ItemPerception

Whenever an NPC is close to an item, this perception is passed to the npc.

LocationPerception

Whenever an NPC is close to an location, this perception is passed to the npc.

AttackPerception

Whenever an NPC is attacked by a player, this perception is passed to the attacked npc. The npc should use this to build an initial hate list for the player and his group (if any). If the designer wants to cheat, he can start attacking back on this event instead of on first damage, and save a few seconds in response time.

Example:

  <react event="attack"  behavior="fight" delta="150" />

GroupAttackPerception

Whenever an NPC is attacked by a grouop, this perception is passed to the attacked npc. The npc should use this to build an initial hate list for the player group. If the designer wants to cheat, he can start attacking back on this event instead of on first damage, and save a few seconds in response time.

DamagePerception

Whenever an NPC is hit for damage by a melee hit or a spell, this perception is passed to the damaged npc. Right now, it affects his/her hate list according to the weight supplied.

SpellPerception

Whenever a player casts a spell on himself, another player, or any npc, this perception is passed to npc's in the vicinity. We cannot only use targeted NPCs because an npc in combat may want to react to a player healing his group mate, which helps his team and hurts the NPC indirectly. Right now, reactions are allowed by type of spell, and depending on the severity, it affects his/her hate list according to the weight supplied.

DeathPerception

The network layer is notified of any deaths from players or NPCs on the server. This perception is passed to all NPCs so they can react, by removing the player from hate lists, stopping their combat or whatever.

InventoryPerception

This perception is used when a item is added or removed from inventory.

OwnerCmdPerception

Whenever an NPCPet is told by it's owner to stay, this perception is passed to the NPCPet. Right now, it changes the current behavior of the NPCPet.

OwnerActionPerception

Whenever an NPCPet is told by it's owner to stay, this perception is passed to the NPCPet. Right now, it changes the current behavior of the NPCPet.

NPCCmdPerception

Whenever an NPC Cmd is received this perception is fired. This is most typicaly from a response script like: <npccmd cmd="test_cmd"/>