| ECE291 | Computer Engineering II | Lockwood, Spring 1998 |
| Assigned | March 14, 1998 |
| Due Date | Friday, May 1, 1998, 5pm |
| Points | 160 |
Members:
Tommy Falk
Joseph Burnett
Naveen Neelakantam
Joe Opiala
Today, you decide to take a vacation. So you hop in your car and go for a little ride down South. However, you notice the roads seem a little different today. At one point you find a car standing in the middle of the road. At another point, a cow comes out of nowhere. Be careful not to run him over. But don't get hit by the huge truck coming at you from your side because now you're at an intersection. What is going on here? No, it's not a dream. Welcome to the world of High 65 where all sorts of hazardous obstacles must be avoided by you, the driver. Your goal is to safely navigate down the stretch known as I-65. Panama City awaits. But, getting there is the real challenge.
This game will require an engine of its own. This involves continously keeping track of constantly changing variables in order to render a real-life simulation of a driving experience. Scaling in two dimensions will be the thrust of this game. However, the scaling algorithm must be fast and easily accessible. Finding the pictures to scale may require a little artistic integrity and manipulation on behalf of our PCX experts. And finally, writing the script to the game will require extracting several streams of data.
The introduction begins with PCX image and fades out into the game. The title "High 65" is displayed..
The game will be rendered in 320x200 resolution. What appears on the screen represents the driver's perspective. This is handled by two distinct scaling techniques. The first uses a continous feed of strips from PCX files. The far left and far right of the screen will be scaled 100%. Each succesive strip towards the center will be linearly scaled down. As the driver accelerates using the space bar, the rate at which these strips are outputed increases starting the from the center of the screen out. The second scaling technique involves scaling an image from a certain depth. The range of the depth is the length of a two dimensional array called the RoadArray which holds all elements currently on the road. The driver can strafe either right or left via the arrow key. This is easily implemented by scrolling the screen in the opposite direction the car goes. Thus, bounds checking and image clipping become essential for displaying the status of RoadArray. Each element of Road Array will represent a particular obstacle and size depending on its value. At each step the driver advances down the road, the array shifts down by a row, and the bottom row of the array is checked for collisions between the driver and an obstacle. At fixed intervals, the game engine will generate obstacles to insert into the top row of RoadArray. Otherwise, a blank strip of road is inserted into RoadArray. These obstacles will be included in an array called Game# where each element contains the type of obstacle and its X-position.
Music will be generated through .midi files. Sound effects will be generated through .wav files.
RoadArray - a 80*45 array of bytes. This represents what is currently visible on the road. The vast majority of the array will contain empty spaces designated by the space character. Any obstacles present will also be contained in the array represented by certain characters. The very top row represents minimal scaling, and the bottom, maximum scaling.
LeftPCX/RightPCX - an array of bytes holding the offsets to PCX files.
TriangleLoc - the offset of the starting location for scaling the left-side background. The rest of the screen can be referenced to this point.
Car - the horizontal location of the car on the screen
Frequency - the rate at which characters are generated for the road array
Game - the distance the car has travelled
|
DrawTriangles Naveen |
Draws 2 linear scales of cross sections of PCX files. The starting offset of the left triangle is at TriangleLoc. The PCX files can be accessed through the offsets stored in LeftPCX and RightPCX.
Inputs: Outputs: Modifies ScreenBuffer |
GameSetupTom |
Initialize Frequency, Velocity, and postion of Car. Game is set to video mode.
Inputs: Outputs: |
LoadPCXNaveen |
Load a PCX file into the ScreenBuffer. The file must be 320x200x256 colors,
and be in the same directory as the executable.
Inputs: Outputs: |
ShowPCXNaveen |
Blast ScreenBuffer to screen
Inputs: ScreenBuffer Outputs: 320x200 image |
DrawStripNaveen |
Draws a texture strip scaled to the right length in the correct column.
Inputs: Scale = the height of the strip to be drawn X = the x-position where the strip is to be drawn stripnum = the location of the strip in the texture texnum = the texture to take the strip from Outputs: Places a texture strip into ScreenBuffer |
GenerateTom |
Generates a random char at a random location. This is accomplished by reading a random timer variable, then, checking bounds so it is within the range of a column width. The random char is within the range 0-15. This number represents the offset to a lookup table containing the location of the object. Hint: use AND operations.
Inputs: ax = char dx = generate or not (1,0) |
MoveScreenJoe O. |
Increment or decrement TriangleLoc and Car based on GO_LEFT or GO_RIGHT. The range of TriangleLoc needs to be checked so the pixel location covers only one row on a 320*200 screen Inputs: keyboard Outputs: TriangleLoc, Car |
CheckCollisionTom |
Check for a collision based on the status of the last row of RoadArray. Will use constant, RANGE, to detect if an object is with the car's current location. Several actions need to be considered. If the car touches the curb the car must slow down. If the car hits another object the car must explodes. Inputs: none Ouputs: Explosion screen if collision occured |
ArrayMovementTom |
Move elements of Road Array that want to move. Must sequentially check every element of RoadArray and record the next location of each object encountered. Hint: Use the stack Inputs: none Ouputs: modifies RoadArray |
DrawRoadNaveen |
Outputs scaled elements of RoadArray to ScreenBuffer. Calls drawcar in order to draw each individual element. The location of object is altered in order to create perspective. Inputs: none Outputs: Modifies ScreenBuffer |
DrawSceneNaveen. |
Draws BackGround image above and below the horizon. Note this image will require to use of the same pallette entries as everything else on the road.
Inputs: ax = verical position of horizon line bx = offset of upper image cx = offset of lower image Outputs: Modifies ScreenBuffer |
MoveArrayTom |
Chops off bottom of RoadArray. Then, shifts the entire RoadArray down once, and inserts the top row into RoadArray. Each time the procedure is called the GAME variable is incremented. This represents the distance the car moves down the road.
Inputs: none Outputs: Modifies RoadArray |
DrawCarNaveen |
Scale a rectangular image at a certain offset and scale factor. Will use invisible pixels to render a realistic pixel. Calls drawstip to scale vertically. Then, uses its own horizontal scaling algorithm to scale the image horizontally. Inputs: dx = offset in memory of image di = top left offset ax = scale factor Ouputs: Modifies ScreenBuffer |
PlaySequenceJoe O. |
This function of int 66h plays the midi file. It plays the sequence number which starts at zero. The function number is 702h.
Inputs: none Ouputs: midi file |
StopSequenceJoe O. |
This function stops the play of the midi file. Its function number is 705h.
Inputs: none Ouputs: stops midi file |
LoadXMidi3Joe O. |
This function puts the midi file into a segment so that it can be registered. It uses int 21h to open and close the file..
Inputs: none Ouputs: midi file placed in MidiSeg |
CongratsJoe B. |
Outputs an ending sequence of PCX images for game completion. An ending midi will be played. Fading and scrolling effects will be uses. And finally, the credits will be shown. Inputs: none Ouputs: PCX images and midi sound |
SoundFXJoe B. |
Play a .wav file Inputs: si = .wav file selection Ouputs: a cool sound |
ShowArrayTom |
This procedure is very helpful for testing purposes (checking delays, etc...). Uses Text Mode video to render the RoadArray on the screen 80 columns across and 45 rows deep. The car will be represented by an arbitrary char at the bottom of the array. The car velocity will be shown at the bottom left corner of the screen. Inputs: none Ouputs: Text mode image of RoadArray |
InstallTimer/ TimerInt/ DeInstTimerTom |
Replaces default timer with you own. Used to increment count, scount, and mcount. Count will be increment each time int 8 is triggered. Scount, every 18 times. Mcount, every 60 times Scount is incremented. Inputs: none Ouputs: current time in seconds and minutes |
InstKey/ MyKeyInt/ DeInstKeyJoe B. |
Replace default keyboard interupt service routine Inputs: Button presses Ouputs: GO_LEFT set to 1 when left arrow is pressed, 0 when released GO_RIGHT set to 1 when right arrow is pressed, 0 when released _ExitFlag set to 1 when ESC key is pressed ACC set to 1 when space bar is pressed, 0 when released BREAK set to 1 when ESC key is pressed, 0 when released |
Burn1/ Burn2/ Burn3Tom |
Varying time delays for showing sequential PCX images. Burn1 is fastest. Burn3 is slowest. Inputs: none Ouputs: burns clock cycles |
All images were scanned from the world wide web.
MidPak.com, Midpak.av, Midpak.adv were borrowed