Architecture Specification

Architecture Specification

CRC Cards
Keep in mind that only either the Wii Controller or Mouse Controller is active at a time.

Mouse Controller
Description

This module reads the mouse state, converts it into the standardized Input State, and adds it to the Input Buffer. Single Module Justification

This is separate from the Wii Controller because the control methods use different libraries and provide needed input data in different formats.

Wii Controller
Description

This is parallel to the Mouse Controller. This module reads the Wiimote state, converts it into the standardized Input State, and adds it to the Input Buffer. Single Module Justification

It is separate from the Mouse Controller because the control methods use different libraries and provide needed input data in different formats.

Level Controller
Description

This module drives all components used in the rhythm section of the game. It keeps track of where the player is in the song, and it updates the score as the song progresses. It can be considered a controller. It also handles the drawing of HUD related displays. Single Module Justification

Level Controller processes information of the current play level, which includes current beat, movement, score, etc. In addition, it draws content related to the level onto the screen.

Game Engine
Description

This is the top-level controller. It activates controllers based on the current game mode. It is the thinnest of the controllers. Single Module Justification

There needs to be some connection between different game modes. This delegates the main updating to the appropriate controller, loading and unloading components as needed.

Story Controller
Description

A controller of the story mode that updates the player’s resources according to his/her scores from each of the levels of the story. Also responsible for calling story view to update the map drawing and other HUD displays. Single Module Justification

This is a controller dedicated to the story mode of the game.

Story Model
Description

A model that maintains the current state of the player’s progress in the story mode, including information of the current player’s manageable resources, recruited musicians, unlocked/succeeded levels, and current state of the map (accessible and inaccessible paths). Single Module Justification

This is a model that stores the state of the story mode of the game.

Input Buffer Model
Description

It is necessary for the game to save a buffer of input collected over different frames so the game may score the player’s accuracy on each beat. The Wiimote and Mouse control schemes provide data in fundamentally different ways; Input Buffer provides a standard interface for the rest of the game to acquire position, velocity, acceleration, and button state. Single module Justification

<p style="line-height:normal">This model simply stores a collection of positions, velocities, accelerations, and button states until the Movement Evaluator is ready to score those inputs and flush the buffer.

Movement Queue
<p style="line-height:normal">Description

Movement Queue contains data on some action to be performed, such as a shake or a wave or no operation. Curves and straight lines on screen can be represented.

<p style="line-height:normal">Single Module Justification

This is a model because it is the only class that stores information about actions to be performed and patterns to be drawn.

Movement Evaluator Model
<p style="line-height:normal">Description

<p style="line-height:normal">This is a model that compares a list of input states to a given movement path and scores how well they match - the higher the score, the better the match. A threshold is set up to determine success or failure of the last movement based on the accuracy score. The evaluator can also take in other elements, such as volume, when computing the accuracy. Single Module Justification

<p style="line-height:normal">This is a model because it handles self-contained calculations using data from Input Buffer and Movement Queue that compute the score obtained after each movement is finished.

Level Model
<p style="line-height:normal">Description

<p style="line-height:normal">Each level model represents a playable level of the game. It stores the essential logical and visual information of the current level. Single Module Justification

<p style="line-height:normal">It is a container for the state and player progress of a game level.

Baton View
<p style="line-height:normal">Description

<p style="line-height:normal">This contains the drawing code for the baton, which is essentially a cursor. The baton gains extra visual effects, like sparkles, when the player is making many consecutively accurate movements. Single Module Justification

<p style="line-height:normal">The baton contains no logic of its own: it is essentially a cursor which changes appearance as the level progresses.

Movement View
Description

<p style="line-height:normal">It contains the drawing code for Movement Queue model. Single Module Justification

This is a separate view module that is dedicated to provide visual cues to players for the upcoming events.

Stage View
<p style="line-height:normal">Description

This calls the level model to get the background for the current level, score of the current level, and coordinates of the musicians and draws them onto the screen. Single Module Justification

<p style="line-height:normal">This is a separate view module responsible for displaying visual elements other than movement of the current level.

Story View
<p style="line-height:normal">Description

<p style="line-height:normal">This draws a dialog box and a background, to illustrate the story between levels. Single Module Justification

All the drawing code of this scene is extracted to one place, because it is primarily an artist and game designer responsibility, with no real programming logic needed.

Menu Controller
<p style="line-height:normal">Description

<p style="line-height:normal">This allows user navigation from the title screen to the map screen, and from the play level screen back to the pause screen to the title screen. Single Module Justification

All menu systems are very similar in user interaction: a user has a list of text options and selects one of them to navigate to another menu or game mode. Thus, a single controller can render different views (menus) easily.

Pause Screen View
<p style="line-height:normal">Description

<p style="line-height:normal">Draws a simple pause screen to return to the game or exit to the title screen. Single Module Justification

The pause screen is a simple but necessary view; it is simply something to cover up the screen as the player takes a break.

Title Screen View
<p style="line-height:normal">Description

<p style="line-height:normal">This is another simple view to draw the title screen artwork and present options to either exit or continue into story mode. Single Module Justification

<p style="line-height:normal">The title screen has very few options; it is primarily for the artists to make a good first impression of the game.

Module Dependency Graph
<p style="line-height:normal">

Mouse Controller
<p style="line-height:normal">Fields

InputBuffer buffer <p style="margin-left:.5in;text-indent:-.25in;mso-list:l0 level1 lfo1; tab-stops:list .25in .5in">● A reference to the input buffer

<p style="line-height:normal">Functions

<p style="line-height:normal">void Update(GameTime t)

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l1 level1 lfo2;tab-stops:list .25in .5in">● Reads the mouse position

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l1 level1 lfo2;tab-stops:list .25in .5in">● Creates a corresponding InputState

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l1 level1 lfo2;tab-stops:list .25in .5in">● Adds the InputState to the buffer

Wii Controller
<p style="line-height:normal">Fields

<p style="line-height:normal">InputBuffer buffer

<p style="margin-left:.5in;text-indent:-.25in;mso-list:l2 level1 lfo3; tab-stops:list .25in .5in">● A reference to the input buffer

<p style="line-height:normal">Functions

<p style="line-height:normal">void Update(GameTime t)

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l3 level1 lfo4;tab-stops:list .25in .5in">● Reads the Wiimote position

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l3 level1 lfo4;tab-stops:list .25in .5in">● Creates a corresponding InputState

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l3 level1 lfo4;tab-stops:list .25in .5in">● Adds the InputState to the buffer

Level Controller
<p style="line-height:normal">Fields

Level l <p style="margin-left:.5in;text-indent:-.25in;mso-list:l4 level1 lfo5; tab-stops:list .25in .5in">● A reference to the level model that collaborates with this controller

<p style="line-height:normal">Functions

<p style="line-height:normal">void Update(GameTime t)

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l5 level1 lfo6;tab-stops:list .25in .5in">● Calculates the current beat

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l5 level1 lfo6;tab-stops:list .25in .5in">● If the beat is changed, adds and removes movements from the list as needed

void Draw(SpriteBatch sp) <p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l6 level1 lfo7;tab-stops:list .25in .5in">● Calls the Draw function for each of the movement in the draw set

Story Controller
<p style="line-height:normal">Fields

<p style="line-height:normal">Story s

<p style="margin-left:.5in;text-indent:-.25in;mso-list:l7 level1 lfo8; tab-stops:list .25in .5in">● A story model associated with the story controller

<p style="line-height:normal">Functions

<p style="line-height:normal">void Initialize

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l8 level1 lfo9;tab-stops:list .25in .5in">● Initializes a new story Model

<p style="line-height:normal">void SetStory

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l9 level1 lfo10;tab-stops:list .25in .5in">● sets the story model that is currently associated with this controller

<p style="line-height:normal">voidUpdate(GameTime gameTime)

<p style="margin-left:.5in;text-indent:-.25in;mso-list:l10 level1 lfo11; tab-stops:list .25in .5in">● Updates the story model according to user input

void Draw(SpriteBatch spriteBatch) <p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l11 level1 lfo12;tab-stops:list .25in .5in">● Calls Draw method from StoryView

Game Engine
<p style="line-height:normal">Fields

<p style="line-height:normal">SpriteBatch spriteBatch

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l12 level1 lfo13;tab-stops:list .25in .5in">● Used to draw onto screen

<p style="line-height:normal">Baton baton

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l13 level1 lfo14;tab-stops:list .25in .5in">● The baton used to represent player movement

<p style="line-height:normal">Functions

<p style="line-height:normal">void Initialize

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l8 level1 lfo9;tab-stops:list .25in .5in">● Initializes the field varibles

<p style="line-height:normal">void LoadContent

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l9 level1 lfo10;tab-stops:list .25in .5in">● Calls LoadContent methods of baton and level

<p style="line-height:normal">void Update(GameTime gameTime)

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l10 level1 lfo11;tab-stops:list .25in .5in">● Calls Update(GameTime gameTime) methods of baton and level

<p style="line-height:normal">void Draw(SpriteBatch spriteBatch)

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l11 level1 lfo12;tab-stops:list .25in .5in">● Calls Draw(SpriteBatch spriteBatch) methods of baton and level

Input Buffer
<p style="line-height:normal">Fields

<p style="line-height:normal">List<InputState> buffer

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l14 level1 lfo15;tab-stops:list .25in .5in">● A list of InputStates received from mouse/Wiimote controller containing information of baton position, velocity and acceleration

<p style="line-height:normal">Functions

<p style="line-height:normal">void Add(InputState istate)

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l15 level1 lfo16;tab-stops:list .25in .5in">● Adds istate to buffer

<p style="line-height:normal">List<InputState> Buffer

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l16 level1 lfo17;tab-stops:list .25in .5in">● Returns the buffer

<p style="line-height:normal">void Clear

<p style="margin-left:.5in;text-indent:-.25in;mso-list:l17 level1 lfo18; tab-stops:list .25in .5in">● Clears the buffer

Movement Queue
Fields Movement.Type Type <p style="margin-left:.5in;text-indent:-.25in;mso-list:l18 level1 lfo19; tab-stops:list .25in .5in">● Type of this movement - shake, wave, or noop (i.e. no operation)

int StartBeat, EndBeat <p style="margin-left:.5in;text-indent:-.25in;mso-list:l19 level1 lfo20; tab-stops:list .25in .5in">● Defines the duration in which the movement should be carried out

int ShowBeat, FadeBeat <p style="margin-left:.5in;text-indent:-.25in;mso-list:l20 level1 lfo21; tab-stops:list .25in .5in">● Defines the duration in which the movement should be displayed on the screen

Point StartCoordinate, EndCoordinate <p style="margin-left:.5in;text-indent:-.25in;mso-list:l21 level1 lfo22; tab-stops:list .25in .5in">● The start and end coordinates of the movement

Movement Evaluator
<p style="line-height:normal">Fields

<p style="line-height:normal">IEnumerable<InputState> states

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l22 level1 lfo23;tab-stops:list .25in .5in">● A collection of input detections, which together form a movement

<p style="line-height:normal">Movement currentMovement

<p style="margin-left:.5in;text-indent:-.25in;mso-list:l23 level1 lfo24; tab-stops:list .25in .5in">● A movement object currently being evaluated

<p style="line-height:normal">Functions

float Accuracy(Movement m, IEnumerable<InputState> input, GameTime t) <p style="margin-left:.5in;text-indent:-.25in;mso-list:l24 level1 lfo25; tab-stops:list .25in .5in">● Returns a floating number 0 to 1 which indicates how well the input is matching the movement

<p style="margin-left:.5in;text-indent:-.25in;mso-list:l24 level1 lfo25; tab-stops:list .25in .5in">● Can use game time in case we want more granularity, for example, indicate in midbeat how well a player is doing.

Level Model
<p style="line-height:normal">Fields

<p style="line-height:normal">Stopwatch watch

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l25 level1 lfo26;tab-stops:list .25in .5in">● Keeps track of the time after the level starts to calculate the value of the current beat

<p style="line-height:normal">int currentBeat

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l26 level1 lfo27;tab-stops:list .25in .5in">● The current beat

<p style="line-height:normal">int score

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l27 level1 lfo28;tab-stops:list .25in .5in">● The current score

<p style="line-height:normal">int beatTime

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l28 level1 lfo29;tab-stops:list .25in .5in">● The BPM of the song

<p style="line-height:normal">LinkedList<Movement> actionList

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l29 level1 lfo30;tab-stops:list .25in .5in">● The list of the actions waiting to be displayed to and performed by the player

<p style="line-height:normal">HashSet<Movement> drawSet

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l30 level1 lfo31;tab-stops:list .25in .5in">● The set of movements that are currently being displayed/drawn to the screen

Movement currentMovement <p style="margin-left:.5in;text-indent:-.25in;mso-list:l31 level1 lfo32; tab-stops:list .25in .5in">● The current movement that is expected to be performed by the player

<p style="line-height:normal">Functions

<p style="line-height:normal">void LoadContent

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l32 level1 lfo33;tab-stops:list .25in .5in">● Loads the level from an XML file, which contains the MP3’s path and the list actions

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l32 level1 lfo33;tab-stops:list .25in .5in">● Loads the actions into a movement list.

<p style="line-height:normal">int Score

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l33 level1 lfo34;tab-stops:list .25in .5in">● Gets the current score

<p style="line-height:normal">int Beat

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l34 level1 lfo35;tab-stops:list .25in .5in">● Gets the current beat

<p style="line-height:normal">Movement currentMovement

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l35 level1 lfo36;tab-stops:list .25in .5in">● Gets the movement that is currently expected to be performed by the player

Story Model
<p style="line-height:normal">Fields

<p style="line-height:normal">int gold

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l25 level1 lfo26;tab-stops:list .25in .5in">● Player’s current gold

<p style="line-height:normal">int fame

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l26 level1 lfo27;tab-stops:list .25in .5in">● Player’s current fame

<p style="line-height:normal">HashSet<Musicians> musicians

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l27 level1 lfo28;tab-stops:list .25in .5in">● Musicians that have been recruited

<p style="line-height:normal">int elapsedTime

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l28 level1 lfo29;tab-stops:list .25in .5in">● Time elapsed since the beginning of the game

<p style="line-height:normal">LinkedList<Station> stations

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l29 level1 lfo30;tab-stops:list .25in .5in">● The list of the individual “station” on the game map. When player is in contact with one of the stations, it triggers dialogs with NPC’s and introduces the player to new game levels

<p style="line-height:normal">Station currentStation

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l30 level1 lfo31;tab-stops:list .25in .5in">● The station the player is currently located at

<p style="line-height:normal">StoryModel.ModeType mode

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l31 level1 lfo32;tab-stops:list .25in .5in">● Indicates which mode the story is currently in Functions

void LoadContent <p style="margin-left:.5in;text-indent:-.25in;mso-list:l36 level1 lfo37; tab-stops:list .25in .5in">● Loads the game map and XML files that contain saved game status (current gold, fame, player’s name, gametime, etc.)

<p style="line-height:normal">bool Move(Direction d)

<p style="margin-left:.5in;text-indent:-.25in;mso-list:l37 level1 lfo38; tab-stops:list .25in .5in">● Allows the player to move in one direction, returns whether that movement has succeeded

void loadStation <p style="margin-left:.5in;text-indent:-.25in;mso-list:l38 level1 lfo39; tab-stops:list .25in .5in">● Loads the content (includes story, associated game level, etc) of the current station

void setCurrentStation(Station s) <p style="margin-left:.5in;text-indent:-.25in;mso-list:l39 level1 lfo40; tab-stops:list .25in .5in">● Sets the current station to s

<p style="line-height:normal">void Evaluate(int score)

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l40 level1 lfo41;tab-stops:list .25in .5in">● Updates the player’s gold and fame according to the score of a played level

Baton View
Functions

void Draw(GameTime t) <p style="margin-left:.5in;text-indent:-.25in;mso-list:l41 level1 lfo42; tab-stops:list .25in .5in">● Draws the baton onto screen using the position from user input

<p style="line-height:normal">void LoadContent

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l42 level1 lfo43;tab-stops:list .25in .5in">● Loads the baton texture

<p style="line-height:normal">void Update(GameTime t)

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l43 level1 lfo44;tab-stops:list .25in .5in">● Collects input from input device

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l43 level1 lfo44;tab-stops:list .25in .5in">● Stores the input into an InputState structure and adds it to the collection

<p style="line-height:normal">IEnumerable<InputState> CurrentInput

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l44 level1 lfo45;tab-stops:list .25in .5in">● Returns a list of input states for the last beat, to be evaluated and scored

<p style="line-height:normal">void Flush

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l45 level1 lfo46;tab-stops:list .25in .5in">● Clears the list of input states

Movement View
<p style="line-height:normal">Functions

<p style="line-height:normal">void LoadContent

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l42 level1 lfo43;tab-stops:list .25in .5in">● Loads the movement texture

<p style="line-height:normal">void Draw(Movement m, SpriteBatch sb)

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l46 level1 lfo47;tab-stops:list .25in .5in">● Draws the input movement onto the screen

Story View
<p style="line-height:normal">Functions

<p style="line-height:normal">void LoadContent

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l42 level1 lfo43;tab-stops:list .25in .5in">● Loads the textures needed for the story mode

<p style="line-height:normal">void Draw(Story s, SpriteBatch sb)

<p style="margin-left:.5in;text-indent:-.25in;mso-list:l46 level1 lfo47; tab-stops:list .25in .5in">● Draws the input state of the story mode of the game onto the screen

Stage View
<p style="line-height:normal">Functions

<p style="line-height:normal">void LoadContent

<p style="margin-left:.5in;text-indent:-.25in;line-height:normal; mso-list:l42 level1 lfo43;tab-stops:list .25in .5in">● Loads the textures needed for the stage

<p style="line-height:normal">void Draw(Level l, SpriteBatch sb)

<p style="margin-left:.5in;text-indent:-.25in;mso-list:l46 level1 lfo47; tab-stops:list .25in .5in">● Draws/updates the background, musician characters onto the screen

Data Representation Model
<p style="line-height:normal">The XNA Content Pipeline is leveraged for XML data. By providing the “Asset Type” and a class name, the framework automatically serializes object fields.

Saved Game File
A saved game uses the “SaveData” class for serialization. It is an XML file with the following tags:

Game Level File
A level uses the LevelData class for serialization. The serialized LevelData is an XML file with the following tag structure:

Third-Party Libraries
<p style="line-height:normal">Codeplex Wii Library

<p style="line-height:normal">This library allows for the game to read the Wiimote as an input device. The library provides access to a WiimoteState object, which provides the gyroscope acceleration in three dimensions, infrared position in two dimensions, and the Boolean button states. We can also read from the nun-chuck extension, which provides Boolean button states and a joystick position in two dimensions. All vectors are available in a normalized (0 to 1 float) format, as well as a raw format. The acceleration will be used to detect shaking movements; the infrared, to detect waving motions. Some movements will also require a button press, which we can check as well.