| ECE291 | Computer Engineering II | Lockwood, Spring 1999 |

Team Member
Karan Mehra
Overview
As the title says, this game will simulate a shooting experience simillar to the famous pong game. It is designed in a first person perspective with enemy sprites popping up and moving around the screen. A light gun was planned to be interfaced as the input controller but as for now we will have to do with mouse. The game has three modes, as follows:
The Versus Mode which is the Networking Mode. In this mode, the user is able to play with other people over the network. Here, the idea is to shoot the sprites before your opponent does so. The game is won by the person who gets the most number of hits.
The Arcade Mode
A Practice Mode were the sprites will generate at random spots on the screen and disappear after a certain time delay.
Rich multimedia with funny sound clips are intended for the various levels. Futher, the game derives the library files and routines for sound [wav and midi] and the netbios protocol [networking in the versus mode]. It works on a 320x200x256 resolution.
On the whole, this project was directed towards not only being fun but also a learning experience.
Problem Description
All said and done, about the simplicity of the working of the light gun, interfacing the Nintendo gun with the computer was the first challenge. Unfortunately it did not materialize.
The next challenge will be the randomizing of the movements for the sprite(s). After all, we don't want the sprite movement to be predictable. This will constitute the AI for this game.
Finally, this game will have a fun versus mode. The idea is to group people into two's so that there may be multiple games going on at the same time. Implementing Real Time data transfer and synchronizing the timings for this mode was another challenge for this game.
Implementation
I had often wondered how the Nintendo Light Gun [the zapper] worked. You will be surprised to know how simple the implementation is. The Light Gun is not an emitter, but instead a receiver. It has a photo diode at the nozzle, which can detect white light. A little circuitry inside the gun, filters the frequency to that of a TV screen [or else, pointing to a light bulb would be a sneaky way to win the games]. That's it, as simple as that. The tricky part comes in the software implementation as the gun does not give you any coordinates as to where it is pointing. To get this information, we wait for the trigger to be pressed. When this is done, we flash all our enemy sprites, one at a time, with a white box, and mask the remaining screen. As a result, when the Gun detects white, that means, we shot an enemy, otherwise, we missed.
The random generator function takes the random seed from the CPU clock initially. Random numbers are generated using large prime numbers. This is done as: New RandNum = (Old RandNum * PrimNum1 + PrimeNum2)
The networking protocol is as follows: Initially every machine sends out a SEARCH packet, [ searching for a game ]. When a machine receives a SEARCH packet, an RSVP [ will you play with me ] packet is issued directed to the person, whose SEARCH packet was received, and a Waiting Flag is set high. On receiving an RSVP packet we send either a REJECT packet [ if a game is underway ] or an ACCEPT packet [ if we are not WAITING for someone else and game is not in progress ]. On ACCEPT, gameplay begins, on REJECT, Waiting Flag is reset and the SEARCH continues. Thus, this way, we can break into groups of two and play the game.
Project Documentation
| variables & structures | networking packets | project methods |
Last Modified: 20 April 1999
Copyright © Karan Mehra