The Game:
Castles:
Each
team has a castle, which is located in a random location in the battlefield. The castle is the most important entity
to a team, and has several uses.
First of all, if team AÕs castle is destroyed by team BÕs agents, team A
loses and the round is over. The
castles also provide a place where agents can heal if there health is below
100.
The castles are where all of a teamÕs agents will
spawn. At the beginning of the
round, a certain number of agents are spawned at the castle, and all later
reinforcements will also come from the castle. Each agent always knows the directions to get to his home
castle, but if the castle is not in radar, the agent doesnÕt know a castleÕs
status.
Soldiers:
Soldiers
are the weaker agents in a battlefield.
All agents start at soldiers when the round begins. These units are capable of moving around
in the environment and attacking objects. As a unit attacks a valid object
(i.e. an enemy agent, enemy castle, or sheep) that unit gains personal
experience. The amount of
experience that is gained is based on the amount of damage the unit does. If an
agent dies, the opposing agent who killed him gains a bonus in experience. Also as an agent gains personal
experience, the teamÕs total experience also increases. Every time a teamÕs experience is
increased by 500, that team spawns another soldier at its castle. Once a soldier reaches 400 personal
experience, he becomes a Hero.
Hero:
A
Hero is a soldier who has gained enough personal experience to upgrade. A Hero has the same traits of a
soldier, but deals a great deal more damage to opposing objects. As a result of this, more personal and
team experience is gained due to the high damage output.
Sheep:
Sheep
are another way for an agent to gain experience. These sheep only spawn near the center of the battlefield
and cannot attack agents. Units can find and attack these sheep, gaining
experience for all damage dealt to a sheep, and also a bonus once the sheep
dies. These sheep provide an
advantage to agents who tend to wander more, and not stay near their own
castle. This balances the game and
helps the smarter agent win the match.
A
Game:
A
game can be played to any number of points. The team who reaches that point total first wins. When a castle is destroyed, the
opposing team gains 3 points. If
time runs out, whichever team has the most team experience gains 1 point. After either of these events takes
place, the battleground is cleared and a new round starts and each teams starts
again with the initial number of soldiers.
Graphics:
For
the graphics engine of AIBattle, we extracted sprites from an old game called
WarCraft. What we needed was two different species and two different homesteads
for each species to start at and protect. The WarCraft graphics provided us
with humans and orcs and a castle for each.
It takes 84 different graphics to
make up one unit. Each unit can graphically be facing 8 different directions.
At each of those 8 directions, he can be in three different modes; walking,
attacking, or just standing. If he is walking, there is a graphic for the left
foot forward, the right foot forward, and just standing for each direction he
could be facing. If he is attacking, there are three graphics for each
direction he could be facing.
Humans:








Human death:






Orc
and death:








DonÕt
forget the lovable sheep:
![]()
![]()
![]()
![]()
![]()
![]()
When
the units reach the Hero stage, we wanted their graphics to change to reflect a
bigger, strong character. Again, WarCraft had exactly what I neededÉ
A
handful of pictures from the Human Hero sprites:







Orc Hero:







I
also used WarCraft graphics for the castles and walls:
Human:
Orc:
Walls:
![]()
The
physics of the game were quite simple. Although the programmer can control the
speed and heading of the units, the actual moving was done by a protected
function that calls:
double nextx=x+(speed*health/100)*Math.cos(DegToRad(angle-90));
double nexty=y+(speed*health/100)*Math.sin(DegToRad(angle-90));
As
you can see by the speed, direction, and movement, we use are all real numbers
not a grid system where units move from one grid location to another. But, to
simplify the collision detection and local radars, we have another function
that essentially takes a picture of the screen and assigns each item to a grid
position.
So, at this point, weÕve got the next x
and next y that the unit wants to travel to. We translate that to the grid and
check to see what the grid thinks is there. If it is MAP_EMPTY, the unit moves.
The attack system is very simple. When the
programmer calls Attack(), the program checks what is in front of it and calls
the DealDamage() function to that unit.