This will be a race among all programming languages. War of the languages!!! The human player will be the Assembly Mobile, and the other AI routines will be named C-Mobile, Fortran Mobile, Basic Mobile, etc. There will be point and time bonuses. Running over (picking up) certain items like a RAM chip, resistors, capacitors, intel symbol, etc. can be used for point bonuses. Time bonuses are possible only through the pick-up of a clock symbol. Obstacles are included in this game also. Such obstacles include undefined variable , mismatch arguments, char-to-int warnings, etc. This will result in points taken away. Objective: be the first to terminate successfully. i.e. Don`t: lose to another (AI) player, or run over an infinite loop symbol or segmentation fault.Project Description
Purpose: Control/maintain game flowInputs:
- Initialize registers to correct segment
- Initialze for correct mode (video, text, etc.)
- Set up and maintain music
- Set up Introduction Screen
- Set up Selection Screen
- Respond to player's keyboard input:
- when making a choice from Selection Screen
- when player makes a decision on the movement of the car(R,L,Up)
- Continuous updates of:
- screen
- player's time and/or score
- player and AI position
- player and AI speed
- If player wins/crashes, set up Win/Lose Screen
Outputs:
- Keyboard controls
- JICE's Run-Time Racers game
AI
Purpose: EnemyAI will be called for every computer challenger in JICE’s racers. The AI, which will have varying degrees of intelligence for each computer challenger, will determine through a number of factors what the next x-y coordinate and speed the computer challenger will have. The top computer challenger will be at 94% of the players maximum speed reached- this will offset the fact that the computer maneuvers more skillfully than a human player. As the intelligence of the AI player goes down, so does its top speed. The AI will be able to bump opponents, by sensing if anyone is near, then changing direction and speed accordingly. It will be able to dodge obstacles in the same fashion. This will be a c-style procedure.Inputs:
- Prev_X_Coord – computer challenger’s previous x-position
- Prev_Y_Coord – computer challenger’s previous y-position
- Prev_Speed – computer challenger’s previous speed
Outputs:
- Next_X_Coord – computer challenger’s next x-position
- Next_Y_Position – computer challenger’s next y-position
- Next_Speed – computer challenger’s next speed
Purpose: UpdateMaxSpeed takes previous PlayerMaxSpeed, checks whether current speed is faster, if so, updates PlayerMaxSpeed. C- style procedure. Called by EnemyAI.Inputs:
Outputs:
- PlayerMaxSpeed
- PlayerMaxSpeed
Purpose: CheckEnemy checks a 20x20 grid in front of the computer challenger to see if any enemy cars are there. If so, tells EnemyAI to maneuver towards them. C-Style procedure called by EnemyAI.Inputs:
Outputs:
- Prev_X_Coord – computer challenger’s previous x-position
- Prev_Y_Coord – computer challenger’s previous y-position
- Prev_Speed – computer challenger’s previous speed
- Next_X_Coord – computer challenger’s next x-position
- Next_Y_Position – computer challenger’s next y-position
- Next_Speed – computer challenger’s next speed
Purpose: CheckCourse checks a 30x30 grid in front of the computer challegner to see if any obstacles, powerups, etc. are there. If so, tells EnemyAI to maneuver away/towards them, depending on what it is. C-Style procedure called by EnemyAI.Inputs:
Outputs:
- Prev_X_Coord – computer challenger’s previous x-position
- Prev_Y_Coord – computer challenger’s previous y-position
- Prev_Speed – computer challenger’s previous speed
- Next_X_Coord – computer challenger’s next x-position
- Next_Y_Position – computer challenger’s next y-position
- Next_Speed – computer challenger’s next speed
Purpose: Introduction of Game to UserInputs: Enter_Key
Outputs:
Notes: LoadPCX is used
- Implements Introduction Screen to User
- Brings Player to Options Screen
Purpose:Inputs:
- User can select driver
- User can view instructions
- User can exit game
Outputs:
- Right: Right_Arrow
- Left: Left_Arrow
- Enter_Key: Enter Key
- Exit_Key: Exit Key
- If OptionState =1
- Calls SelectLanguage procedure and Driver Screen
- OptionState=2
- Calls Instructions procedure and Instruction Screen
- OptionState=3
- Exits Game and calls Credits Screen
Outputs:
Purpose:
- Lets user view instructions for game.
Inputs: None
Outputs:
- Instruction Screen
- Plays Music
Purpose:
- Displays Win Screen
Inputs: NoneOutputs:
- Win Screen
- Plays Music
Purpose:Inputs: None
- Displays Lose Screen
Outputs:
- Lose Screen
- Plays Music
Purpose:
- Displays Credit Screen
Inputs: NoneOutputs:
- Credit Screen
- Plays Music
Purpose: Controls pace of the game similar to what was used in MP3 but with some modifications for our game.
- InstTimer:
- Saves default interrupt vector in OldTimerV
- DeInstTimer:
- Restores OldTimerV as default timer routine
- MyTimerHandler:
- TimerCount is incremented every time called.
- Sends ACK and end-of-interrupt
Inputs:Outputs:
- InstTimer: None
- DeInstTimer: OldTimerV
- MyTimerHandler: TimerCount
- InstTimer: OldTimerV
- DeInstTimer: None
- MyTimerHandler: TimerCount
Purpose: Sets game controls when key is pressed. Similar to what was used in MP3 but with large variation because of the number of variables that is controlled.Inputs:
- InstKey:
- Saves default vector for OldKeyV
- DeInstKey:
- Restores default interrupt vector for OldKeyV
- MyKeyHandler:
- Sets Exit_Game to one if the Esc key is pressed.
- Sets PlayDir to either left or right depending if left or right is pressed.
- Sets PlayerSpeed to slow or speed up depending if Brake or Accelerator is pressed.
- Sends ACK and end-of interrupt.
Outputs:
- InstKey: None
- DeInstKey: OldKeyV
- MyKeyHandler: None
- InstKey: OldKeyV
- DeInstKey: None
- MyKeyHandler: Exit_Game, PlayDir, PlayerSpeed
Graphics and Sound
Purpose: This function takes a 320x200 PCX file and decompresses it into a buffer for later use.
Inputs:Outputs:
- AX: offset of the buffer to write into
- DX: offset of the filename string
- ImageFile: 320x200 decompressed PCX file
Purpose: This function takes a segment containing a 320x200 image, and puts it into the ScreenBuffer
Inputs:Outputs:
- ImageFile
- ScreenBuffer
Purpose: This function initializes ScreenBuffer and ZBuffer to default values
Inputs:Outputs:
- None
- ScreenBuffer
- ZBuffer
Purpose: This function takes a sound file, loads it, initializes the sound card, plays the sound, then cleans up.
Inputs:Outputs:
- DX: offset of filename string
Notes: Will call helper functions that have not yet been defined.
- A .wav sound
Purpose: This function takes the values in ScreenBuffer and ZBuffer to create a completed image on the user's screen
Inputs:Outputs:
- ScreenBuffer
- ZBuffer
- Image on CRT
Purpose: This function (C-style) places a point into the ScreenBuffer and ZBuffer at the given coordinates with the given color and type.
Inputs:Outputs:
- X: X position of pixel
- Y: Y position of pixel
- Z: Image value (see Variables)
- Color: The color of the pixel
- ScreenBuffer
Purpose: This function (C-style) draws the background image based on a 320xN-sized image. It will repeatedly place the image, so that the background looks continuous. It will begin placing the image at any specified line, to allow the background to "shift" up or down, giving the appearance of motion.
Inputs:Outputs:
- StartLine: The line within the image to start at. Must be <= TileSize
- TileSize: the value N, as seen in the Purpose, specifying the vertical height of the image to be repeated as the background.
- BackGrnd: an offset to the upper-left corner of the background tile, within ImageFile
- ScreenBuffer
Purpose: This function (C-style) places a square image at X,Y within ScreenBuffer and ZBuffer.
Inputs:Outputs:
- X: The X position ( 0 <= X < 320)
- Y: The Y-position (0 <= Y < 200)
- ImageOffset: The offset of the upper-left corner of the image within ImageFile
- ImageSize: The dimensions of the square image
- ImageValue: The value to be used in ZBuffer
- ScreenBuffer
- ZBuffer
Purpose: This function draws the status bar (the area of the screen containing the score, speed, etc. of the player).
Inputs:Output:
- Speed: The speed of the player
- Time: The elapsed time
- ...
- ScreenBuffer
Purpose: This function (C-Style) draws text starting at X,Y
Inputs:Outputs:
- FontSeg: The segement containing the font file
- X: The X position to start from
- Y: The Y position to start from
- Register SI: offset to the '$'-terminated string
- Color: The color to draw the text in
- ScreenBuffer