Architecture Specification

Class-Responsibility Collaboration Divisions
Description: The basic game engine that drives each game cycle, and initializes everything needed for the game. Justification: It is a module on its own because its provides a backbone for the game and allows switching between worlds without a need to reload or recreate objects.



Description: This class is the over-arching class from which all playable levels (and test levels) are derived. It contains reference to the Farseer Physics World which is the container for all physics objects that follows the physical properties outlined in the Farseer physics engine. Justification: This class is a single, coherent module because it allows for the existence of levels in the game. Without levels, the game cannot be played since the goal of the player (Ninja) is to navigate through the levels and complete challenges to progress the game.



Description: This class governs the interaction between objects and worlds, and keeps track of the innate physics of object bodies, such as density, restitution, and friction. Justification: This module is a single, coherent module because this class puts all the objects into the world. Without this, objects cannot be placed properly into the world.



Description: Controls the player's perspective of the game world, and allows the view to be zoomed or panned when needed. Justification: It is a module on its own because the game perspective should be controlled by a single, central object.



Description: Countdown timer for the level. When time reaches zero, player loses. Justification: There is no need for any other class to keep track of the time, and the time is a victory condition that best interfaces directly with the game engine.



Description: This class will act as the container object for the main character, the ninja. The properties of the ninja are: speed, facing angle, and a short stack of objects it currently holds. Justification: This module is a single, coherent module because no other element or module in the program can represent it. Also, it has to be unique because it is the avatar that the player will control. The entire focus of the game depends on the interactions of this module with everything else.



Description: This class manipulates the Ninja actions by mapping keyboard/mouse inputs to Ninja parameters such as acceleration, velocity, movement, pick-up/throw objects, and throwing direction. It also controls game states that affect Ninja like death, damping, and color changes. Justification: This module is a coherent, singular module because it ties user inputs to Ninja actions.



Description: This class creates a wall, of any shape, based on the points given to it (vertices). Justification: This module is the building block for each of our levels.



Description: This class acts for all throwable objects used by the Ninja. The properties of the throwable object are: its body and properties (speed, restitution, etc) that governs it. Justification: This module is a single, coherent module because this is the only class capable of positively interacting with the Ninja through the pick-up and throw methods.



Description: This class is the over-arching class for all enemies in the game. The aliens are the force that the Ninja opposes controlled by an AI. The Ninja must clear levels which may require combatting the aliens. The aliens will act as obstacles to the Ninja's success in the game. Justification: This module is single and coherent because aliens are the main challenge and obstacles in the game. Without challenges and obstacles, the game would not be fun (nor would it fit the definition of a game very well).



Description: This class is responsible for Alien AI: strategic path-finding, attacking schemes, Alien states (dead/alive), and animation cues. AI is tailored to specific Alien types such as regular, plated, spiky, and bosses. Justification: This module is a single, coherent module because it takes care of the major AI component of our game: Aliens. It is the determining factor of difficulty, aside from puzzle complexity, and for "fun", interesting gameplay.



Description: This class creates a trigger that corresponds to the object it is attached to. Justification: This is the only class that will be able activate events in the game based on the player's actions.



Class Interface Details
Class GameEngine

void Initialize

Description:

Allows the game to perform any initialization it needs to before starting to run.

void LoadContent

Description:

Called once per game and is the place to load all content.

void UnloadContent

Description:

Called once per game and is the place to unload all content.

void Update( GameTime game_time )

Description:

Allows the game to run logic such as updating the world, checking for collisions, gathering input, and playing audio.

Parameters:

game_time - The current GameTime of the game.

void Draw( GameTime game_time )

Description: This is called to draw elements in the game.

Parameters: game_time - The current GameTime of the game.

Class GameWorld

void add_queued_object( GameObject obj )

Description:

Puts the game object in the add queue, to be added before the next time step. This is required as objects cannot be added during engine processing.

Parameters:

obj - the GameObject to be added the add queue.

void add_object( GameObject obj )

Description:

Adds obj to the world.

Parameters:

obj - the GameObject to be added to the world.

void Simulate( float time_step ) Description:

Updates all the objects in the game world, checking whether there are any objects that need to removed.

Parameter:

time_step - float determines how often the world is updated.

void Draw( SpriteBatch sprite_batch, Camera camera_eye ) Description:

Draws all the objects in the world.

Parameter: sprite_batch - what SpriteBatch object draws camera_eye - view that Camera sees

Class GameObject

void Update( float time_step )

Description:

Virtual function that forces all subclasses to make changes based on game time step.

Parameters:

time_step - float the game time step.

void Draw( SpriteBatch sprite_batch, Camera camera_eye ) Description:

Virtual function does nothing but forces subclasses to implement function to draw into SpriteBatch

Parameter: sprite_batch - what SpriteBatch object draws camera_eye - view that Camera sees

void destroy

Description:

Kills an object, setting its dead property to true so that it will be removed from the game void add_to_world Description: Adds GameObject to World to be affected by physical properties. void remove_from_world Description:

Removes GameObjects from World so it is no longer affected by physical properties

Class NinjaController

void Update( float time_step )

Description:

All game logic for the Ninja's movement and object interactions occur in this method.

Parameters:

time_step - float the game time step.

Class Ninja

Body create_physics

Description:

Sets the physical properties of the ninja, and creates a body.

Return:

the Body of the Ninja object

void pick_up( ThrowableObject throwing_item ) Description:

Adds a ThrowableObject to the Ninja's inventory (limited to 2 objects)

Parameters:

throwing_item - the ThrowableObject to be picked up

ThrowableObject throw_item

Description:

Removes the first ThrowableObject the ninja has.

Return:

the ThrowableObject the ninja is throwing.

void Draw( SpriteBatch sprite_batch, Camera camera_eye ) Description:

Draws the Ninja object.

Parameters: sprite_batch - what SpriteBatch object draws camera_eye - view that Camera sees

Class Alien

Body create_physics

Description:

Sets the physical properties of the alien, and creates a body.

Return:

the body of the alien

void Draw( SpriteBatch sprite_batch, Camera camera_eye ) Description:

Draws the ThrowableObject.

Parameters: sprite_batch - what SpriteBatch object draws camera_eye - view that Camera see

Class ThrowableObject

Body create_physics

Description:

Sets the physical properties of the ThrowableObject, and creates a body.

Return:

The Body of the ThrowableObject.

Class PolygonObject

Body create_physics

Description:

Sets the physical properties of the polygon object.

Return:

The body of the polygon object.

void Draw( SpriteBatch sprite_batch, Camera camera_eye )

Description:

Draws the polygon object.

Parameters: sprite_batch - what SpriteBatch object draws camera_eye - view that Camera sees

Class TriggerObject

bool can_be_activated_by( GameObject obj )

Description:

Checks to see if the object colliding can activate trigger

Parameter:

obj - the GameObject to check.

Return:

boolean, true if obj can activate the trigger and false if it can not.

void activated

Description:

Activates the object the trigger is attached to.

Side Effects:

The activate method from the corresponding GameObject is called.

void deactivated Description: Deactivates the object the trigger is attached to. Side Effects:

The deactivate method from the corresponding GameObject is called.

Class Timer

void set( int countdown_time)

Description:

Sets the timer to start counting down from the specified time.

Parameters:

countdown_time - int the time the timer should start counting down from.

void add_time( int bonus_time )

Description:

Increment the timer by the specified amount.

Parameters:

bonus_time - the amount to increase the timer by.

bool check_timer

Description: Check if the timer has finished counting. Side Effects:

If the timer has finished counting, then the player has lost.

Class Camera

void Move( Vector2 amount )

Description:

Moves the position of the camera by the value amount.

Parameter:

amount: The Vector2 added to the Camera’s current position.

Matrix get_transformation

Description:

Creates the transformation matrix that would be implemented in the initiation of the spriteBatch.

Class AlienController

void Update( float time_step )

Description:

All game logic for the AI's movement. Contains various algorithms for different Alien AI’s depending on type.

Parameters:

time_step - float the game time step.