Building a House


The bridge was nice and certainly useful. But one must admit that it's fairly simple. Of course, if you need a bridge you will probably make something more ornate.

In this section we will go a little bit farther and make something more complex: a house with a door opening and a window and internal lighting.

  1. Launch QuArK and open the Torque Map Editor. Delete the default room and save the empty file as C:\QuArK 6.3\torque\tmpquark\maps\house.map.

  2. Select the Cube brush and create a cube that measures 260 units in width by 360 units in length by 256 units in height. You can see the dimensions by hovering the cursor over the cube and looking in the lower-left corner of the Map Editor window.

  3. Create a smaller brush in front of the first cube, as shown in Figure 17.19. This will be used to create the front stairs.

    click to expand
    Figure 17.19: The Stair brush.

  4. Select the new brush in the lower-left window, and then right-click to get the pop-up menu and choose Stair. You will see your brush change into a staircase, as shown in Figure 17.20.

    click to expand
    Figure 17.20: The stairs.

  5. Select the large brush, right-click to get the pop-up menu, and choose Make Hollow. Your large brush will now be a hollowed room and will look like the one in Figure 17.21.

    click to expand
    Figure 17.21: The hollowed room.

  6. Create another brush and place it in the wall above the stairs, as shown in Figure 17.22. This brush will be used for an operation called a subtraction.

    click to expand
    Figure 17.22: The Subtraction brush.

  7. Ensure that the new brush is selected, right-click it, and choose Brush Subtraction. You will see a bunch of new lines appear in the wall in which the brush is embedded.

  8. Select the Subtraction brush and press the Delete key to make it go away. You will see a hole in the wall now, as depicted in Figure 17.23. This is the doorway.

    click to expand
    Figure 17.23: The doorway.

  9. Using the texture assignment technique you learned in the earlier sections of this chapter, set the house's texture to concrete and the stairs' texture to 256_BrickA.

    Now you have to add a special brush of a type known as an entity. Entities are constructs used when making maps that give special instructions to the map compiler about things it needs to do or understand when it goes about building the DIF version of the map for use in Torque.

    You are going to create an entity called a portal. Portals tell Torque how to go about lighting the interior of the object when there is an opening. By placing the portal in the doorway, you can tell Torque that it should not try to do its special interior lighting outside the door. You can also indicate whether or not Torque will allow external light to pass through the portal to the interior.

  10. Locate the Entities panel in the upper-left portion of the Map Editor, and in it find the Torque Entities button. Click it.

  11. Choose Brush-based entities, portal, as shown in Figure 17.24.

    click to expand
    Figure 17.24: The portal entity.

  12. An entry for the entity will appear in the Tree view in the lower-left portion of the Map Editor, as shown in Figure 17.25.


    Figure 17.25: The portal entity in the Tree view.

  13. Select the portal entity and then click the Cube button to create a Portal brush, as shown in Figure 17.26. A new brush will appear in the model—this is the Portal brush.


    Figure 17.26: The portal entity's brush in the Tree view.

  14. Reshape the Portal brush to be just a little larger than the doorway in width and height, and a little narrower than the doorway in thickness, as you can see in Figure 17.27.

    click to expand
    Figure 17.27: The portal in place.

  15. In the Tree view, double-click the portal icon (not the poly icon that it contains). A small dialog box will appear; the bottom field is the parameter ambient_light setting for the portal. Choose passes through from the combo box.

  16. Using the texture assignment technique you learned in the earlier sections of this chapter, set the portal's texture to NULL.

    Next we are going to create another entity—a light entity. The process is similar to the portal entity at first, but a light entity is a point entity, not a brush entity, so things will be just a little different.

  17. As before, go to the Entities panel and find the Torque Entities button. Click it and choose light_*entities, light_omni, as shown in Figure 17.28.

    click to expand
    Figure 17.28: The light entity.

  18. A new light entity will be created in the Tree view, and a small rendition of a light bulb will appear in your map. Move it up closer to the ceiling, as you can see in Figure 17.29.

    click to expand
    Figure 17.29: The repositioned light entity.

  19. Double-click the light_omni entity in the Tree view to get to its settings. Ensure that alarm_type is set to normal only.

  20. Save your work and export it using the methods you learned earlier in the Quick Start section.

  21. Use UltraEdit to open the mission file for Emaga6, C:\aEmagaCh6\control\data\maps\ book_ch6.mis.

  22. Locate this line:

      interiorFile = "~/data/structures/newmap.dif"; 

    If the line doesn't exist in the file, then locate this one:

      interiorFile = "~/data/structures/hovelb.dif"; 

    Change whichever line you find to reflect your new structure as follows:

      interiorFile = "~/data/structures/house.dif"; 
  23. Run Emaga6 and check out your new house, which should be in front of you. Go on inside and see the effect the lighting has.




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