NAME
aibots - An improved clone of A.I.Wars in Perl
SYNOPSIS
% aibots [-r|o|c] [-s] [-m] <map> <bot1 bot2...>
% aibots duel Samurai Thief Sofixti Lancer
% aibots
DESCRIPTION
This is a clone of A.I. Wars
(http://www.tacticalneuronics.com/ai.htm) in pure perl, with Tk
and console interfaces.
Please consult the above URL for general information about this game.
OPTIONS
-c: Console mode
-s: Silent (Win32 only)
-m: Music (Win32 only)
-o: Messages only
-r: Results only
ENVIRONMENT
- Path_AIBots
-
The Path to AIBots
pics/
,wavs/
,bots/
,maps/
settings. Defaults to the install path ofGames/AIBots
.
INTERFACE
The Setting Panel
Map Menu
The drop-down menu in the bottom-left corner lists all available maps. The ones in square brackets (e.g. [Solania]) denotes a "level" with pre-defined bots.
Beginners are encouraged to start with the Open
or Arena
map.
Change Background
Press this key to cycle through all available backgrounds. This has no effects on the actual game.
Participating Bots
The nine menus in the bottom lets you pick bots to duel with each other. Click on an empty menu to select; select the empty entry to delete a bot.
Watch
You could press the watch botton next to each bots, to have its statistics listed on the upper-left corner.
About
Displays author and version info.
The Control Panel
Play / Pause
After the maps and bots are selected, the Play button will be enabled. Press it to start the duel. All bots act upon their programs without human intervension.
You could press the Pause button anytime during the game; press again to resume.
Stop
A game usually ends when there's only one remaining team left on the field. Before the game ends normally, you could press the Stop button to end a long endgame prematurely.
Speed
Toggles beterrn slow, medium and fast. You could slow down the game during close encounters, and fast-forwards boring intervals.
Sound
If the Win32::Sound module is installed, AIBots could play sounds upon each event.
The Title Panel
Watch and Status
When the game is playing, the black button in the upper-left corner will display the Bot currently under Watch. Press that button to toggle the target.
The bot being watched will be surrounded by the [ ]
symbol, and has its statistics listed on the upper panel, like this at the beginning of a game:
[Mage-2] Score: 0 Ammo: 30 Life: 10 Fuel: 2499 [Turn Right]
These columns denote the bot's type (Mage), number (2), current score (0), ammo left (30), life points, (10), fuel (2499), and the action of this turn (Turn Right).
Also, the window title will display (Tick: 1), means this is the first step into the game.
SCORING AND RULES
Basic Concepts
In AIBots, players compete with each other not by reflexes, but ability to program 'Bots'.
Score accumulated with each bots determines a game's outcome. The primary mean to gain score is to deal damage to other team's Bots. Additionally, the last Bot standing will receive a 500 point bonus.
To inflict damage, Bots need weapons. All weapons except for Energy Zaps consume ammo points. The Life points represents the maximal damage a bot can take before dying. When a Bot's killed, it's turned into a Flag.
Turning, Moving and Launching projectile weapons consume fuel points. When a Bot runs out of fuel, it could not perform any of above actions anymore. The rate of fuel burning increases propotionally with damage received.
Life points and Ammo will not regenerate, but are replenished on Flag, Vault, and Strategy Points.
Each Tick, all Bots executes one Action Command and any number of other commands in turn.
Board Elements
bot [^>v<]
The heading of each Bot determines the direction of weapon, move forward and move backward commands.
Bots do not stack. An attempt to move onto another bot results in a Bump.
spawn [1..9@]
Bots appear at random Spawn tiles when the game begin.
Entry Points in digits are for the bot with the identical number.
After the game begins, spawn tiles are treated as empty tiles.
wall [#]
Walls cannot be passed or destroyed.
fence [+]
Fences cannot be passed, but could be destroyed with any weapon.
flag [P]
If a damaged Bot moves on a Flag tile, it regains all Life points and increases 30 Ammo and 350 Fuel.
If the Bot is undamaged, Flag deals 5 damage to it.
mine [O]
A Bot moves into a Mine tile suffers 5 damage to its Life points and Fuel burn rates. If the mine was layed by an enemy, the enemy receives 400 points of Score.
vault [A]
Vault contains 20 points of Ammo.
Any weapons inflicted on the Vault tile will cause an explosion, which deals 3 damage to all adjacent Bots' Life and Fuel burning rates.
Vaults next to each other will explode simultaneously.
snode [*]
Bots staying on the Strategy Node tile will receive 1 points of Fuel every 5 turns, 1 point of Ammo every 10 turns, and heals 1 point of Life every 15 turns.
Weapons
laser
Laser is the most basic weapon. It consumes 1 point of Ammo, and attacks to five tiles forward. Laser beam will stop after hitting the first object.
When hit, Bots with Shield Off state will receive (6 - distance) points of damage. Shielded bots receives (3 - distance) points of damage in the first two tiles only.
Burn rate damage caused by Laser equals to its Life point damage.
bazooka
Bazookas consume 10 Ammo and 300 Fuel points each. They fly with the speed of 1 tile per Tick, and explode upon impact.
Upon explosion, a Bazooka deals 7 (shield off) / 4 (shield on) damage to adjacent Bots.
Direct hit to a Bot causes 9 / 6 points of damage, depends on its shield state.
Burn rate damage caused by Bazookas equals to its Life point damage.
grenade
Grenades consume 5 Ammo and 200 Fuel points each. They fly with the speed of 1 tile per Tick, and explode upon impact.
Upon explosion, a Grenade deals 5 (shield off) / 2 (shield on) damage to adjacent Bots.
Direct hit to a Bot causes 7 / 4 points of damage, depends on its shield state.
Burn rate damage caused by Grenades is 12 / 9 upon direct impact, 4 / 1 collateral.
energy
Energy Zap consume 1 point of Life, and deals 2 points of Life and Burn rate damage to all adjacent Bots.
Energy Zap is the only weapon capable of destroying Flag and Mines.
destruct
Self-destruct deals the same amont of damage as remaining life points to all adjacent Bots, both to Life and Burn rate points.
A self-destructed Bot will not turn into a Flag.
On/Off Toggles
shield
Shields could be Enabled or Disabled at any given time.
Bots receives less damage when shielded, but cannot fire any weapon except for Enegy Zaps and Self-Destruct.
laymine
When Enabled, a Bot will leave a Landmine in the original tile every time it moves, which consumes 5 Ammo points.
cloak
Bots with Cloak enabled will not be seen by other Bots via $enemy_[x/y/h]
and $friend[x/y/h]
variables.
A Bot lose 10 Fuel and 2 Ammo points each turn when cloaked.
Scoring
Damage
Bazooka Impact: Unshieled +500, Shielded +300.
Collateral: Unshielded +400, Shielded +200.
Grenade Impact: Unshieled +500, Shielded +300.
Collateral: Unshielded +200, Shielded +100.
Laser Actual damage * 20
Destruct Actual damage * 50
Energy Zap +100
Vault +200
Mine +400
Bonus
+50 for every Life points left, or -50 for every points below 0.
-1 for every point of Burn rate causes by damage.
The last Team surviving receives +500 points.
PROGRAMMING YOUR BOT
Variables
Metadata
$name, $author
$team
$pic
Current Status
$shield, $laymine, $cloak
$bumped, $found
$score, $burn
Resources Left
$fuel, $max_fuel
$ammo, $max_ammo
$life, $max_life
Coordinates and Heading
$x, $y, $h
$enemy_x, $enemy_y, $enemy_h
$friend_x, $friend _y, $friend_h
$snode_x, $snode_y
Internal Variables
$id, $botcount
$lastcmd
$state, $line
Actions
Scanning
scan front, scan left, scan right;
scan perimeter;
scan cross, scan corner;
scan longrange;
scan position [1..9];
scan relative [1..9];
scan gps $x, $y; Moving
move forward, move backward;
turn left, turn right;
Attack
fire energy;
fire laser;
fire bazooka;
fire grenade, fire grenade $d;
Enable and Disable
enable/disable shield;
enable/disable laymine;
enable/disable cloak;
Miscellanous
attempt repair;
attempt destruct;
beam fuel/ammo/command;
Exported Functions
Detection
&nearst("friend"|"enemy")
&inperim("friend"|"enemy")
&headto("friend"|"enemy")
Checking Return Values
&found("$obj1|$obj2|...")
&bumped("$obj1|$obj2|...")
Current Status
&damaged()
&ready($weapon)
&onnode()
Miscellanous
&turnto(2|4|6|8)
&distance($x, $y)
&toggle()
Flow Control
Conditionals
if ($condition) {...}
unless($condition) {...}
elsif ($condition) {...}
else {...}
... if/unless ($condition)
Subroutines
LABEL: {...}
redo;
goto LABEL;
call LABEL;
return;
CUSTOMIZING
The maps/ Directory
Metadata
=background Background image
=bot[1..9] Default Bots
=sound Opening Sound
=snode x, y Strategy Node location
AUTHORS
Autrijus Tang <autrijus@autrijus.org>
COPYRIGHT
Copyright 2001, 2002 by Autrijus Tang <autrijus@autrijus.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.