Main Match Loop

The main match loop can be found in RunMatch() in projectgemini.cpp. The process can be broken down into 5 steps: Read input, attack detection, update, collision detection, and post-update.

Each step is commonly looped through all players in the match, up to 4. This way, a step is completed for all players before moving onto the next step. This helps ensure that the order of a player in the list has no bearing on the results of each turn.

Read Input

Function: c_Player::ProcessInput()

GrEngine::ReadInput() must be executed first, as this will poll all attached controllers. This function does not need to be looped.

c_Player::ProcessInput() translates the controller input into actions the fighter will take. If an action is made, it is generally started here.

Attack Detection

Function: c_Player::AttackDetect()

All characters with active attacks will have the attack's current hitbox checked against all other characters. When there is collision between these, an attack may be recorded. The defending character may be taking actions such as dodging, blocking, or be in invulnerability frames; all of which may modify or outright stop an attack (some damage or motion may still be incurred.

If an attack is cleared, the game will take the intersection between the victim's hitbox and the offender's attack. The 'hit' will depend upon this shape. The vertices in the attackbox contain the values used. temporary vertices will be used at the points of intersection, interpolated between the vertices listed in the attackbox.

Layman's gist:: put attack shape over victim shape and intersect them together, clean up the rest with math.

End result is a long list of vertices, which can be used to determine the hit. Several values are tracked.

And of course, if a player is hit, then any action the took in the last phase will generally be discarded.


Function: c_Player::Update()

The general update function. Motion and physics will take place here. Execution of this step will preposition the characters according to their velocity.

Terrain Detection

Function: c_Stage::CollisionDetect()

Determines any collision with the terrain, and re-positions fighters. This is called from c_Stage, so that the c_Player class requires no knowledge of stage geometry to function.

This function is called in a while loop; it returns false when no further adjustment was necessary, signaling the end of the algorithm.

Post Update

A clean-up phase for update. Used to translate the sprites according to the positions set in the last 4 steps.

Function: c_Player::PostUpdate()