Author Topic:  Behaviour Node Documentation  (Read 5817 times)

0 Members and 1 Guest are viewing this topic.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Behaviour Node Documentation
« on: January 03, 2016, 09:44:59 AM »
This topic will document each behaviour node.

General Behaviour Tree Help

Logic:
Dialog: NPC Dialog.
Exit: Returns control to the most recent Update node.
Proxy: Insert a sub behaviour tree.
Update: Causes continual updating (execution) of the tree.

Actions:
Attack: Attack the NPC's current target.
ChangeState: Change the NPC's main state.
Deactivate: Deactivate the NPC.
Equip: Equip hands with items from inventory.
Flee: Flee the NPC's current target.
Follow: Follow the NPC's current target.
Health: Increase or reduce current Health.
Jump: Cause the NPC to jump.
LookAt: Control what the NPC should look at.
Message: Send information to other NPC's.
Move: Move the NPC.
Properties: Set various properties for the NPC.
Script: Execute a script.
StandStill: Cause the NPC to stop moving.
SwingHand: Cause the NPC to swing a hand.
Timer: Perform actions based on a timer.
Wait: Wait for an amount of time before continuing.
Wander: Wander around a defined area.

Conditionals:
FindTarget: Find a specific target.
HasHistory: Query (player) history.
IsAge: Query age.
IsBlock: Query what block is at a location.
IsDistance: Query distance.
IsEquipped: Query if specific items are currently equipped.
IsHealth: Query health.
IsInZone: Query if inside a zone.
IsRandom: Perform actions based on randomness.
IsTargeted: Query if the NPC is currently targeted.
IsVisible: Query what other NPC's or players are visible.
« Last Edit: January 04, 2016, 08:48:34 PM by Craig »

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Behaviour Node Documentation
« Reply #1 on: January 04, 2016, 04:18:02 AM »
General Behaviour / Dialog Tree Help

Behaviour Trees are used to control NPC behavior.
Dialog Trees are used to control how NPC's interact/talk with players.
Dialog Trees are actually just Behaviour Trees but tailored for dialog.

Behaviour/Dialog Trees are made up of Nodes. Each Node controls the NPCs behaviour in a specific way. Each node has a set of properties which exactly define that behaviour.

Each Node can have both siblings and children. On the Behaviour Tree Design screen, a Nodes children are positioned to the right of the (parent) Node, and the Nodes siblings are positioned below the Node.



The first (red) node is the Tree Root node. Every Tree has a Root node. It does not do anything except serve as the ultimate parent of all the nodes in the tree. The Root node has child nodes that form the tree, but cannot have sibling nodes. The Root node is the only node that cannot have siblings. The name of the Root node is the name of the Tree.

In the image above, the Root Node has three child nodes, IsVisible, IsTargeted and Wander. These three nodes are siblings (children of the same parent). Child nodes are always shown to the right of the parent. Sibling nodes are always shown below (or above) each other.

The Equip node shown to the right of IsVisible is the first child node of IsVisible. IsVisible has two children. Equip and Standstill. The Equip node has one child node Follow. Standstill has no children. Follow has no children and no siblings.

IsTargeted is a sibling of IsVisible and Wander. It has one child node Script, which also has one child node Message, and no siblings. Message has no children and no siblings.

Wander has no children.

Order of execution:

A Node is an execution point. The Node is executed and at the end of execution the Node has either a Success or Failure state.

When execution of a Behaviour or Dialog Tree begins, the first node to be executed is the first child node of the Root node. In the image above, that is the IsVisible node.

When the node execution completes, if the state is Success, the next Node to execute is the nodes first child node (node displayed on immediate right). If the Node has no children, execution of the Tree terminates. In the case of the IsVisible node above, the next node to execute would be the Equip node.

If the state is Failure, the next Node to execute is the nodes next sibling (node displayed immediately below). If the node has no siblings or is the last sibling, execution winds back to it's parent's next sibling. If the parent is the last sibling, execution winds back to it's parent's next sibling. If there are no more siblings of parents, execution of the Tree terminates. In the case of the IsVisible node above, the next node to execute would be the IsTargeted node.

So the full execution path of the Tree in the image above would be:

IsVisible is executed first
If IsVisible succeeds
  Equip is executed next
  If Equip succeeds
    Follow is executed next
      Tree execution terminates
  If Equip fails
    Standstill is executed next
      Tree execution terminates
If IsVisible fails
  IsTargeted is executed next
  If IsTargeted succeeds
    Script is executed next
    If Script succeeds
      Message is executed next
        Tree execution terminates
    if Script fails
      go to If IsTargeted fails
  If IsTargeted fails
    Wander is executed next
      Tree execution terminates

tbc..

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Behaviour Node Documentation
« Reply #2 on: January 04, 2016, 04:18:20 AM »
Dialog: NPC Dialog.

Used to create of conditional multi-branched dialog with NPCs.

Properties:

Text: The dialog text. This is some dialog the NPC will say to you or you will say to the NPC.
« Last Edit: January 04, 2016, 08:53:20 PM by Craig »

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Behaviour Node Documentation
« Reply #3 on: January 04, 2016, 04:18:33 AM »
Exit: Returns control to the most recent Update node.
« Last Edit: January 04, 2016, 08:49:06 PM by Craig »

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Behaviour Node Documentation
« Reply #4 on: January 04, 2016, 04:18:43 AM »
Proxy: Insert a sub behaviour tree.
« Last Edit: January 04, 2016, 04:28:48 AM by Craig »

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Behaviour Node Documentation
« Reply #5 on: January 04, 2016, 04:29:14 AM »
Update: Causes continual updating (execution) of the tree.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Behaviour Node Documentation
« Reply #6 on: January 04, 2016, 04:29:28 AM »
Attack: Attack the current target.

By default, the NPC will move within strike range before striking.

Properties:

Exclude Types: Actor types the NPC should not attack.
« Last Edit: January 04, 2016, 08:56:10 PM by Craig »

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Behaviour Node Documentation
« Reply #7 on: January 04, 2016, 04:29:42 AM »
ChangeState: Change the NPC's main state.

Properties:

NewState: The state to change the NPC into.

Alive: The NPC is alive and well.
Dying: The NPC has died. The death throes animation will be played.
Respawning: The NPC is spawning for the first time, or respawning from death.
Despawning: The NPC is despawning. The despawn animation will be played.
Sleeping: The NPC is sleeping.
InActive: The NPC is no longer active and will be removed from the game world immediately.
« Last Edit: January 04, 2016, 08:59:53 PM by Craig »

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Behaviour Node Documentation
« Reply #8 on: January 04, 2016, 04:29:54 AM »
Deactivate: Deactivate the NPC.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Behaviour Node Documentation
« Reply #9 on: January 04, 2016, 04:30:07 AM »
Equip: Equip hands with items from inventory.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Behaviour Node Documentation
« Reply #10 on: January 04, 2016, 04:30:19 AM »
Flee: Flee the NPC's current target.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Behaviour Node Documentation
« Reply #11 on: January 04, 2016, 04:30:33 AM »
Follow: Follow the NPC's current target.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Behaviour Node Documentation
« Reply #12 on: January 04, 2016, 04:30:47 AM »
Health: Increase or reduce current Health.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Behaviour Node Documentation
« Reply #13 on: January 04, 2016, 04:31:01 AM »
Jump: Cause the NPC to jump.

Craig

  • Developer
  • Extreme Member
  • ******
  • Posts: 6650
  • Dig Deep
  • Awards Developer 5 years on site 4 years on site 3 years on site 2 years on site Was in the top 10 of the forum stats page as of 4/12/15 Members who have unlocked the robotic avatar 1 year on site Day 1 w/25+ posts (4/12/13)
    • View Profile
    • Twitter
    • Awards
  • Steam: tota1miner
Re: Behaviour Node Documentation
« Reply #14 on: January 04, 2016, 04:31:15 AM »
LookAt: Control what the NPC should look at.