'Behavior Tree' basic tutorial for RPG citizen

This is very basic tutorial but the contents of the official document are omitted.
Official document :
https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/QuickStart/

Behavior Tree is a concept unfamiliar to many people.
The links below have been very helpful in understanding a behavior tree :
https://en.wikipedia.org/wiki/Behavior_tree_(artificial_intelligence,_robotics_and_control)

Official Unreal tutorial is great but in this time, we will make more simpler one.
So, let's implement a general RPG game NPC AI.

Step 1. Plan

NPC have 3 tasks.

  •  Wandering : Go here and there(where 'note' actor placed).
  •  Look around : Do rotate for a while.
  •  Angry to player : Keep watching player till go out of sight.


Step 2. Behavior tree

This is the final behavior tree result.
We will make 3 custom tasks and 1 custom decorator.
(If we have the opportunity, I will cover more in other articles)

Make new 'Task' blueprints.


Step 3. RPGPlayerCharacter

Player can block NPC.
See not 'Begin Overlap event' but 'Hit event'.

Step 4. CitizenAI Controller

Run Behavior Tree. There is not even blackboard in this tutorial. But you can see how to use 'blackboard' in official UE4 document.

Step 5. LookAroundTaskBlueprint

If you are a first time user, you do not know where to start.
If you click on 'override' in the upper left corner, you can find the starting point according to the situation.

Open popup menu and type 'behavior tree', 'AI' or 'Event'. You can see what you can more.

In this time, You can see 'Finish Execute'.
The return value is a true / false value to determine the progress of the 'Selector'.

Step 6. CitizenWanderTaskBlueprint

Nothing special. Find a 'note' and go there.

Step 7. AngryTaskBlueprint

Keep watching player till go out of sight.

Step 8. IsAngryCitizenDecorator

Specify whether to pass true or false.
 

Step 9.

Set AI Controller Class.


More

There are many features not covered. Let's make a more complex version later...

Comments

  1. Hi, did you make a tutorial for explain and show how to make every step of this article ?

    ReplyDelete

Post a Comment

Popular posts from this blog

Liquid material in a bottle

MatCap material

How to Make Circular Progress Bar(or Rounded Rectangle)