BehaviorTree Implementation

Hello! I am working on a BehaviorTree (https://en.wikipedia.org/wiki/Behavior_tree_(artificial_intelligence,_robotics_and_control)) implementation. I need the BehaviorTree to be serializable so that it can be saved and loaded, as such I am trying to figure out how to store the leaf nodes or Tasks.

My initial thought was to have a public class in my namespace that just held a bunch of static methods. Each method corresponding to a Task. A leaf node would hold the string of the method name and invoke the method via the System.Reflection library.

I then thought about a second method of using OOP to create a base class of BehaviorTreeTask and then derive new classes for each type of Task, each one overriding a base PerformTask method.

I have been spinning my wheels over which implementation to go with. I could use some help in discussing the pro/cons or even talking about another method of achieving the same result.
A behavior tree is a mathematical model of plan execution used in computer science, robotics, control systems and video games. They describe switchings between a finite set of tasks in a modular fashion. Their strength comes from their ability to create very complex tasks composed of simple tasks, without worrying how the simple tasks are implem...
Was this page helpful?