I have finally completed my first roadmap step and successfully released first alpha version:
FOnline: Vault 112 v0.1.0-alphaIt is still in alpha state, but it should be more-less stable and it provides Virtual Reality, which can be used by single player or small group of players using local server to have some (isolated) fun.
Behavior Tree SystemWhat might be more interesting for FOnline developers is remade system for defining NPC behavior. As server is run using Mono integration, also the Behavior Tree system is done in Mono. This system is based on common concept of trees that specify AI behavior of NPC in games. Some info can be found
here and also on
Google.
Package with logic and tasks for Behavior Tree System (BTS) can be found in
Server/mono/FOnline.Server/BehaviorTrees directory.
Example of creating such a behavior tree can be found in classes contained in
Server/mono/FOnline.Server/Roles directory.
Simple example how these trees can be specified:var builder = new CritterBehaviorBuilder (critter);
builder
.Do (new CallReinforcements (BlackboardKeys.Attackers))
.Do (new TakeDrug (ItemPack.HealingDrugs)).If (new IsHurt (70))
.DoSequence ("20% to find weakest player and attack him instead")
.Do (new AtFixedRate<CritterBlackboard> (Time.RealSecond (10)))
.Do (new AtChance<CritterBlackboard> (20))
.Do (new FindCritters (Find.Life | Find.OnlyPlayers).Choose (new Weakest ())).If (new IsSeen ()).IfNot (new IsTeamMember ())
.Do (new Attack ())
.End ()
.DoSequence ("Attack every non member")
.Do (new FindCritters (Find.Life)).If (new IsSeen ()).IfNot (new AmAttacking ()).IfNot (new IsTeamMember ())
.Do (new Attack ())
.End ()
.Do (new ProvideReinforcements ()).IfNot (new AmAttacking ());
Global.RegisterBehaviorTask (builder.MainTask);
This code specifies behavior for "evil" human critter in encounter in which:
- Calls team reinforcements on its attackers.
- Tries to take healing drug, if its HP is under 70% of maximum HP.
- It checks every 10 seconds and there is 20% chance that it will start attacking weakest enemy instead of current one.
- It attacks every critter that is not part of his team.
- Provides reinforcements for other team members.
This way it is possible to specify behavior for NPCs in game, whether it is town AI system or mobs in encounters. Also it is possible for designer (someone who is not experienced in programming) to specify such a behavior tree using diagrams and then it will be implemented by someone with programming experience.
There are currently some basic tasks for Critter entity contained in the project, but there will be more of them created as the time passes by.