| ECE291 |
Computer Engineering II |
Lockwood, Fall 1997 |
Galactic Control: A Futuristic Combat Simulator
| Due Date |
December 10, 1997 |
| Purpose |
To get an A in ECE291 |
|
Team Members
|
David Pratt
Paul Bragiel
Gabriel Stern
Koichiro Miyazaki |

Introduction
The goal of this game is simple: Destroy your enemy. Don't get killed
yourself.
Players pilot warships of varying speed and power on a futuristic battlefield
populated with powerups, missiles, and other players.
Artificial Intelligence
The artificial intelligence is implemented in a state machine format.
It varies in three levels of difficulty. It dynamically calculates
the position and time at which the ship is to shoot the human opponent.
In higher levels of difficulty the artificial intelligence opponent has
the ability to increase the rate of fire, which is also called burst mode.
In the hardest level the ai opponent is programmed to run away if it encounters
a dangerous situation caused by the human opponent. It then proceeds
to come around and attack the human opponent from a strategic location.
Art/Design/Sound
All of the art was drawn from scratch. GFX2 and DP2 were used to
design all the characters and assorted art used in the game. It consisted
of 8 rotations for 2 ship types and 2 different variations on both ships.
He also implemented all the bullets, energy ports, life meters, backgrounds,
foregrounds as well as the whole introduction and credits/game over sequence.
Along with all of the art came intergration of the art through design.
The sound consisted of 10-15 wavs, which were downloaded via the internet
as public domain sounds.
Architecture
The game is based around a client/server messaging system. One player in
the game is designated as the 'server' with his opponent being the 'client'.
Messages received from the other machine are processed and stored in local
variables on either machine for later processing. A detailed messaging
protocol has been designed, in order to ensure synchronization of game
states between the machines, and to convey as much information as possible
with the smallest amount of network traffic.
The approach we have taken can best be described as semi-object-oriented.
We have defined several types of C and assembly structs that hold global
information and data about every object inside the game. For each of these
structs, we have defined a set of funtions that operate upon them, changing
their state according to predefined game rules.
-
The PLAYER object
-
PlayerID : byte
-
ShipID : byte ; used to hold information about what ship a player is piloting
-
XPos, YPos : word ; the location of the player
-
XVelocity, YVelocity : word ; the current velocity of the player
-
Angle : word ; the angle the player is facing
-
MaxVelocity : byte
-
Health : byte
-
UpdatePlayer() ; takes a far pointer to a player struct, and updates the
player's position and velocity
-
DestroyPlayer() ; takes a far pointer to a player struct and destroys that
player (and plays a nice explosion sound)
-
CreatePlayer() ; constructs a new player structure
-
DamagePlayer() ; this gets called when a player takes damage from the enemy.
-
The OBJECTILE object
-
ProjectileID : byte ; a unique number that identifies this projectile
-
XPos, YPos : byte
-
XVelocity, YVelocity : byte
-
FramesLeft : byte ; the number of frames left before this projectile disappears
-
CreateProjectile() ; creates a new projectile object
-
The SHIP Object
-
maxVelocity : The maximum velocity of the ship
-
turnRate : the turning rate of the ship
-
fireRate : the firing rate of the ship
-
damage : the damage taken to the ship when it is hit.
-
pXSize : the width of this ship's sprite
-
pYSize : the height of this ship's sprite.
Artificial Intelligence ( Koichiro Miyazaki )
This function is called when single player mode.
-
Parameters -
-
Description -
-
Make a decision of the next action in every flame based on
the direction, distanse, speed. The accuracy of the shooting depends on
the AILevel. When AILevel is the most difficult, every bullet loanch by
AI will hit to the enemy.
The Game Loop ( Koichiro Miyazaki )
The main game loop also has several functions associated with it, dealing
with game logic and rules
-
UpdatePlayer(), UpdateObjectile()
-
Parameters -
-
Player Number, Object Number
-
Description -
-
This is the main game logic procedure. It is called at the beginning of
every frame.
-
This function reads in information from the keyboard, updates the local
game objects, and sends information about the changes to the client.
-
CollisionDetection()
-
Parameters -
-
Description -
-
Detect the collision of the ships. If collision is occur decrease the health
of ships.
-
BulletHitDetection()
-
Parameters -
-
Description -
-
Detect the bullet hit to the ship.
-
ShipType()
-
Parameters -
-
Player Number, Ship Number
-
Description -
-
Assign the ship type of each player.
-
PlayerPositionInit()
-
Parameters -
-
Description -
-
Initiate the player position at the bigining of the battle.
-
StatusBar()
-
Parameters -
-
Description -
-
Display the amount of energy left for player 1 or 2, also displays amount
of lives left.
The Network Subsystem ( David Pratt )
The network operates by sending MSG structures back and forth between
client and server. It consists of three main fucntions.
-
netSendMessage()
-
Parameters -
-
Return type -
-
Description -This function packages up the data passed in and the MessageID
and sends it out on the network.
-
BlockOnConnectionRequest()
-
Parameters -
-
Description -
-
This function waits for a connection request, and returns SUCCESS or FAILURE..
-
UserInit
-
Parameters -
-
socketNum - the number of the game we want to play.
-
Description -
-
This function initialies the network, and returns the number of the current
player.
-
userSendPacket
-
Parameters
-
MessageID, and 8 words of data.
-
Description -
-
This packages the incoming data and sends it on the network
-
SendPlayerPositionInfo
-
Paramaters -
-
PlayerNum - the number of the player to package and send.
-
Description -
-
This function compiles the PLAYER structure for the passed player, and
sends it out on the network.
-
UnpackPlayerInfo
-
Parameters
-
PlayerNum - the number of the player to fill with incoming data
-
Description -
-
This function fills the selected PLAYER object with the data coming in
from the network.
-
SendAck
-
Paramaters
-
Description -
-
This function sends off an acknowledge packet to the other player.
-
SendPlayerInfo
-
Paramaters
-
PlayerNum - the number of the player to package and send.
-
Description -
-
This function is called when a player selects a ship
-
GetRemotePlayerInfo
-
Paramaters
-
Description -
-
blocks until a byte of player info is recieved or a timeout occurs
-
SendConnectionRequest
-
Paramaters
-
Description -
-
sends a request for a connection to the server and waits for a response
-
BlockOnRemotePlayerPositionInfo
-
Paramaters
-
Description -
-
this function blocks until it receives the remote players info
-
SendLocal
-
Paramaters
-
PlayerNum - the number of the player to package and send.
-
Description -
-
this fuction calls the assembly function that packages and sends off the
info for a give player
The Sound Subsystem ( Paul Bragiel )
-
PlaySound()
-
Parameters -
-
A pointer to the beginning of a sound buffer.
-
Description -
-
Plays the sound effect located at the passed parameter on the SoundBlaster
-
based on code from the lectures and playwav.asm
The Graphics Subsystem (Gabriel Stern )
-
DrawPlayers(), DrawObjectile()
-
Parameters -
-
Player Number, Object Number
-
Description -
-
This gets called when we have finished updating all of the game objects,
and want to render them to the screen. It then loops through the list of
objects, drawing them to a double buffer segment, and then copies this
buffer to video memory.
-
Was based off of code written for MP's four and five.
The Miscellaneous Functions ( Gabriel Stern )
-
DrawObject( )
-
Parameters
-
xpos, ypos = coordinates of where to display on screen
-
index = vlaue to load in si to retrieve image from
-
sizex, sizey = size of image in pixels
-
Description
-
Draws the selected object on the screen. Used in the PlayerMenu function.
-
Based off of the previous mp's.
-
InstallKey( )
-
Parameters
-
Description
-
Keyboard handler install for the main menus.
-
Based off of previous mp's.
-
DeInstKey( )
-
Parameters
-
Description
-
Deinstalls the menu keyboard handler.
-
Based off of previous mp's.
-
Keyinterrupt( )
-
Parameters
-
Description
-
sets new keyboard routine for menus, uses arrows, ESC, enter, y, n
-
Based off of previous mp's.
-
DifficultyMenu( )
-
Parameters
-
Description
-
Menu for choosing the difficulty setting you want to play at
-
PlayerMenu( )
-
Parameters
-
Description
-
Menu for choosing which ship you want to be
-
Intro ( )
-
Parameters
-
Description
-
animation of of "galactic control" and "Select your ship"
-
DisplaySplash ( )
-
Parameters
-
Description
-
displays title screen with small pause
-
Credits ( )
-
Parameters
-
Description
-
scrolls up vertically while displaying the closing cretis
-
GameOver ( )
-
Parameters
-
Description
-
gives option to quit or continue playing at end of game