3D Game Programming All in One (Course Technology PTR Game Development Series)
What we'll do is fire up the QuArK Map Editor and quickly create a structure that we can stick in our sample Torque game and poke around with.
Note | More taxing terminology! In QuArK development circles what you create are often called rooms. This harkens back to QuArK's beginnings as an editor for Quake, where everything was a room.There were no outdoor areas as such— no external terrain. When we create the rooms and save them, we save them as map files, because Valve used the word map to describe their version of what id Software (the guys who made Quake) called a room. Clear as mud? And of course, just to be difficult, GarageGames calls these creations interiors (which fetches back to the term rooms in a way) in Torque. I use the word structure, which I think is both pithy and generic at the same time. My use of structure can encompass room, map, and interior as they are used in their respective contexts while still also applying to things like bridges and guard towers. So room = map = interior = structure. In any event, the source format for the files we will be dealing with are MAP, a text file format, while the compiled version is called DIF, a binary format. We save our work as .map and compile the work to .dif for use in Torque. |
-
Start the QuArK Map Editor by first selecting what game you are working with in the Games menu. For now click new Torque map, as shown in Figure 17.5.
Figure 17.5: The Torque button in QuArK. You will then get the Map Editor, as shown in Figure 17.6. A default structure (or room, remember?) will appear, all ready for you to hack away at. This is convenient, because you will probably be creating roomlike structures most of the time anyway. This makes a useful starting place.
Figure 17.6: The Torque Map Editor in QuArK. Tip To delete the default room, locate the Tree view on the left side of the Map Editor window, and select the sample_group entry, as shown in Figure 17.7.
Figure 17.7: The Tree view. You can press the Delete key or right-click on the entry to get the pop-up menu. Then choose Edit, Delete.
You should now have a blank slate.
-
Choose from the menu Torque, Export mapfile only. This creates newmap.map.
-
Now, from the menu, choose Torque, Build DIF only, as shown in Figure 17.8.
Figure 17.8: Selecting Build DIF only. You will see a console window appear, and a bunch of stuff will be written into it. This is the output of the map2dif_DEBUG.exe map compiler program that comes with Torque. We are using the debug version because its output provides a lot more information that could help solve problems that we can encounter with more complex maps. The program takes newmap.map and compiles it into DIF form.
Anyway, you should see a line near the bottom of the output that reads something like this:
Writing Resource: persist..(./maps/newmap.dif) Done.
If you see this, your map has successfully compiled.
-
Next, from the same menu, choose Torque, Prepare used textures.
This will create a list of all the textures used in your creation and copy them to the prepared textures directory. After a brief pause, you will get an information alert, like that shown in Figure 17.9.
Figure 17.9: The texture information alert. -
Browse to your map output directory, C:\QuArK 6.3\torque\tmpquark\maps, and locate newmap.dif.
-
Copy newmap.dif to your Emaga6 sample game, into the directory C:\aEmagaCh6\ control\data\structures.
-
Browse to your prepared textures directory, C:\QuArK 6.3\torque\tmpquark\ textures, and locate concrete.jpg and
NULL.jpg. -
Copy concrete.jpg and
NULL.jpg to the directory C:\aEmagaCh6\control\data\ structures. -
Use UltraEdit to open the mission file for Emaga6, C:\aEmagaCh6\control\data\ maps\book_ch6.mis.
-
Locate the first instance of this line:
interiorFile = "~/data/structures/hovelb.dif";
and change it to the following, to reflect your new structure:
interiorFile = "~/data/structures/newmap.dif";
-
Directly above that, find this line (the numbers might be different):
position = "-4.05031 54.9271 207.919";
and replace it with this exactly:
position = "8 50 198";
The preceding steps are a way to manually insert your creation into the mission map file at the location of one of the existing hovel structures. Because of differences in construction between the two structures, you needed to adjust the position of the new structure somewhat.
-
Run your Emaga6 sample game. After spawning in, you should see the new structure directly in front of you, as shown in Figure 17.10. Run on over and go inside. Take a good look around. There's your first structure created with QuArK!
Категории