The level consists basically of 3 models: the level itself and 2 additional models to add more
details to the world.
There is a special class which can be called upon that can determine from a Vector3 input
if that point is above the level model and can determine the height of the level model at a given
point. This is used to keep all moving units on top of the level.
There are a few 2D elements that make up the interface of the game.
The Action Keys show the player what the squad is doing. If the buttons light up it means
that that part of the squad is busy attacking some enemies. The circle displays the amount of
squad units of that type that are still alive.
The pointer is a texture of which the position can be controlled with the right analogue stick
of the Xbox controller or with the mouse. When it comes across something in the world, the
object reacts to it. A ray is shot into the world from the pointer’s position and the unit in the
world that detects it reacts to it.
We have four models that are loaded to a certain type of squad unit. Each type has it’s own
gun after which the type is called. The types are: Machinegunner, Rocketlauncher, Grenadier
The Machinegunner ﬁres a lot of bullets. The Rocketlauncher shoots rockets at enemies
which explode at the point where the enemy was when the rocket was ﬁred. The Grenadier
throws grenades at the enemy. Like a rocket the grenade will explode at the point where the
enemy unit was when the grenade was thrown. Grenadiers and Rocketlaunchers are thereby
not that eﬀective against fast enemies. The Shotgunner will shoot bullets at a lower rate than
the Machinegunner, but these bullets have a greater impact than the bullets from the machine
There are four diﬀerent types of enemies that move across the surface of the level. They attack
the squad when in they are within a certain range and follow them around the level. The four
diﬀerent types of enemies have a certain weakness for the diﬀerent types in the squad. They
are placed in groups that can be attacked by the squad unit types and are spawned from spawn
The movement of the squad is deﬁned by a single point that travels on the height map. The
squad units stay in their own group and those groups try to stay near the squad point.
The movement of the squad is handled by the left stick of the Xbox controller or by the
When the squad moves forward, the camera stays a little behind and seems to look forward.
When moving backwards, the camera is pushed backwards and looks at the ground where the
squad is moving to. The movement of the camera is smoothed by a spring so it glides from
position to position.
The camera will turn with you, so if you move to the left the camera will follow behind you.
But moving the squad is not the only way to turn the camera. When you move the pointer
(with the right poke on the controller or with the mouse) to the sides of the screen, the camera
will turn in proportions to that distance. When the pointer is in the upper part of the screen,
the camera will move a little bit backwards and looks a little bit more up so that it gives a
better overview of the level.
In this chapter we will elaborate on the implementation of the general and choosen extra requirements.
These are the requirements that have to be met by the ﬁnal product.
Our game takes place in a 3D environment where the camera focus lies on a spot in the middle
of the squad (or where the squad needs to go).
Reward and Punishment system
The player progresses by surviving and destroying the enemy. By doing this, the player completes the stages.
As of the arcade part of the game, the player earns points by destroying enemies. The
number of squad units alive will act as a kind of multiplier. So if you survive everything while
maintaining a high number of squad members your score will be higher than if you survive with
Level of diﬃculty
The level of diﬃculty increases when you progress in the level. You start with a small squad
with only one type (Shotgunner) with one type of enemies that has a weakness for Shotgunner
and only one spawnpoint from which they spawn. When you have destroyed that spawnpoint
you’ll advance to the next stage. Two spawnpoints will be added where two diﬀerent types of
enemies will spawn. The player now learns that the Shotgunner is not that capable against
the other kind of enemy and needs help. He’ll ﬁnd that in a tube that can be destroyed which
frees some trapped squad members. Now he will have the ﬁrepower to destroy the other type
of enemies more easily.
Every time you manage to destroy all the current spawning points you’ll advance to a next
stage where more spawnpoints will be added with more enemies and there will be some more
tubes that you can shoot to get more squad members. By adding more and better/faster/harder/stronger
enemies the stage will become more diﬃcult to survive and complete.
Section 2.4.1, Game Design Document 
Audio is played for actions like exploding bombs and gunﬁre. There are some ambient sounds
like falling water drops.
The soundtrack is dynamically build from drum, bass and guitar tracks. Together they
make up the soundtrack by choosing the more mellow parts when the game is not that intense
and choosing the more heavy parts when there is action. The volume will also adjust to reﬂect
the game play.
When you’ll lose squad members the drums lose volume and are send through a reverb so
that it sounds more hollow.
Game state framework
The game can be paused so that an interface is shown where you can quit or resume the game,
view the controls and a section where you can conﬁgure some options like the volume of the
These requirements are about the graphical features that have to be implemented. We decided
to put in particles and special custom shaders, because they can add a lot to the game experience
and sound cool.
We want to make use of particles to make explosions look awesome and to give the user feedback
about what happens. There are explosions with smoke and there are particles that represent
the damage done to enemies. Those particles ﬂy oﬀ the enemies on the other side of where they
have been hit.
Special Custom Shaders
Since we have animations in the game, we had to use the matrix palette shader that came with
the animation library. But the models looked ﬂat and rough since this shader doesn’t use any
form of lighting or advanced texture sampling. So we had to rewrite it to create out own custom
The texture sampling was added by describing that the sampler should use linear smoothing.
We added support for one ambient light and three point lights to the shader, as well as a
parameter to set specular power. The ambient light is deﬁned by only one color, while a point
light is deﬁned by a combination of color, position, falloﬀ and range. The lighting factor for
each point light is then created by taking the dot product of the pixel normal with the negative
light direction, raise that to the specular power, and then taking falloﬀ and range into account.
To give an illusion of shadows in the level we added a masking technique, that used the 4
separate channels of a texture (that should be as large as the level) as a mask for the diﬀerent
lights. We used the RGB channels as mask for the point lights and the alpha channel as mask
for the ambient light. This way we can darken our animated models in caves, or in the shadow
of a static object. Note that the diﬀerent channels are not the colors: each channel is just a
value from zero to one that is then multiplied by the already calculated light eﬀect.
We added fog support in our custom animation shader as well. This way all animated models
start out blended with the surroundings in the distance, and will be more visible as they are
ﬁnding their way to your squad!
The shader also handles highlight support. This highlights the model of an enemy as the
player moves the pointer over that enemy, or any other enemy in the same group. This way the
player can easily see which target he is telling his squad units to attack.
These requirements are about the Artiﬁcial Intelligence that will control certain objects in the
game. We chose Character, Group and Automatic Object Control, because those are all needed
to implement the game play the way it was designed.
Squad Movements We chose character control because we want to move our squad in a
’fuzzy’ way. The player doesn’t control the units directly. The specifc movement of the units
need to be controlled by the system.
While squad moves, it is the responsibility of every unit not to fall behind. When squad stops,
main positions are calculated using group control, yet individual units would keep readjusting
their positions themselves.
Enemy Movements Normally the movement of an enemy is indirectly controlled by the
group that it belongs to (see below). Yet when an enemy spots a squad member in its active
range, it takes control of its own movements and starts following the squad instead of its own
group. In case it looses the squad, it returns to its group again. Just a little disappointed.
Enemy Targeting After an enemy group is selected the character decides itself which particular enemy will he attack to. Each unit will be more likely to shoot the enemies standing
closest to itself. Yet the enemy needs to be in the selected enemy group.
Spawning The game has a spawn manager which manages the spawning of new enemies
from dynamic spawn points. This manager works using fuzzy logic to spawn a enemy group.
By looking at the active enemies and number of enemies in the world the spawn manager
decides, which spawning point to use, how many enemies to put in a group, what sort enemies
Spawn managers duties are extended to keep track of diﬀerent game stages, making the
game more and more diﬃcult.
Yet the spawn manager is not all that evil. It also spawns squad members when necessary.
When a pod is destroyed by the squad spawn manager checks the squad status to decide which
sort of unit the squad needs most, and than spawns it on the squad position.
Squad Movements Characters will be controlled by moving an invisible point across the
surface of the heightmap. Taking that invisible point as a center, for every type unit a main
position will be calculated with that types ranking as radius and a randomly generated angle.
All individual units will choose a place close to their types main position. Once a main
position is set for a unit type it is up to that type units to be organized around that point.
Although the general movement of the squad is considered to be the users responsibility, the
movement of the enemy groups are handled by each enemy group. Each enemy (If they do not
have the squad in their active range) patrols around the an invisible group center.
The group center uses a bread ﬁrst search algorithm to ﬁnd the squad in increasing number
of steps. When a valid path is found, the group center starts moving towards the squad. Not
to leave any fellow members behind, the group center moves in a relatively slow rate.
Enemies During the game play diﬀerent sorts of enemies will be spawned to keep the user
challenged. By each stage of the game, with new spawning points, there comes new types of
The attributes of enemies are selected considering their appearance, their role in game, the
attributes of the squad unit that is coupled with it. (For example if an enemy has a long range
it is not coupled with a squad unit which has short range).
A manta ray as an example; is quite a big creature. Being big, it is slow with a low range
yet it inﬂicts high amount of damage since in the beginning of the game, it is the only enemy
sort to be spawned.
The attributes of the other enemies can be seen in table 2.1.
Table 2.1: Attributes of enemies
Average Average Average
New Squad Types
New Enemy Types
Nr of Spawn points
Nr of Possible Enemies
Table 2.2: Stages of the game
Machinegunner Shotgunner Grenadier
Game Stages Table 2.2 shows how the game progresses between stages. As the game shifts
from one level to another, the spawn manager spawns new sort of enemies and pods. Those
pods can be used to get new squad members.
World and Viewer
The virtual world is a Component3DContainer and contains Component3D’s. Because Component3DContainer inherits from a Component3D he can reside in a Component3DContainer.
A simple application would be a tree as container, ﬁlled with leaves as components. The position, rotation and scale of the leaves are relative to the parent container, so if the tree would
move (!) the leaves would stay with the tree.
To display the virtual world we have a Viewer that has a Camera. The Camera has a
reference to the world so that is knows its position in the virtual world.
The Game calls the update method of the world and the world calls the update method to
all his childs recursively. The Game calls the draw method of the Viewer so that he can draw
Figure 3.1: Class Diagram of the units
Squad and Enemies All actors in the world belong to groups. The squad moves as one
group and acts in diﬀerent groups. Enemies should move and attack as groups. The group is
deﬁned by UnitGroup. All actors (Units) have one group to which they belong. The position of
the squad and the position of the units relative to the squad position are handled by the squad
Just as the squad units are generally controlled by the squad manager, so are the movements
of the enemies controlled by the enemy group managers.