Quick start guide
Learn the basics to develop your own software player (bot) with dipGame and run Diplomacy games against it.
- Play your first game
- Create your first bot
- Play against your bot
- Add negotiation capabilities to your bot
- Template for a negotiating bot
Diplomacy is a game played by seven players. In dipGame we want to create software players of this game and make them compete along them and against human players. DAIDE was a pioneer doing it. We continue their work and we made it more suitable for scientific researchers of areas like Multiagent Systems.
In the following we assume that you know the rules of the game and refer to spring movements as SPR, spring retreates as SUM, fall movements as FAL, fall retreates as AUT and adjustments as WIN. The available orders in each phase are (for movements:) to hold, move, support hold, support move, (for retreates:) retreat, disband, (for adjustments:) build, remove and waive. Convoys are not allowed in dipGame.
2. Play your first game
If you pretend to create your own bot, you should learn how to play off-line, on your own computer. To do so: download the Game Manager , install it and run a game involving 6 bots and a human player.
3. Create your first bot
The complexity of creating a bot varies a lot depending on your requirements. The simplest bot ever just holds its position, disbands and removes units or waives depending on the phase of the game. We call this bot HoldBot.
To implement HoldBot
we can extend the
class from the
framework and implement its method
. Other method headers must be also in our
) but it is not necessary to include any sentence into them. The
should look like the following:
The HoldBot as described before is not a program because it has no main method. To complete it and be able to execute your bot you need to define a method like the following one:
dip requires three libraries. Thus, your bot requires a total of four libraries to be imported. Copy those libraries into a folder together with the HoldBot.java file. Run a terminal and locate yourself into the same folder. To compile your bot you just need to type the following sentence:
If the compilation works fine no output must apear. Now, your HoldBot is ready to play games.
4. Play against your bot
To play a game against your new HoldBot you can run a game with gameManager setting as empty one of the players. Then, a game will be launched with several players connected to it and you should run your HoldBot connecting to the same server location. If you want to run HoldBot in the same computer that you are running the gameManager, then the game server ip is 'localhost' and the server port is '16713', that are the same values that we specified in the main method. Now you can execute your bot as follows:
You can also add your bot to gameManager as described at the gameManager page . To do so it is recommended to generate an executable jar file containing your code and the required libraries. There are several ways to do so, the easiest using Apache Ant.
5. Add negotiation capabilities to your bot
Adding negotiation capabilities means adding a new level of complexity to the development of your bot. We recommend to exercise first developing bots without negotiation capabilities.
The esiest negotiator bot is the one that talks about peace and alliance without understanding at all what do they mean. This bot proposes randomly peaces and alliances and accepts or rejects them also randomly. This bot is useless as a negotiator but it is probably the best way to exemplify the development of a negotiating bot.
To negotiate in dipGame we use the nego negotiation framework.
nego provides the class
org.dipgame.negoClient.simple.DipNegoClientImpl for sending messages to other
Diplomacy players and the class
to indicate what to do whenever the bot receives a message.
In the following example we create a new class RandomNegotiator implementing the
org.dipgame.negoClient.Negotiator interface that creates and runs the negotiation.
Then, we create a new bot extending HoldBot and adding the capability of negotiating with the previous random negotiator:
RandomNegotiator negotiates only about peace and alliance but the negotiation can include movements and other sort or offers.
6. Template for a negotiating bot
As a start point for developing a negotiating bot we recommed you to use the following template of an Eclipse project.
This template is useful also if you don't use Eclipse as its
readme.txt file explains how to compile and execute it in both cases. It also explains how to generate an executable jar file from the code.