SimpleAI-Debugger

SimpleAI

The last few days I worked quite some time on a new project called SimpleAI. It's now almost in a state to release 0.1.

What is SimpleAI?

SimpleAI is a small and (hopefully) easy to use C++ library for behaviour tree based AI. It's main focus is about games - but of course it can be used for other things, too.

The project is released under the MIT license and thus can be used for open source as well as commercial and closed source projects. If you use it, it would be nice to provide a link to the github page, but it's really not needed.

What does it include?

  • SimpleAI includes a network based remote debugging interface. A QT5 based remote debugger is part of the project, it helps to visualize the state of your AI controlled entities.
  • It also has support for loading your behaviour trees from whatever data source you want. And as an example loader it offers a LUA based scripting interface to build your trees.
  • There are some default actions and conditions as well as a small amount of selectors that are already part of the base library. It's up to the user to extend the set of actions and conditions.
  • It also features an aggressive management for your entities with several built in degrading mechanisms.

How to use it?

As the name states, it should be easy to use and to integrate into your game. You have the ability to create new customized actions, override existing ones with your own implementations and so on.

To integrate the AI into your game, you need to create an instance of the ai::AI object and attach this to your game entity class. Also your game entity class should implement or include the ai::ICharacter interface. These two are used later on in the actions and conditions of your behaviour tree. You can view the included example for getting an idea on how to do this.

Once this step is done, you can go on with creating new actions for your game. All you have to do for this is to extend ai::ITask. The entity instance given the doAction method contains the ai::ICharacter that you bound to your game entity.

After implementing these actions, all you have to do in order to use them with e.g. the existing LUATreeLoader is to add them to the registry. Just call registerNodeFactory on your ai::AIRegistry instance and you are ready to write LUA scripts with it. Again, as a reference, just check out the example code.

What about the remote debugging?

The remote debugger can also render your custom map widget which allows you to show the characters in their "natural" environment instead of on a white plane. You can choose which entities should be available for remote debugging. The included Server class handles the serialization of the entities. You can create one instance of a server per game map you have. Once you add an entity to the server, it gets automatically serialized and is broadcasted to all connected clients. If no client is connected, nothing is serialized and thus the remote debugging has almost no performance influence.

What's next?

The next few days I will work on getting 0.1 out. Hopefully I get some users and get some feedback to improve the library. A big topic is also the remote debugger. I will improve the UI a lot to make it even more usable.

Other possible things could be a XML tree loader and a graphical behaviour tree editing.

After I've managed to do some stable releases, I would like to switch to C++11 in order to use easier threading and provide some selectors for this, too. It's not yet decided whether I will drop older C++ standard support or whether it will be a compile time switch.

All in all I hope that someone finds the library useful. If not, I hope you had fun while reading this article... if not... I'm sorry. ;)

Kommentare

Beliebte Posts