ECE 291
Spring 1998


Programmers:


Introduction:

This program will emulate the old Atari game Centipede. The player is shown at the bottom of the screen and is able to move left and right and up and down (to an extent). The player is also allowed to shoot one bullet at a time. If a bullet is still shown on the screen, the player cannot shoot again until the bullet hit something or is off of the board. Also in the game is a centipede figure made out of 10 segments. If you shoot a segment it turns into a head (so the centipede actually divides into two different centipedes with different lengths). If you shoot a centipede that has only one segment, it turns into a mushroom. The goal of the game is to kill the centipede. If the centipede touches you, you loose a life. You will be given 3 lives before the game is over. Also in the game are obstacles called mushrooms. They are placed on the screen randomly and nothing can get by them. You can, however, shoot the mushroom, but it takes 3 hits for the mushroom to disappear completely. The mushroom gets smaller each time you shoot it until it dissappears. Our program will have sound and also different levels of play (the centipede moves faster on harder levels).


Problem Description:

The main problem that we will try to solve is to emulate the centipede game from scratch. . We will link the centipede sections together, which will be a challengin way to implement the game play. We also plan to do our project completely in assembly language.


External Procedures:

We used LIB291 as our only external procedure. We also used some of the code that we wrote for Mp4 like ShowScreenBuffer, the keyboard routines, and LoadPCX. We used the idea from MP3 for a delay but wrote our own.


Implementation:

For sound we are using Midpak and Digpak. Use PCX files for development of all the graphics. Bullet, player, centipede, and mushrooms are all controlled seperately. We will use arrays for the centipede and mushroom locations. Bullet and player of the large (32X20 array to hold 10X10 pixel tiles), mushrooms required to fit exactly into map array. Centipede can overlap into several tiles. Player and bullet movement check to see if they move into a tile occupied by the centipede or mushroom. Player can't pass thru mushrooms and is limited to the bottom portion of screen. If the centipede is hit, that section turns into a mushroom. Mushrooms change to a smaller mushroom if hit with a bullet until totally destroyed (3 hits). Each version of the mushroom requires 1 image. Levels add more mushrooms and centipede speed increases.


Pictures Used in the game play:

This picture is what is used for the pieces of the game play. Each image is 10 pixels wide by 10 pixels tall and seperated by a 6x6 blue border.


Variables:

Lives db 3
Fire db 0
Level db 1
Score dw 0
HitMushroom db 0
HitCentipede db 0
Death db 0
Highscore dw 0
Player_Pos dw 63675
head_1_pos dw ?
head_1_direction db ?
head_2_pos dw ?
head_2_direction db ?
head_3_pos dw ?
head_4_direction db ?
head_5_pos dw ?
head_5_direction db ?
head_1_valid db ?
head_2_valid db ?
head_3_valid db ?
head_4_valid db ?
head_5_valid db ?
randval dw 3
length_1 db 10
length_2 db 0
length_3 db 0
length_4 db 0
length_5 db 0
mushroom_num dw 25
delayC db 3
delayP db 3
map_array db ?
bullet_pos dw ?
go_left db 0
go_right db 0
go_up db 0
go_down db 0
shoot db 0
shootenable db 1
_ExitFlag db 0
VidSeg EQU 0A000h
VidTextSeg EQU 0B800h
CR EQU 13
LF EQU 10
Thousands dw 0
Hundreds dw 0
Tens db 0
Ones db 0
LevelTens db 0
LevelOnes db 0
centi_pos dw 90
dw 80
dw 70
dw 60
dw 50
dw 40
dw 30
dw 20
dw 10
dw 0
centi_dir db 10 dup(1)
centi_valid db 10 dup(1)

Notes On Certain Variables:


Functions:


Map_Array: (640 position in array)

0 - Where you can go
H - head1
I - head2
J - head3
K - head4
L - head5
1, 2, 3, 4, or 5 - Segments of centipede
P - Player
M - big mushroom
N - medium mushroom
O - Smallest mushroom


Points Awarded For Game Play:

1 - for mushroom hit
5 - for body hit
10 - for head hit


Programmer's Notes:

  • For the digitized sound, the only thing that we could get to work in the lab was the digpak with the help of the code from the Drinking Illini game. Any other way of programming sound did not work at all. At best with other code we got the speakers to pop when the sound was called. So we figured to at least get the sound to work to go ahead and use digpak even though Prof said not to use it. It was our last resort and we had to use it.
  • We had an original song for our game that was composed by Todd and put to midi by Todd but for some reason midiform wouldn't convert it to an xmi file format correctly. When it was converted no sound was heard when the computer was instructed to play the file. This caused many frustrations since so much time was spent writing a song and it couldn't even be used. So we ended up using one of the demo xmi files that came with midpak since midiform didn't seem to want to convert midi files correctly. Todd tried on many different computers to get it to work, but the only thing that worked was the demo files. You may listen to the original song if you like. Todd's Song