Sunday, February 08, 2009

Behavior Tree XML

Previously I was working on parsing XML for the game entities and thought I'd continue through to actually parsing the AI setup from that effort. So now after a few hours work (which included a lot of refactoring and there's a ton left to do of that) I can now actually specify an XML file as part of the AIComponent specification in the GameObject's XML.

Here's a typical GameObjects XML:


Arrgh, it wont display XML! :)


Hopefully you can see here that the game object has a number of components. In this case, the AI component (a gamecomponent of type "AI") has a tree specified as another XML file. When I parse the AIComponent spec, I'm basically passing that xml file spec to the AIComponent, which instantiates the AIActor class with the given XML file, which then loads the Behavior Tree of the actor with it. Long winded, but certainly much more flexible than before.

Now I've got to refactor some of the blackboard code to do the same thing I think. Although I need to do more work there to allow arbitrary values to be added, queried and removed. CRUD as I believe the acronym goes.

So now I can play with different priority values easier. But its still not as flexible as runtime tweaking. I guess the next big step is to add Lua or some other scripting engine into the codebase. Can't say I'm a massive fan of Lua's syntax though, might try GameMonkeyScript or AngelScript.

The other option, is to make myself a network proxy interface and allow this kind of tweaking to work via the network. Essentially this means that I need an object attribute system (I already do) which then works transparently over a network, which is pretty simple. Then I just code a nice C# app that does remote inspection of the various objects+attributes and bobs your uncle. Or auntie if you have a weird family :)

Right, onwards..

.Z.

No comments:

Post a Comment