A Rock


Oh, big deal, a rock—what's up with that, you ask? Well, it is going to be your own handmade rock! That should be worth something.

The point here is that, even though the rock is not much more complex than the Health Kit, it is somewhat more complex nonetheless. It does less for us in the game, but it is one of those decoration-type items I mentioned— and stuff like this, while unglamorous, can greatly contribute to the ambience of your game.

click to expand
Figure 16.5: The rock in game.

  1. Fire up MilkShape and create an empty document.

  2. Use the Sphere tool to create a sphere, as shown in Figure 16.6.

    click to expand
    Figure 16.6: The sphere.

  3. In the Side view, select the bottom three rows of vertices.

  4. Choose Vertex, Flatten, Y. The bottom three rows should be squished together in a horizontal flat plane, as shown in Figure 16.7. Already it's starting to look like a rock.

    click to expand
    Figure 16.7: The truncated sphere.

  5. Still in the Side view, drag the vertices around on the left side until you get something resembling Figure 16.8.

    click to expand
    Figure 16.8: The stretched rock-sphere.

  6. Now in the Top view, drag some more vertices around until you get something resembling Figure 16.9. It's almost a rock now!

    click to expand
    Figure 16.9: The almost rock.

  7. On the Materials tab, create a new material, using C:\3DGPAi1\RESOURCES\ CH16\rock.png as the bitmap.

  8. Name the material "rock".

  9. Select the entire rock model and assign the rock material to it.

  10. Make sure that the 3D view has been set to texture mode. You should see a nice lumpy and ancient-looking rock there, like that in Figure 16.10.

    click to expand
    Figure 16.10: The rock model.

  11. Save your work.

  12. After saving your work, choose File, Export, Torque Game Engine DTS.

  13. You want to take all the defaults (Collision Mesh should be set to Bounding Box).

  14. Export the box to C:\3DGPAi1\fps\data\ shapes\organic\rock1.dts. Click Yes if you get an alert asking if you want to replace an existing file with that name.

Testing the Rock

The rock has a bounding box set for collision because it is, after all, a rock—you can't go through it.

  1. Browse to C:\3DGPAi1 and click the Run fps Demo shortcut.

  2. Click Start Mission.

  3. In the Launch dialog box, make sure that the Multiplayer Mission box is cleared.

  4. Select Water World from the mission list.

  5. Click Launch.

  6. After the game loads, look around for your rock jutting out from a saddle between two hills into the water. Figure 16.11 shows what the rock (marked by the arrow) looks like.

    click to expand
    Figure 16.11: Locating the rock.

  7. Run over to the rock. On top of it you will find the Health Kit.

  8. Run over the kit to automatically pick it up. You will see a message in your chat window telling you that you've picked it up.




3D Game Programming All in One
3D Game Programming All in One (Course Technology PTR Game Development Series)
ISBN: 159200136X
EAN: 2147483647
Year: 2006
Pages: 197

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net