How to use the AI in your XBattle games

The current state of the AI is quite rudimentary, the algorithms used are quite simple and there are no support for using paratropers / building bases / raising and lowering land etc. But still, the AI works well to play against in it's current form and importantly there are no feeling that the AI somehow 'cheats' which is the case with most other realtime strategy games I have encountered.

In order to play against a computer opponent a normal player should first be setup (ie. -red :0.0) and then the option "-ai" should be used. This option accepts two arguments, the player which should be computer assisted (it is still possible to play him also, overriding the AI's commands) and the skilllevel of the AI. The skill level mainly affects how many moves per timeunit the AI is allowed to make - a move is here an added or removed vector from a cell. Setting the skill level to 6-7 should be enough to provide a good challenge to novice players. Lover skill levels means more moves and hence, a better opponent. Example of AI invocation:

xbattle -red null -green null -blue :0.0 -ai 0 7 -ai 1 7 -board 12 -rbases 3 -towns 2 -hex -hills 5 -sea 3 -hidden -farms 20

Note the use of the dummy display name "null" for the first player meaning that no window should be opened for that player. It is also possible to bring up a window for the first (AI controlled) player by using:

xbattle -red :0.0 -green :0.0 -ai 0 5 ...

In this case two windows are opened, one for red and one for green, on your display. The AI will controll the red player, but you can also make moves for the red player by clicking in the corresponding window. This is mostly usefull for debugging the AI, but perhaps it could be used as an aid to players.

Furthermore it should be noted that it is possible to have several AI's in a game (even only AI players), all map types and all other options. Note that the AI ignores most special options (paratropers,land fill,base construction,horizon etc).

Skill levels

One further note about the quality of the AI. As most game programmers know it is quite difficult to write a decent computer AI for strategy games, especially if the AI is not allowed to cheat. Most [realtime] strategy games I have seen have a cheating AI and mostly varies the amount of cheating when the difficulty level is increased, this is probably why multiplayer games are so popular. It is simply more fun to play against an opponent making smart moves and win/loose rather than playing against a stupid opponent who cheats, regardless of outcome. An explanation for this is that current research in AI has very little focus on the game industry, and the game AI programmers today are implementing things 5-20 years back from the research frontline. As an example I have heard game programmers becoming euforic because of the search strategy A* and various slight improvements of it. Try publishing that on an AI conferance!

When I first set out to implement an AI for XBattles I wanted to make a fun game for me to play in lack of human opponents. For me this means that the AI must not cheat, ever. Considering this it is not a big surprise that the AI in XBattles is and probably will remain quite easy to beat for a human player. My solution to this has this far been to allow a small kind of cheat for the AI, namely the number of moves per second it is allowed to do. I motivate this by noticing that the number of moves per second seem to be quite different between experienced players and novices. So, to come to the conclusion: My only way of affecting the difficulty of the AI players without deliberatly cheating is to modulate the number of moves per second which the AI is allowed to do.

However, even this is does not neccessarily make a difficult AI since it might be the case that there are no good moves to make at a certain timepoint. For an experienced player it doesn't matter much if the AI makes 10 or 100 moves per second unless there exists 100 good moves to do (and they can be identified by the AI). The solution if you want to play against a difficult AI is to have gamerules for which the AI plays well. Currently this involves options such as farms, milita, towns etc. since the AI has a tendency to cover large territories quite fast. Also the AI is now capable of taking advantage of guns in attacks so they can also be used to get a more entertaining game. Compare for instance the quality of the AI when playing with all the options mentioned above and that of an AI of the same skill level playing the polar.xbo scenario. I'm sorry but the AI cannot handle such scenarios very well, yet. Hopefully this will change in the future, but it's not certain that the AI ever will play very well scenarios where it is not an advantage to cover large terrain areas.

I hope this haven't discouraged you from playing the game. Have fun with it and don't hesitate to contact me for comments, improvements, suggestions etc.

The XBattleAI website