Hobbies And Interests
Home  >> Games & Cards >> Games

Tutorial for Programming 3D Games

Video games in 3-D take a huge variety of forms, including first-person shooter, treasure hunting adventures and flight simulations. All these games have in common visual elements that appear to recede and advance realistically in space, much as real world objects do. You can make a game with such elements by studying how an existing game is made, then modifying the game's source code until the original game is no longer recognizable. Programming a 3-D game lets you create characters and environments no computer monitor has ever displayed before.

Instructions

    • 1

      Play some existing 3-D games, such as Rigs of Rods, StepMania or Big Solitaires 3-D. Be sure to choose games whose source is open, which means freely available.

    • 2

      Download the programming code for the game you'd like to base your 3-D game on. You can find this code as a zip archive on the same site you downloaded the game's executable from.

    • 3

      Read the documentation that comes with the zip archive, and jot down the programming language used to develop the game.

    • 4

      Install a free source compiler for the language you wrote in the previous step. Open Watcom's site has a compiler for C++ programs and Oracle's Java site has a compiler for Java programs.

    • 5

      Open in a word processor each source file in the zip archive you downloaded in step 2, then read each statement in these files. Write your comments in the source file for statements that make sense to you. The source files will have existing comments explaining some statements. Use these comments to learn how to write your comments. Once you understand all statements in all the source code files, you'll understand the program well enough to make substantial changes to it.

    • 6

      Compile the 3-D game's source code after reading your compiler's instructions.

    • 7

      Execute the game one statement at a time, using your compiler's debugging tools. As you execute each statement, write down the names and values of each variable in the source code file. For example, in an adventure game you might see a hypothetical variable called "PlayerPoints." Write down the values of this variable as it increases or decreases during the game's execution. Doing so will reveal how statements that change "PlayerPoints" work.

    • 8

      Write new comments reflecting what you've learned from stepping through the code. Repeat the previous step and this step until you have comments for every statement in the source code.

    • 9

      Change one of the numbers or quoted text variables in a source file, then recompile and play the game, watching for the effect of your change. For example, change the initial value of PlayerPoints to 100 instead of 10, and notice how this increased asset affects a character's behavior.

    • 10

      Write the programming code for increasingly broader modifications to the game. For example, change the texture of a maze from brick to stone. Your study of the code in steps seven and eight will provide the knowledge needed for this step. Compile and test the game after each change.

    • 11

      Repeat step 10 until you can no longer recognize the original 3-D game. Reaching this stage means you've created a new 3-D game.


https://www.htfbw.com © Hobbies And Interests