Home
Download
Documents
About

|
Write your own AIs
Virtual Fight use client/server style. AIs must connect to the
server to start fighting! AIs can be in any language. Each AI is
a group of five warrior. AIs can control their warriors by sending
commands to the server.
This is not a real-time-battle. Its just like turn-base-strategy
games. Its mean an AI play its turn, and wait for others to do so.
So Its not that much important that your AI is how much fast.
Port
Default port for server is 4500, and GUIs can be connected to
4550.
You can use telnet for testing commands.
Commands Format
Commands are in a format like this:
n&Command[&Direction]
- n: Number of warrior.
- Command: can be one of 'MOVE','SHOT','POS','SAW','NONE'
- Direction: can be one of 'UP','DOWN','LEFT','WRITE'
'n' is the number of the warrior you want send command to.
Warriors numbers are start from 0 to 4.
'Direction' is needed only for 'MOVE' and 'SHOT' commands, but
'NONE' command can either have this option or not.
Commands are NOT case sensitive. 1&MOVE&DOWN is equal to
1&mOvE&DOWn
Commands
'MOVE' : Move a warrior among specific direction. For
example:
4&MOVE&LEFT will move warrior number 4 to left.
Very simple, isn't it?
'POS' : Get the position of a specific charachter.
For example if an AI send 0&POS to the server, server will
return somthing like 3,14
in the image below, position of the warrior is 4,4
'SAW' : Get what is in sight of a specific charachter. See
image below, warrior can see green squares.
If this warrior send 'POS' command to the server, server will
return:
2,5,E&1,3,#
Its mean there is an enemy in 2,5 and there is a wall in 1,3
Notic that warrior can't see the enemy on his right.
'NONE' : Do nothing! Just stand there and watch!
This command can contain direction. For example if you don't want
move your warrior number one, but want to see what is in his
right, you can send: 1&NONE&RIGHT (change direction to the right
without moving) and then 1&SAW
Server Messages
Errors
If you send a bad command to the server, you will receve error.
The error numbers are:
100 | Invalid command.
111 | The destination is not empty.
112 | Charachter wants to move out of screen.
120 | Charachter which moved before.
225 | OK.
For example if you send 1&MOVE&UP to the server, you will
recevie 255, and when you send 1&MOVE&LEFT again, you will receve
120. Because a warrior can't move twice in a single turn.
OK and READY messges.
When an AI connect to the server successfully, server send OK
message to it. At the end of each turn (and in the start of the
game)
server will send READY to all of the AIs. Before sending first
READY (game start) server don't accept any command.
Writted by Aidin Gharibnavaz, 15-Jul-2006
|