Tuesday 13 July 2021

Blood Bowl AI Implementation


Project History

Several years ago I've decided to create my own Blood Bowl AI, being quite disappointed by the one available in Cyanide's BB1. This has been done on my free-time, with sometimes some (long) beak (could be some years).
Work is still going on and this blog will help to keep information regarding this development. And to release versions.

First idea was to start from AIBowl which is a Java application (released in 2011) with a UI, an integrated AI and an API that allow you to create your own AI. The existing AI in AIBowl (named Grodbot) is quite good, far better than the Cyanide's one.
My goal was to be able to play some tournaments with AI opponents, where matches AI-AI are really played to take into account injuries, experience and so on.

For these tasks, AIBowl has some issues:
  • match must be played with UI activated, with long animation time →  this takes times to simulate matches;
  • no pre-post matches sequences → league currently not available;
  • lack of debugging tool for AI developers;
I have decided to re-create everything from scratch but using existing icons, portraits etc - from AIBowl but also from other tools. For that reason interfaces are really similar. Game is not 100% finished but is already playable. If I compare my version (named DrefsanteAI) vs AIBowl, here are some advantages:
  • AIvsAI game can be played without UI in about 5 seconds for the whole match;
  • Interface is more user-friendly. For example to move a unit, a predefined best path (where probability to turnover is minimal) is shown, and if user agrees only one click is needed to move the unit. For AIBowl, the unit must be moved square by square;
  • AI can select best option in pre-match sequence;
  • AI can create automatically its initial team;
  • AI can manage pre/post-match sequence (fire, hire, 'upgrade' player, buy inducements, etc);
For some points, AIBowl is still better:
  • In my version 100% of skills are not yet implemented (for example throw team-mate, leap, etc.);
  • It's not expected to add new AI (like in AIBowl). Well it's possible but this is not designed for;
  • Passing the ball is nicer in AIBowl I think :-)
  • No sound implemented (and I do not intend to add some);

AI characteristics:

  • Each action executed is done knowing its probability of success and of turnover. Probability calculation includes for each unit:
    • probability to go from one square to another one (taking into account all skills, like dodge, tentacles, etc);
    •  probability to block opposite unit (split in different categories: probability to put the other down, to turnover, to push, etc), again using all skills (block, wrestle, etc);
    • probability to blitz other units;
    • probability to foul other units (ie probably of success and probability to be excluded);
    • probability to pick up ball;
    • probability to hand off ball to another unit (best path is calculated);
    • probability to pass ball to another unit (here again, all different moves from the ball carrier are tested, to keep the best one);
    • probability to score a TD - for example we compare all possibilities for the ball carrier, ie simply moving to TD area, but also hand-off or pass or both in all possible combinations;
  • Based on all these probabilities, strategic behavior is implemented - like obviously doing safe move at first, and doing more risky option at the end. But some actions have higher priority like those related to the ball (it's better to try to blitz ball carrier than someone else). All this strategic implementation is the crucial part of the AI, it is the AI brain;
  • It takes into account number of remaining turns - for example if possible, you will always see an attempt to score on last turn;
Following link shows (no sound) a half-time between the AI (in red) and myself (blue), to show AI behavior and also to see how the interface works. It has been recorded a few years ago and many AI improvements have been done since the recording.

Remaining work

  • Implement missing skills (80% are implemented);
  • Add missing interface features (like pre match sequence: AI can do the selection, but not human player - wizard is not implemented at all);
  • Test, test and autotests! Bugs of such game can be at many different levels:
    • due to misunderstanding of rules;
    • due to bad implementation of rules;
    • UI bugs;
    • AI bugs (probabilities are calculated but they should be all tested/validated in detail);
  • Still lots of AI work can be done. Mainly to improve strategical defensive play;
  • Could be nice to have a replay mode (and it would help for debugging);

Current AI Level

In one word: decent. I have created a bot that can be used in AIBowl. I inspect the game state of AIBowl, fill the info in DrefsanteAI (like position of each unit, skills, turns, etc) and ask for an answer when requested by AIBowl. It was quite simple - that's why if Cyanide gives an API to develop bot, it would be easy to plug the AI. Some stuffs were not 100% compatible between the 2 software → the version implemented in AIBowl could be a little bit weaker than in reality. Mainly also because it adds a new level of possible bug - the 'information' could be bad transferred from one software to the other one.

It is possible to watch DrefsanteAI versus GrodBot (the AIBowl's AI). Quite funny to watch these 2 AI with zero common coding line playing against each other. Link of a half-time:


I have feeling that my AI is better but I'm not neutral. I would have to do hundreds of games to detect the winner, but this is not easy with AIBowl. After looking dozen of games, I would say DrefsanteAI is better to score but is weaker to defend.

'Soon' I will release my own interface to allow user to play a league, and maybe AIBowl compatible bot if you want to use it with AIBown interface, versus you or GrodBot.

Tournament Interface

Following video shows the simple interface to play a tournament - here only AI vs AI matches. You can see the ranking updating each time a game is finished.

First release

Coming soon!