This repository has been archived by the owner. It is now read-only.
Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
A 3d Tower Defense game I made for CS5229 Computer Graphics at CU Boulder
Fetching latest commit…
Cannot retrieve the latest commit at this time.
333333 DDD ffff 3 D D f 3 D D ee ffff ee n nnn sss ee 333 D D e e f e e nn n s e e 3 D D eeeeee f eeeeee n n sss eeeeee 3 D D e f e n n s e 3333 DDD eee f eee n n ssss eee Project - 3Defense David Parker GETTING RIGHT TO IT: Spacebar => Begin the game. Once a wave of enemies is completely killed, then press spacebar to send the next wave. 1-6, shift+(1-8) => Select a tower. Then place the tower on the map by find a location and left-clicking. Escape => Exit the program ----------------------- THINGS: REALLY COOL: 1) Not so sure about this... I finally fixed the framerate issues with Ubuntu. It had to deal with how glutIdle was working and how often it was getting called. By getting rid of it altogether and using glutTimerFunc after the game begun and it seemed to clear things all up. COOL: 1) I like the fact that my code is organized. I think well organized and refactored code is key. 2) (collision.c): My collision detection and checking the tower range functions were okay. For collision detection I'm only checking the x/z origins vs. the scale of the object, and not really doing real normal vs object detection. 3) (drawing.c > drawObjects): I like the way I set up my structs to draw specific types of objects. I liked using the blend func to set up a decent looking "preview" tower that will be placed. I also made sure to render differently based on whether the user was clicking on the board so that they could select objects using color coding, giving each object a unique color code. 4) (general.c > findPreviewPostion): I made sure to set up a grid of viable positions around the map. I wanted the user to be able to place a tower in a specific location and to make sure that they couldn't place it otherwise. I also liked using gluUnProject and glReadPixels to figure out the mouse position in findMousePosition. 5) (general.c > processPicks): this method used the color coding before and actually processed which tower we selected. 6) (shapes.c, models.c, towers.c): again, I just like the way I organized things. ----------------------- Really, I have a lot of things I think were cool, but in reality, I don't think anything here is extraordinary. I do think it could be cleaned up a lot more. I also have a good sized TODO list, and known bugs: TODO: 1) Dynamic paths would be cool. I'd have to change how the pathing is set up completely (as well as the preview points), but that would be neat to be able to have random maps. 2) Don't allow users to buy every tower. All of the "advanced" towers should be upgrade only. 3) Adding shadow maps would be really cool. 4) Clean up the sidebar to add textures/icons for the towers, money, lives, scrolls, etc. 5) Add pop-ups (hover-overs) to show statistics for each tower, rather than text in lower right. 6) Object selection for minions with specific stats 7) Variety of minions. textures, colors, objs, etc 8) GAME OVER. There is no way to lose the game right now. 9) Short game. There is only 5 waves of enemies. KNOWN BUGS: 1) Fix bug where user clicks on sidebar instead of using keyboard, they won't get the preview 2) If a minion is killed and is the last one in the wave, then extra shots will stick around until the next wave. 3) I'm using straight arrays and no-where am I re-sorting those arrays if we "sell" a tower, etc. so it's possible to lose towers after the array loops back to the beginning. 4) If the game is paused, the timers don't pause, so it is possible to pause the game and have several shots created when they shouldn't be. ----------------------- The following interactions are provided: Keyboard interactions: Special Keys: Right => Shift screen down the z axis Left => Shift screen up the z axis Up => Shift screen down the x axis Down => Shift screen up the x axis Shift+Right => +5 th angle Shift+Left => -5 th angle Shift+Up => +5 ph angle Shift+Down => -5 ph angle Regular Keys: Escape => close the program Spacebar => begin the game. Once a wave of enemies is completely killed, press spacebar to send the next wave. r or R => reset to original parameters q => money cheat (money += 100) x or X => toggle axes on/off (default off) g or G => toggle grid on/off (default off) c or C => toggle show attack radius (default off) v or V => toggle draw values on bottom of screen (default off) - => decrease the field of view by 1 + => increase the field of view by 1 i => decrease the dimensions by 0.2 I => increase the dimensions by 0.2 // ANIMATION: z => increment the animation by 1 (used when game paused for debugging) m => toggle light movement (default on) p => toggle game paused M => toggle tower tops moving (default on) // LIGHTING: < => decrease the light th by 1 > => increase the light th by 1 [ => decrease the light Y by 0.1 ] => increase the light Y by 0.1 a => decrease the ambient by 5 A => increase the ambient by 5 d => decrease the diffuse by 5 D => increase the diffuse by 5 s => decrease the specular by 5 S => increase the specular by 5 e => decrease the emission by 5 E => increase the emission by 5 n => decrease the shininess by 5 N => increase the shininess by 5 // OBJECT SELECTION 0 => none 1 => basic 2 => advanced 3 => cone 4 => advanced cone 5 => square 6 => advanced square shift+1 (!) => fire shift+2 (@) => advanced fire shift+3 (#) => ice shift+4 ($) => advanced ice shift+5 (%) => earth shift+6 (^) => advanced earth shift+7 (&) => poison shift+8 (*) => advanced poison w or W => toggle preview mode delete or backspace => if a tower is selected on screen, then delete it Mouse interactions: "Screen" side (left side): -if a tower is selected: --left-click: find the x,y,z position of the mouse and place the object in that position the object will be reset to 'none' after placing the object NOTE: only 57 objects may be placed. If you place more than 57, then it starts to replace item 1, 2, etc --shift+left-click: same as left click, but object will not be reset to 'none' after click -if tower selected is 'none', then select a tower on the left side: --left-click a tower ---able to view the statistics of the tower in lower right corner ---press 'delete' or 'backspace' and the tower should be deleted "Sidebar" side (right side): -left-click: --click on a tower name to select it. ---able to view the statistics of the selected tower in the lower right corner ---able to place the tower on the screen side if you have enough money NOTE: there are two ways to select a shape: 1) keyboard shortcuts 2) mouse click on shape name