September 19, 2019

Creating advanced Artificial Intelligence with mindmaps

Most beginners in robotics are starting with the line following example. The idea is, that the robot has to move on the blackline. He has to steer, that the robot will never lost contact. Realizing such an algorithm is possible in under 10 lines of code, and after a bit of programming the robot is doing the wished behavior.

After the first robotics project has came to a success the often asked question is how to scale up the project into more complicated domains. The most demanding task which is available is an AI engine for a real time strategy game. This sort of game is hard for human players and for AI controllers as well. Sometimes the newbies are expecting that this kind of domain asks for a complete new sort of technology, but it's enough to combine mainstream AI techniques.

The project starts with a mindmap in which submodules are given. An RTS AI player contains of a strategy manager, a production module, an exploration manager, and house building submodule. It's not a monolotic AI which handles all the tasks, but the AI is split into sub-AI which are working together on the blackboard. This allows to focus the attention only on a specific problem, for example which building should be created next. All the other problems in the RTS game can be ignored by the building manager.

The most surprising effect is, if many of these modules gets implemented and the AI can use all of them together. The result is not a random behavior, but it will result into a human like AI who knows exactly how to play the game efficient. The problem solving technique of using a mindmap for define submodules can be utilized for other robotics projects as well. For example if the aim is to build a drone which can fly but also land and grasp objects, the overall system can be realized by different managers who are communicating on a blackboard. From a programming perspective a blackboard is a normal class which contains of other classes. It's the same principle used in normal computer programming if the program contains of lots of subclasses who are ordered hierarchically.

Input and output of a module

Let's take a look at one of the mentioned modules. The production module has to decide which kind of unit is produced next. It's only allowed to use the existing production facilities but not to build new one. The question which has to be answered is: what should the base produce next? To make the decision process more reliable some additional information are given, for example, which units were produced in the past, how much credits are available and which of the units has a better performance to cost ratio. As a result, the module decides, what the next produced item will be.

The most interesting features of using submodules is, that the amount of information is reduced. Not the complete game state is feed into the module, but only a limited amount of information. This allows to develop and test the module by it's own. In classical software engineering this is called encapsulation and is a powerful tool for creating complex applications.

The disadvantages in creating all the modules is, that it takes a lot of programming effort. In contrast to the example with the line following robot from the introduction the resulting AI application will need hundred of codelines, distributed over many files.