Project 4 writeup James McRoberts Oliver Dunne Alex Merritt What: We've built a complex interactive game incorporating many core concepts of the cs314 course material. The player's task is to navigate through a virtual underwater world to reach a goal (the "spawning ground") while avoiding enemies (the robotic fish). Upon reaching the goal, the game is finished. The player controls an underwater car, which they can move around the ocean floor. The car is able to fire missiles at the robotic fish. The car only has a limited missile store. The player is able to target the enemy fish by clicking on the in their view screen. The fish guard the spawning ground, may also roam freely across the seafloor searching for the player's vehicle. The seafloor has a variety of colourful flora which wave gently as though animated by a current. How: For the particle system, we created a struct to contain such elements as position, velocity, life, acceleration, rate of fading, etc., and then created an array of these particles and initialized the particles with random values, within some predefined bounds(except for rate of slowdown and acceleration, which are fixed). Then a drawparticles function updates each of the elements based on the others and time, eg: position is updated based upon speed, speed is updated based upon acceleration, life is updated based upon fading rate, etc. -For the fish articulated motions, we set up a class called Joint for orientation of each object, which each BodyPart object has. And to get objects with sub-parts, there's implementation for that. There's a Motion class tree for each motion which updates BodyPart objects to the position so several motions can be instantiated and can work on multiple BodyPart objects. The navigation is two fold, the main view is behind the car, which rotates with the car. The alternate view is a virtual trackball about the car. For procedural modelling we implemented a pseudo-fractal plant. It uses a function which recursively calls itself, and each level draws branches. The angles at which it branches are varied sinusoidallly so as to create the illusion of an ocean current. For simulated dynamics we analysed the collision between when a missile strikes a fish. CollisionMotion.cpp determines the velocity and direction of the fish at contact, assuming a peak force and duration of an explosion from the missile impact. After impact the drag on the fish is calculated and this is used to determine its trajectory as it falls to the seafloor. For level-of-detail control, we calculate the distance from the car to every other object in the game. If the object is within a certain distance, the full object is drawn. If is outside this radius, a drawDegenerate() method in the object is used. This draws very rough outline of the regular object (a block or a sphere) in its place. How to: The player uses the number pad to move forward and turn left or right. The user has a finite number of missiles. These can be launched at the enemy fish using either the spacebar (unguided) or by using the mouse to click on the target (guided). The Player wins by reaching the spawning ground. A progress bar indicates the player's distance to the spawning ground. Sources/Inspiration: NeHe tutorial for particle systems and texture loader Nate Robbins tutorial for object loader