# Using behaviorTree vs coding in AIController

**URL:** <https://forums.unrealengine.com/t/using-behaviortree-vs-coding-in-aicontroller/477897>\
**Category:** C++\
**Tags:** Behavior-Tree, aicontroller, unreal-engine, CPP, question\
**Created:** [January 28, 2021, 9:16am UTC](https://forums.unrealengine.com/t/using-behaviortree-vs-coding-in-aicontroller/477897 "2021-01-28T09:16:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![11Mdp](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@11Mdp](https://forums.unrealengine.com/u/11Mdp)\
**Post date:** [January 28, 2021, 9:16am UTC](https://forums.unrealengine.com/t/using-behaviortree-vs-coding-in-aicontroller/477897/1 "2021-01-28T09:16:24Z")

</div>

Hello everyone!  
I started studying BevahiorTrees and BlackBoards, and I can’t wrap my head around something.  
Are they suggested for some reason? Can’t I do the same things with code inside the AIController?  
I recognize that for most people BehaviorTrees may feel and look more intuitive, but having been a programmer for long, I feel more confident and see more clarity using the code directly.  
Are there any particular disadvantages in writing the AI logic directly in C++? Does BehaviorTree have any optimization/advantage?

Thank you!

---

<div class="post-metadata">

**Author:** ![acxsasx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@acxsasx](https://forums.unrealengine.com/u/acxsasx)\
**Post date:** [February 3, 2021, 2:19am UTC](https://forums.unrealengine.com/t/using-behaviortree-vs-coding-in-aicontroller/477897/2 "2021-02-03T02:19:17Z")

</div>

Behavior Trees are built a built in AI structure so you don’t have to roll your own. They are optimized to not run from the top every time. You can extend them in C++ with a bit of work to minimize the visual aspect.

I decided to use the MARPO Methodology from AI Gaming Wisdom 4, pg 239. I have no idea if it is better or not as I am too early in the use of it.

I subclassed the brain component to assign to the subclassed AI character which then calls the appropriate classes to run the subtasks.
