CodenameG,
I'm not asking for one big .cs file, I'm asking for one small and simple .cs file. Your guide is great, by the way -- it helped me start developing CustomClasses. Keep up the good work.
Chinajade and CodenameG,
I don't think you two quite understand exactly what I'm getting at (or perhaps I explained myself poorly) -- the wiki has fantastic documentation that explains (in quite some detail) exactly what each type of node does and how it fits into the greater picture. That documentation is fantastic and serves a fine job of
complementing a developer's knowledge using the BehaviorTree model. What it does not do, however, is provide you with the knowledge to start coding a BehaviorTree CC.
Take, for example, the simple action of casting a spell. Using the HB API, the normal code to do this would be something akin to the following:
Code:
if (SpellManager.CanCast("spellname")
{
Spellmanager.Cast("spellname");
}
Using TreeSharp, the following would be used instead:
Code:
return new Decorator(ret => SpellManager.CanCast("spellname"),
new Action(ret => SpellManager.Cast("spellname"))
);
To me (as a developer who has used C# and C++ extensively in the past) the giant leap between the two was hard to wrap my head around -- not because of the complexity of TreeSharp, as it is really quite simple for the CC developer once you understand it, but rather because of lack of understanding how everything fits together practically.
I think it is because we only have two sources of code to look at for inspiration:
1) existing CustomClasses coded to make use of BehaviorTrees, which, for the most part, are gigantic in scale and the code is
very difficult to navigate, or
2) the wiki article(s), which provides a few code fragments but nothing that I could take and apply to building a CustomClass without searching through numerous CustomClasses to understand how everything fits together practically.
As another example, take the following code:
Code:
private Composite _combatBehavior;
public override Composite CombatBehavior
{
if (_combatBehavior == null)
{
_combatBehavior == CreateCombatBehavior();
}
return _combatBehavior;
}
private Composite CreateCombatBehavior()
{
return new Decorator(ret => SpellManager.CanCast("spellname"),
new Action(ret => SpellManager.Cast("spellname"))
);
}
If I was given this code and ran it in Honorbuddy, I would clearly see it casts a simple spell. After a little contemplation and logical deduction I would understand that _combatBehavior is built once when CombatBehavior is called, and I would have the knowledge required to build upon that -- I could add in new decorators, actions, priorityselectors, etc, simply put I could use the knowledge offered in the wiki.
I think the best way to ease an existing C# developer into the mindset of a BehaviorTree developer is to provide simple code examples that can be immediately placed into Honorbuddy and run. While the examples offered in the wiki are fantastic to teach one about each individual node type, no documentation exists which -- quite simply -- displays a CC, in full, that casts one simple spell, and I think if that documentation were to exist, the transition between traditional HB development and BehaviorTree development would be oh-so-easier for many people.
edit: just browsing through the wiki once again and I've noticed the following article that is currently empty.
http://www.thebuddyforum.com/mediaw...ow_to_hook_your_Behavior_Tree_into_Honorbuddy
That is exactly what I was looking for and I think that once it has been written life will become much simpler for programmers interested in this advanced topic of development.