Kotlin LibGDX/KTX RPG Tutorial - Part 20 (Behavior Tree)
This is a tutorial series about game development using Kotlin, LibGDX with LibKTX extensions.
We are developing a small 2D adventure RPG using different technologies like Box2D, GdxAI, Entity Component System or Tiled.
The full source code of the tutorial can be found on github: https://github.com/Quillraven/MysticWoods
Part 20 - Behavior Tree:
In this part we are going to learn how to implement AI behavior trees. We will create a small AI for our slime enemies which can wander around, be idle, or attack.
Link to behavior tree wiki: https://github.com/libgdx/gdx-ai/wiki/Behavior-Trees
Chapters:
00:00 - Introduction to Behavior Tree
04:16 - Leaf Task
05:45 - Composite Task
07:22 - Guard
08:25 - slime.tree file
14:20 - AI component
17:45 - AI ComponentListener
20:45 - Update EntitySpawnSystem
23:00 - AI system
24:55 - Update PhysicSystem
29:20 - Abstract Action
33:40 - IdleTask
38:41 - TaskAttribute
42:36 - Idle duration
45:20 - GdxAI Timepiece
47:22 - WanderTask init
50:17 - AiEntity position
51:15 - WanderTask logic
53:45 - AiEntity wander logic
1:00:00 - Result of idle and wander AI
1:03:40 - Attack subtree
1:07:35 - Abstract Condition
1:09:10 - CanAttack and IsEnemyNearby condition
1:10:14 - AiEntity hasEnemyNearby
1:12:45 - AiEntity canAttack
1:18:10 - AttackTask
1:20:10 - Minor fixes to attack AI
1:22:19 - Result of attack AI
1:22:50 - Final words