Well I'm back, had a great conference and have dived into implementing the stack-based behaviour tree I discussed here before leaving.
One design change I found necessary was to add another status, BT_NOT_STARTED, to use in resetting and initialising nodes.
Revision 4907 switches from the previous 2009 method of parsing the entire tree every frame to passing a single node every frame. This will make the method far more scalable and should help with debugging as progress can now be tracked in the behaviour tree's stack. This is a significant revision that is key to this part of the project. If there are any comments in particular on this revision I am very keen to hear them.
In a smaller commit, revision 4906 merged all changes from whilst I was away and since I began coding. I intend to complete these merges at least once a fortnight to make the eventual process of merging my branch to trunk far simpler.
That's all for this week, next week I intend to add more to the debugging tools by making better use of the status BT_UNEXPECTED_ERROR and starting to look into loading from XML and making a dedicated propclass for the behaviour tree. Any suggestions either here, by email/mailing list/irc are always appreciated.
First, to quickly wrap up last week's discussion of the problems with a few apps hanging, I have raised a ticket covering this problem (Ticket 103) and will look to help with a solution later into the summer once I am sure to have met the planned deadlines.
This week work moved on to focus on beginning to implement event driven behaviour trees (BTs). I spent some time studying openly available implementations and have made some initial decisions that I would like to discuss briefly.
The current CrystalSpace BTs parse the entire tree every frame starting from the root node. This will obviously not scale well to large trees or games with many trees. Event driven BTs instead remember where in the tree they have reached and parse only active nodes on each callback.
Therefore, my intention is to add a stack of pointers to BT nodes to the behaviour tree and pass a pointer to this to a node when it is executed. This way parent nodes can push their child nodes to the stack instead of calling their children themselves. Then when the behaviour tree receives it's callback it only needs to execute the top node on the stack.
This will reduce the number of nodes executed per callback to a constant number. It should also help with debugging, as by watching the stack a developer can understand which nodes in the tree are being executed and which path has been taken to reach there.
Furthermore, this should allow me to easily add the function of being able to control the rate of updating a BT as the top node can be executed multiple times per callback (with the callback set to either every frame or by time.) On each execution of the top node the subsequent top node may change and so repeat execution of the top node is effectively parsing through the tree.
Whilst exploring existing implementations and designing our solution I noticed that the easiest milestone to add first was Christian's suggestion of extending the termination statuses. Previously a node would indicate only success or failure on termination, but now (as of revision 4899) a failing node can indicate whether it failed cleanly or whether it has exited unexpectedly. (For more detail on why this is useful please see this article.)
This revision will be used more in the upcoming work on event driven BT's as a parent node will want to check the final status of a child node once the child has terminated and the parent has returned to the top of the stack. To do so I intend to add the current status of a node as a public variable of the iBTNode interface.
Please feel free to comment on this blog, email me on the mailing list or catch me in the IRC channel if you have any comments or suggestions.
As mentioned in my proposal I am now leaving for a conference, and so will not be updating the blog next week nor likely to commit any code. However, I do have my linux laptop with me and the source code checked out, so I may get time to think more about the design and look further into prop classes and existing XML code in CEL (as needed for the later BT milestones.) I will update the blog again Friday 15th June.
See you all in 2 weeks time, Sam.
As the first week of GSoC is coming to an end, I thought it best to update the blog with my progress so far. I intend to (as I did previously during GSoC 2009) post weekly on Fridays with quick updates for anyone interested in following the project.
This week has been mostly occupied by getting bttest to work again. It seems there may be a bug in trunk that is causing bttest (and graphtut, steering and walktut) to hang. I have not solved the problem but I have commited a workaround to my branch in revision 4893. If anyone else is having the problem or has suggestions to fix this please join in the conversation on the mailing list (Archived here.)
Revision 4893 also contains a workaround fix to get plgtcpnetwork to compile as DebugWithDLLs in Windows. Which may also be a general problem at this time in trunk.
The final changes in revision 4893 are what I needed to overcome compilation and linking errors in appelcmtst, plg_guiinventory and plg_guiinventory2 due to CEGUI. I think from the discussion on the mailing list these changes were needed only by me.
Since overcoming these difficulties, I have fixed a minor but significant bug in the bttest app that stopped the tree from being evaluated (see revision 4897.)
I now have a working bttest app, a better understanding of my code from 2009 and am ready to start implementing event driven behaviour trees next week.
A quick update and thank you to all who have helped me out the past couple of weeks. Thanks to the mailing list and in particular Christian's efforts I now have a fully compiled and up to date CS and CEL. I have refamiliarised myself with svn-merge.py (I typically use TortoiseSVN but wanted to stick to the tools other CS developers are using for this project), and with my code from the previous GSoC project on behaviour trees. I now feel ready and keen to start coding next week in time for the official start of GSoC.
I include below my proposed timeline and goals, with priorities labelled 1-3 with 1 being the highest:
-Update to event driven BTs (May 21st – July 1st)
(1) -- Focus on debug tools
(2) -- Allow all termination statuses
(2) -- Add load from XML option
(2) -- Create dedicated propclass (set root node, set update rate)
(1) -- Documentation
-Update to latest version R&D (July 1st – July 29th)
(1) -- Allow iPcSteer to use its methods
(2) -- Partial navmesh loading (with missing sector callback)
(2) -- Make navmesh creation parallel
(3) -- Improve function with portals
(3) -- Optimise debug mesh
(3) -- Optimise Terrain
(1) -- Documentation
-Improve life sim demo (July 29th - August 13th)
(1)-- Make behaviours work (perhaps requiring other new propclasses or
fixes to existing ones)
(1)-- Use new BTs and R&D
During this time, I will have one significant break (as mentioned in my proposal) from June 2nd-12th when I will be attending a conference in Valencia. Other than that I am excited to be back and keen to get started :)
Hello CrystalSpace and thank you for again choosing me for GSoC.
Coding begins again May 21st, before then I will be updating this blog with plans for the new project and getting up to scratch with the recast and detour code.
If anyone has any suggestions for behaviour trees, recast and detour or the life-sim demo please contact me :)
Excited to get started again.
|<< <||> >>|