Student : San Yuen Chang. CRS: CS314 Date: June 19, 2005 Collaborators: none. Description: Invasion of the Giraffe Bots. What: This is 3 D video game that gives a player 10 levels of complexity to play this game. Basically there are 5 extra giraffe-bots to terminate before the player can advance to the next level. The gb's can be small, big, fast, slow, camouflage with terrain colour, or translucent to avoid visual detection. The gb have all been marked with a texture of concentric circles on their backs. When wounded, the giraffe's behavior is indeterminant and may become faster, or invisible or bigger, but all wounded ones will have a body part missing, such as legs, neck & head, or tail. The player has 2 weapons, a laser gun, and a missile launcher. The gun is only practical at close distance as it can only aim at relatively horizontal direction, while a missile is simulating a projectile. There is an automatic tracking mode after a gb has be 'picked', to undo the tracking, press 'o'. While tracking, missiles and laser will be automatically firing at the tracked gb until player releases the tracking by pressing 'o', or by picking another gb successfully. The missiles and the laser both travel with finite speed and the collision detection is done only after the preliminary bounding box has determined a nearby missile to a gb. Then a SELECT mode is entered into to determine if the targed gb is indeed a "hit". If a direct hit, it gets killed and the score reflects the amount of difficulty to kill it, such as a fast, invisible or camouflage ones get higher scores. When the player has completely terminated all gb's at one level, the next level's gb are faster, and more numerous, and another collision detection mechanism is used to avoid gb's colliding with each other. The player also has another Lighting missile, which lights up the terrain and provide a bird's eye view of the terrain below it in the HUD near the bottom of the display. As all giraffes are built with normal vectors, the player can view a smooth shading or flat shading by pressing 'f'. The HUD has many useful information. A tracking telescope to view a magnified gb which is being tracked. A satellite view from a lighting missile, and an overview scope of the terrain which shows the distribution of the gb's, and also a radar range indicator telling the player where the missiles would land if he fires the missiles. This also reflects the current turret position, angle to the left or right, and also the muzzle speed of the missile if one is launched then. There is an automatic adjustment to the aim of the turret to be a little bit advance of the gb being targeted, as it takes some time for the missile to travel to the target. There is the usual indicators : amount of time left to play the game, amount of energy, missiles, search light missiles, and gb's left. Algorithms and data structures used : The terrain's height was generated using the diamond-square method, however, I have adapted it to split a rectangular terrain into 4 smaller rectangular subterrain and recursively apply small variations to the midpoints of these subterrains. Giraffes are grouped into a class in an Object Oriented matter, and a double-linked list of these gb's are maintained in a terrain object which keeps track of which gb is being tracked, which gbs are wounded and dead. Whenever a gb is killed, it is taken off the doubly-linked list. Also, for picking and selection for collision detection, this list of gb is traversed in select mode for the collision detection. The weapon class also maintains a list of explosions that whenever a weapon is launched, it is registerd into this list. As the weapon falls out of range or hits a target, then either the weapon simply is taken off the list, or in addition, an explosion object is registered to replace the weapon. The explosion class also maintains an array of fragments that each explosion generates. The fragments are encapsulated in the Fragment class and maintains the x, y, z location of each particle and speed, so as to "bounce" off the ground when it hits it. How to play : The following keyboard inputs and mouse actions are available to player: Turret control by keyboard: 'q':turn left. 'e': turn right. 'w': raise turret. 's' : lower turret. 'a' : move base left, 'd': move base right. 'z': lower muzzle speed, 'x': medium muzzle speed. 'c': high muzzle speed. Turret control by Mouse : mouse left/right : turret base left/right. 'y' : zoom in. 'Y' : zoom out. 'm' : out of body travel, can still pick and launch weapons. This will cost 1 unit of energy per second in this mode. 'f' : toggle smooth or flat shading. 'o' : untrack a tracked giraffe. 'l'/'L': short cut to increase a level of game or decrease a level of game. 'r' : reset the view and turret to default position, cancels the out of body mode too. 'u' : either get a fresh start, or move to next level after a winning game. '>' : increase number of tiles in the terrain. Up to the orginal starting size. '<' : decrease number of tiles in the terrain. '.' : terminate the game immediately. Sources : I did look at some websites for how to use glPointParameters and glWindows, but found out that these are not supported in our version of OpenGL. I also looked for loading bitmap or jpeg files for texture mapping, but decided that I would do a procedural texture mapping and generated concentric circles as a marking for the turret and the giraffes. I did try to also apply it to terrain but foudn it too slow to play the game and had to remove it. Basically, I relied on the textbook, classnotes, and the redbook, and did not use codes or consult codes outside.