NPC Perception Design: Difference between revisions

From PSwiki
Jump to navigation Jump to search
Magodra (talk | contribs)
Magodra (talk | contribs)
Line 109: Line 109:


=== Perceptions used from locate operation ===
=== Perceptions used from locate operation ===
The locate operation can locate objects of type perception. For this to make sence the perception need to implement the GetTarget
The locate operation can locate objects of type perception. For this to make sence the perception need to implement the GetTarget.
 
<uml>
participant Reaction
participant LocateOperation
participant NPC
participant Perception
 
== During Perception Handling ==
 
Reaction --> NPC : SetLastPerception
 
 
== During Script Execution ==
 
[-> LocateOperation : Run
Activate LocateOperation
 
LocateOperation -> NPC : GetLastPerception
Activate NPC
 
LocateOperation <-- NPC
Deactivate NPC
 
LocateOperation -> Perception : GetLocation
Activate Perception
 
Perception -> Perception : GetTarget
note right: Default behavior get location from target if there is one.
activate Perception
deactivate Perception
Perception --> LocateOperation
Deactivate Perception
 
LocateOperation -> NPC : SetLocate
Activate NPC
LocateOperation <-- NPC
Deactivate NPC
 
alt destination == "Active"
  LocateOperation -> NPC : SetTarget
  Activate NPC
  LocateOperation <-- NPC
  Deactivate NPC
end
 
[<-- LocateOperation
Deactivate LocateOperation
 
</uml>




[[Category:Engine documents]] [[Category:NPCClient Design]]
[[Category:Engine documents]] [[Category:NPCClient Design]]

Revision as of 14:34, 6 April 2013

See Behaviors_and_Reactions for User details about how to use Perceptions in the behavior.xml file.


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

Class Hierarchy

The Perception class is used for simple perception and as the Base Class for a number of special perceptions.

Special Perceptions:

  • TimePerception
  • FactionPerception
  • ItemPerception
  • LocationPerception
  • PositionPerception
  • AttackPerception
  • GroupAttackPerception
  • DamagePerception
  • SpellPerception
  • DeathPerception
  • InventoryPerception
  • OwnerCmdPerception
  • OwnerActionPerception
  • NPCCmdPerception

Sequences

Personal NPC Perceptions Sequence

Show the typical sequence for a Perception fired for a NPC, might be perceptions like Damage Perception.

Broadcast NPC Perceptions Sequence

Show the typical sequence for a broadcasted Perception. Examples of broadcasted perceptions is the SpellPerception.

Special cases

Perceptions used from locate operation

The locate operation can locate objects of type perception. For this to make sence the perception need to implement the GetTarget.