The
Battle API allows third party applications to play battles on
Orion's Belt as a
bot. You may use this API to create artificial
intelligence bots or game clients that'll be able to battle with other players or bots on the
Game Board. Example of a battle:

Contents
How to Apply
In order to be able to develop an application using the Battle API, you'll have to contact us. Then we will prepare the development environment
for you and get you started.
You may contact us using the
manual@orionsbelt.eu mail.
Overview
The Battle API is very simple to use. You may create an application that will comunicate with
Orion's Belt and send/receive moves and battle states.
You'll have to code your application to perform deploys and turns. The basic interaction is the following:
- #1 You ask the server for battles, and receive a XML file with the battles you have to play
- #2 For each battle received you'll send a HTTP reques to a provided URL with a deploy or moves
- #3 Wait a while and then return to step #1
You have available a XML file with the complete
units specification. When we configure your bot/client, you'll
be able to create a
Friendly with him and try your bot in action.
Ask For Battles
The first time you ask for battles, you won't get any. You'll have to create a
Friendly with your bot, and only then you'll get some battles
to play. To ask for battles you'll have to make an HTTP request to:
http://server.orionsbelt.eu/Ajax/Battle/BotBattle.ashx?type=botGetBattles&botId=1111&verificationCode=ABC
Note that you'll have to send the request for the right server. You'll have a bot per server, so if you're registered on more than one server you'll have to act
accordinally. You also have to give the bot ID and the bot verification code.
Deploy
The first part of the battle is the
Deploy. When you request battles using the previous URL you'll receive something like:
<Battles>
<Battle id='1339260' state='deploy'>
<ResponseUrl>http://source_server/Ajax/Battle/BotBattle.ashx</ResponseUrl>
<Players>
<Player id='0' ownerId='1339159'>Bot001</Player>
<Player id='1' ownerId='203'>nunos</Player>
</Players>
<CurrentPlayer id='0' ownerId='1339159'>Bot001</CurrentPlayer>
<Units>
<Unit quantity='10' name='Raptor' code='rp' />
</Units>
</Battle>
</Battles>
This is a very simple battle between
Bot001 and
nunos, and you'd have to deploy now. The combat
Fleet only has the
Raptor, no more
Combat Units
are present. You'd now have to make a request to
ResponseUrl indicating how you'd like to
Deploy:
[ResponseUrl]?type=botdeploy&id=1234&moves=p:rp-8_1-2;p:rp-8_2-8;&botId=321&verificationCode=ABC
The
moves parameter is the most important one and has the following format:
p:unit_code-coordinate-quantity
You'd have to build a string like this one for each unit block on the deploy zone. You have the unit codes on the
units specification. After invoking
the correctly formed URL, the battle will continue.
Turn Moves
After the deploy you may ask again for your battles, and you will now have to play your moves. Note that on these examples only a battle is being returned, but
if you had several battles to play, you'd receive several <Battle/> elements. When's your turn to play, you'll receive something like:
<Battles>
<Battle id='1339264' state='battle'>
<ResponseUrl>http://source_server/Ajax/Battle/BotBattle.ashx</ResponseUrl>
<Players>
<Player id='0' ownerId='1339159'>Bot001</Player>
<Player id='1' ownerId='204'>tsousa</Player>
</Players>
<CurrentPlayer id='0' ownerId='1339159'>Bot001</CurrentPlayer>
<Elements>
<Element coordinate='2_4' canBeMoved='True' canUseSpecialHabilities='True'
id='1' ownerId='204' direction='S' quantity='1' remainingDefense='300' code='rp'/>
<Element coordinate='8_1' canBeMoved='True' canUseSpecialHabilities='True'
id='0' ownerId='1339159' direction='N' quantity='1' remainingDefense='300' code='rp'/>
</Elements>
</Battle>
</Battles>
Note that the state changed from
deploy to
battle. Now you receive the current
Game Board disposition, each unit group, quantity, coordinate, etc.
After calculating your moves, you'd have to send your response again to the game, using the given
ResponseUrl. An example URL would be:
[ResponseUrl]?type=botbattle&id=1111&moves=r:7_3-n-w;b:7_3-7_2;m:8_3-8_2-5-n;b:8_2-7_2;&botId=321&verificationCode=ABC
The
moves parameter is again a list of moves with the following syntax:
| Type | Syntax | Description |
|---|
| Move | m:unit_coordinate-destination_coordinate-quantity-direction; | Moves a unit group from one square to another adjacent square |
| Rotate | r:unit_coordinate-current_direction-next_direction; | Rotates a unit group; direction can be: N, S, E and W |
| Attack | b:unit_coordinate-target_coordinate; | Attacks the adversary unit group |
Then it's your opponents turn to play. When he's done, you'll receive the new
Game Board state and you have to make more moves. This continues until
the battle isn't finished. Note that your movements can't spend more than 6
Movement Points.
More Information
If you have any questions or suggestions please contact us and we'll be happy to help you.