technical document - badbug studio - xbox game

11
TECHNICAL DOCUMENT

Upload: fbs-cyprus-company-formation

Post on 13-May-2015

144 views

Category:

Career


5 download

DESCRIPTION

Old Project - BadBug Studio - Xbox Game

TRANSCRIPT

Page 1: Technical document - BadBug Studio - Xbox Game

TECHNICAL DOCUMENT

Page 2: Technical document - BadBug Studio - Xbox Game

Contents

1 Game Design 21.1 Level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 HUD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

1.2.1 Action Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2.2 Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2.3 Squad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2.4 Enemies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

1.3 Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.4 Camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Game Requirements 42.1 General Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.1.1 3D environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.1.2 Reward and Punishment system . . . . . . . . . . . . . . . . . . . . . . . 42.1.3 Level of difficulty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.1.4 Audio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.1.5 Game state framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.2 Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2.1 Particles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2.2 Special Custom Shaders . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2.3 Artificial Intelligence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.3.1 Character Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.3.2 Group Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.3.3 Path Finding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

3 Class Diagram 8

1

Page 3: Technical document - BadBug Studio - Xbox Game

Chapter 1

Game Design

1.1 Level

The level consists basically of 3 models: the level itself and 2 additional models to add moredetails to the world.

There is a special class which can be called upon that can determine from a Vector3 inputif that point is above the level model and can determine the height of the level model at a givenpoint. This is used to keep all moving units on top of the level.

1.2 HUD

There are a few 2D elements that make up the interface of the game.

1.2.1 Action Keys

The Action Keys show the player what the squad is doing. If the buttons light up it meansthat that part of the squad is busy attacking some enemies. The circle displays the amount ofsquad units of that type that are still alive.

1.2.2 Pointer

The pointer is a texture of which the position can be controlled with the right analogue stickof the Xbox controller or with the mouse. When it comes across something in the world, theobject reacts to it. A ray is shot into the world from the pointer’s position and the unit in theworld that detects it reacts to it.

1.2.3 Squad

We have four models that are loaded to a certain type of squad unit. Each type has it’s owngun after which the type is called. The types are: Machinegunner, Rocketlauncher, Grenadierand Shotgunner.

The Machinegunner fires a lot of bullets. The Rocketlauncher shoots rockets at enemieswhich explode at the point where the enemy was when the rocket was fired. The Grenadierthrows grenades at the enemy. Like a rocket the grenade will explode at the point where theenemy unit was when the grenade was thrown. Grenadiers and Rocketlaunchers are therebynot that effective against fast enemies. The Shotgunner will shoot bullets at a lower rate thanthe Machinegunner, but these bullets have a greater impact than the bullets from the machinegun.

2

Page 4: Technical document - BadBug Studio - Xbox Game

1.2.4 Enemies

There are four different types of enemies that move across the surface of the level. They attackthe squad when in they are within a certain range and follow them around the level. The fourdifferent types of enemies have a certain weakness for the different types in the squad. Theyare placed in groups that can be attacked by the squad unit types and are spawned from spawnpoints.

1.3 Movement

The movement of the squad is defined by a single point that travels on the height map. Thesquad 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 theWASD-keys.

1.4 Camera

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 thesquad is moving to. The movement of the camera is smoothed by a spring so it glides fromposition 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 camerawill 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 abetter overview of the level.

3

Page 5: Technical document - BadBug Studio - Xbox Game

Chapter 2

Game Requirements

In this chapter we will elaborate on the implementation of the general and choosen extra re-quirements.

2.1 General Requirements

These are the requirements that have to be met by the final product.

2.1.1 3D environment

Our game takes place in a 3D environment where the camera focus lies on a spot in the middleof the squad (or where the squad needs to go).

2.1.2 Reward and Punishment system

The player progresses by surviving and destroying the enemy. By doing this, the player com-pletes the stages.

As of the arcade part of the game, the player earns points by destroying enemies. Thenumber of squad units alive will act as a kind of multiplier. So if you survive everything whilemaintaining a high number of squad members your score will be higher than if you survive withless.1.

2.1.3 Level of difficulty

The level of difficulty increases when you progress in the level. You start with a small squadwith only one type (Shotgunner) with one type of enemies that has a weakness for Shotgunnerand only one spawnpoint from which they spawn. When you have destroyed that spawnpointyou’ll advance to the next stage. Two spawnpoints will be added where two different types ofenemies will spawn. The player now learns that the Shotgunner is not that capable againstthe other kind of enemy and needs help. He’ll find that in a tube that can be destroyed whichfrees some trapped squad members. Now he will have the firepower to destroy the other typeof enemies more easily.

Every time you manage to destroy all the current spawning points you’ll advance to a nextstage where more spawnpoints will be added with more enemies and there will be some moretubes that you can shoot to get more squad members. By adding more and better/faster/harder/strongerenemies the stage will become more difficult to survive and complete.

1Section 2.4.1, Game Design Document [1]

4

Page 6: Technical document - BadBug Studio - Xbox Game

2.1.4 Audio

Audio is played for actions like exploding bombs and gunfire. There are some ambient soundslike falling water drops.

The soundtrack is dynamically build from drum, bass and guitar tracks. Together theymake up the soundtrack by choosing the more mellow parts when the game is not that intenseand choosing the more heavy parts when there is action. The volume will also adjust to reflectthe game play.

When you’ll lose squad members the drums lose volume and are send through a reverb sothat it sounds more hollow.

2.1.5 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 configure some options like the volume of thesoundtrack.

2.2 Graphics

These requirements are about the graphical features that have to be implemented. We decidedto put in particles and special custom shaders, because they can add a lot to the game experienceand sound cool.

2.2.1 Particles

We want to make use of particles to make explosions look awesome and to give the user feedbackabout what happens. There are explosions with smoke and there are particles that representthe damage done to enemies. Those particles fly off the enemies on the other side of where theyhave been hit.

2.2.2 Special Custom Shaders

Since we have animations in the game, we had to use the matrix palette shader that came withthe animation library. But the models looked flat and rough since this shader doesn’t use anyform of lighting or advanced texture sampling. So we had to rewrite it to create out own customshader.

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 defined by only one color, while a pointlight is defined by a combination of color, position, falloff and range. The lighting factor foreach point light is then created by taking the dot product of the pixel normal with the negativelight direction, raise that to the specular power, and then taking falloff and range into account.

To give an illusion of shadows in the level we added a masking technique, that used the 4separate channels of a texture (that should be as large as the level) as a mask for the differentlights. We used the RGB channels as mask for the point lights and the alpha channel as maskfor the ambient light. This way we can darken our animated models in caves, or in the shadowof a static object. Note that the different channels are not the colors: each channel is just avalue from zero to one that is then multiplied by the already calculated light effect.

5

Page 7: Technical document - BadBug Studio - Xbox Game

We added fog support in our custom animation shader as well. This way all animated modelsstart out blended with the surroundings in the distance, and will be more visible as they arefinding their way to your squad!

The shader also handles highlight support. This highlights the model of an enemy as theplayer moves the pointer over that enemy, or any other enemy in the same group. This way theplayer can easily see which target he is telling his squad units to attack.

2.3 Artificial Intelligence

These requirements are about the Artificial Intelligence that will control certain objects in thegame. We chose Character, Group and Automatic Object Control, because those are all neededto implement the game play the way it was designed.

2.3.1 Character Control

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 unitsneed 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 readjustingtheir positions themselves.

Enemy Movements Normally the movement of an enemy is indirectly controlled by thegroup that it belongs to (see below). Yet when an enemy spots a squad member in its activerange, it takes control of its own movements and starts following the squad instead of its owngroup. 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 par-ticular enemy will he attack to. Each unit will be more likely to shoot the enemies standingclosest to itself. Yet the enemy needs to be in the selected enemy group.

2.3.2 Group Control

Spawning The game has a spawn manager which manages the spawning of new enemiesfrom 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 managerdecides, which spawning point to use, how many enemies to put in a group, what sort enemiesto spawn.

Spawn managers duties are extended to keep track of different game stages, making thegame more and more difficult.

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 whichsort 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 thesurface of the heightmap. Taking that invisible point as a center, for every type unit a mainposition 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 mainposition is set for a unit type it is up to that type units to be organized around that point.

6

Page 8: Technical document - BadBug Studio - Xbox Game

2.3.3 Path Finding

Although the general movement of the squad is considered to be the users responsibility, themovement of the enemy groups are handled by each enemy group. Each enemy (If they do nothave the squad in their active range) patrols around the an invisible group center.

The group center uses a bread first search algorithm to find the squad in increasing numberof steps. When a valid path is found, the group center starts moving towards the squad. Notto leave any fellow members behind, the group center moves in a relatively slow rate.

Enemies During the game play different sorts of enemies will be spawned to keep the userchallenged. By each stage of the game, with new spawning points, there comes new types ofenemies.

The attributes of enemies are selected considering their appearance, their role in game, theattributes of the squad unit that is coupled with it. (For example if an enemy has a long rangeit 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 rangeyet it inflicts high amount of damage since in the beginning of the game, it is the only enemysort to be spawned.

The attributes of the other enemies can be seen in table 2.1.

Table 2.1: Attributes of enemiesAttributes:

Enemies: Range Speed DamageManta Ray Short Low HighBug Average Average AverageBee Short High LowBoomer Long Average Low

Table 2.2: Stages of the gameStage 1 Stage 2 Stage 3 Stage 4

New Squad Types Machinegunner Shotgunner Grenadier RocketlauncherNew Enemy Types Manta ray Bug Bee BoomerNr of Spawn points 1 2 3 3Nr of Possible Enemies 50 75 100 200

Game Stages Table 2.2 shows how the game progresses between stages. As the game shiftsfrom one level to another, the spawn manager spawns new sort of enemies and pods. Thosepods can be used to get new squad members.

7

Page 9: Technical document - BadBug Studio - Xbox Game

Chapter 3

Class Diagram

World and ViewerThe virtual world is a Component3DContainer and contains Component3D’s. Because Com-

ponent3DContainer inherits from a Component3D he can reside in a Component3DContainer.A simple application would be a tree as container, filled with leaves as components. The posi-tion, rotation and scale of the leaves are relative to the parent container, so if the tree wouldmove (!) the leaves would stay with the tree.

To display the virtual world we have a Viewer that has a Camera. The Camera has areference 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 toall his childs recursively. The Game calls the draw method of the Viewer so that he can drawthe world.

Figure 3.1: Class Diagram of the units

Squad and Enemies All actors in the world belong to groups. The squad moves as onegroup and acts in different groups. Enemies should move and attack as groups. The group is

8

Page 10: Technical document - BadBug Studio - Xbox Game

defined by UnitGroup. All actors (Units) have one group to which they belong. The position ofthe squad and the position of the units relative to the squad position are handled by the squadmanager.

Just as the squad units are generally controlled by the squad manager, so are the movementsof the enemies controlled by the enemy group managers.

9

Page 11: Technical document - BadBug Studio - Xbox Game

10