//---------------------------------------------------------------------- // Filename: README // // Created by: Marc Fallows // // Created for: CpSc 314 // Tamara Munzner // Project 4: Your Own Game // MiniFun - Golf // //---------------------------------------------------------------------- To make file ------------ Type: make To run program -------------- Type: ./p3 About this game --------------- This is a 3D mini-golf game. The goal is to get that little white ball into the cup with as few hits as possible. The course contains 18 holes, which are made up with terrain of different kinds (fairway, rough, sand, tar!, ice!) that react differently with the ball as well as walls to make things a little bit more interesting. Base Game --------- Each hole consists of many 3d elements that can be viewed in many different ways (see Advanced Functionality) The user controls the game via keyboard inputs (picking uses the mouse), that can effect the power that the ball is hit. Until the ball is hit next the physics and collision takes care of the path of the ball Normals are drawn for all of the shapes so that the global light lights them correctly. The putter is drawn fading in and out using alpha values in order to give you the ability to see through it Picking tests to see how far, and what type, a picked point is ( See advanced functionality ) Texturing is done a few ways in the game. The terrain is textured to give it dimension. Walls are textured to look like wood. The picked flag is textured with a logo, and the hole transition area is textured with the game logo On-screen control panel consists of a power meter indicating the current state of the putter. It also displays information about the current terrain, current score and the current distance to the hole. Hole information is shown at the top left hand side and picking information is placed wherever the user clicked Advanced functionality ---------------------- This game implements advanced picking. Not only does the pick let you know what type of terrain is in that area, but also how far away that point on the terrain is from the current ball position (and landmarked with a small flag) There is also advanced navigation. Including action and tour modes of the holes as well as "bullet-time" view of a paused point in time. There is particle systems implemented in the form of pieces of the terrain flying off of the ball and then obeying the laws of gravity. There is collision detection implemented in the form of the ball bouncing off the walls and the ground as well as the ball landing in the cup. Simulated dynamics closely ties in with collision detection as the ball bounces off of the ground and reacts to gravity. As the ball rolls on the ground it reacts to friction and the slope of the terrain. The ball also loops around the outside of the cup and pops out if it is moving too quickly. How it was made --------------- Each of the major objects were implemented as classes (ball, wall, terrain, putter, etc). The Hole contains all of the walls and terrain in the form of a list. Since each time the walls and terrain is checked it goes through incrementally, a list is ideal. For the particle system an array of particles of max size is created. If the slot is not being used the particle inside is simply inactive. The collisions are checked by seeing if the ball is withing range of the walls plane and checks to see if the ray of the direction it is going (from the last point, to this point) intersects the wall plane. If it does the balls direction is reflected about that plane and moved a distance from the current point to the point of intersection. The collisions with the ground are done in much the same way. If the ball is not above any plane, it is out of bounds. The ball direction is pushed in the direction of the slope of the plane. If the ball has gravitational velocity then it is bounced back up in the air. Finally if the ray of the direction crosses the cup then the ball has to react appropriately to that. Once all the checks are made the game can move on to the next time increment. How to play: ------------ Controls: '1' - quits the program at any time During transition (scorecard being displayed): - Press Any key to continue During Tour - Press Any key to stop During Gameplay - Spacebar to start putter swing and again to stop swing (will apply max power if swing is not stopped once max power is reached - 't' to see a tour of the hole again - Up arrow moves the camera up - Down arrow moves the camera down - Left arrow moves the direction around counterclockwise - Right arrow moves the direction around clockwise - 'z' moves the camera in the direction the putter is facing - 'x' moves the camera away - 'r' resets the position of the camera - 'm' displays the scorecard with the current information - 'g' give up a hole (You will receive a score of 12) Once all 18 holes are complete the final scorecard will be displayed and your only option is to quit (press '1') Sources: -------- Textures: Thanks to NeHe for texturing code http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=06 Math/Geometry: Ray through circle: http://www.gamedev.net/community/forums/topic.asp?topic_id=304578 Intesection of Ray through plane http://students.cs.byu.edu/~ashton/tracer/plane.html Point inside triangle: http://www.cs.unc.edu/~yanghua/Assignment2.htm Physics: Physics Kinematics help: http://www.glenbrook.k12.il.us/gbssci/phys/Class/1DKin/U1L6a.html More Physics help: http://www.puttingzone.com/Science/cjp-putting.pdf Sources of inspiration: MarioGolf (Nintendo) Hot Shots Golf (Playstation)