Reading and writing source code comments helps you understand the code.
3-D games are those having at least one element that appears to have height, width and depth. Programmers create these games by marrying game logic with code libraries that carry out commands given in OpenGL or another high-level 3-D graphics language. When making your first 3-D game, it’s wise to study existing games, as learning the multiple skills to create a game from scratch can be overwhelming. Making a 3-D game teaches you programming that produces screen graphics. You can apply this skill to developing other graphical programs, such as those for 3-D modeling.
1. Play several 3-D games whose source is freely available. (These are called “open source” games.) Examples of such games include Big Solitaires, StepMania and Glest.
2. Write, for the game you like best, a list of at least ten items that describe in detail which game features you’ll change to make the game original. For example, your list may contain “The chess game would be better with soldiers instead of pawns.”
3. Click the link, on the site you downloaded the 3-D game from, for the game’s source code file. Double-click the downloaded file to extract its source files onto your PC.
4. Double-click the “readme.txt” file that came with the source code. (If you don’t see this file, look for another whose name ends in “.txt,” “.htm” or “.doc.”) This file explains build the executable game from its source code and will mention the game’s programming language.
5. Install a free software development kit (SDK) for step 4’s language. Get the Java SDK from Oracle’s Java site, and the Visual C# SDK from Microsoft’s C# Express site.
6. Double-click each source file to open it in a word processor, then print the file by pressing “Control-P.”
7. Delete all source files, then create in your word processor a new set of blank ones that have the same names as the files you deleted. (You can get these names from the compressed source file you downloaded in step 4.)
8. Read each printout from step 7 and type its statements into the new blank file with the same name as the source file from which you made the printout. For example, if a printout came from the file “hangman.c,” type the printout’s statements into the blank “hangman.c” file. Typing the source code fosters a careful reading that helps you understand the 3-D game’s logic and data.
9. Build, using your SDK’s instructions, the game’s executable file from the new source files. Play the game to test it. If gameplay is strange, check your source code with the printouts.
10. Delete one of the source files you typed, then type it again — but without looking at the printout. Repeat this step until you no longer need the printout, then repeat the step again for the remaining source files. You’ll have to study the code carefully and perform many cycles of typing to finish this step. Once you’re done, however, you’ll understand how the original 3-D game works and be able to customize the game.
11. Type, in the appropriate source code file, the new code that implements the first item in the list you made in step 2. (Your understanding of the program will indicate the appropriate source file.)
12. Compile, play and debug the game to test your customization. Read your SDK’s user docs for specific instructions on debugging.
13. Type the new source code for the remaining items on your list. Compile and test the changes as you did in the previous step to complete your 3-D game.