Quake II Evolved Per Pixel Lighting Tutorial

Adding Map Models To Your Level

For this tutorial you will need the following:

>> A full copy of Quake 2, complete with the latest official patch

>> Quake II Evolved version 0.65 Beta

>> A popular level editor compatible with Quake 2 (GTK Radiant 1.3 etc)

>> A popular level editor compatible with Quake 3(THREE), I suggest GtkRadiant 1.4)

>> A popular model editor with MD3 export function

>> Quake II Evolved "Dec" maker (Supplied below)

Ok then, lets begin with a little information shall we?

What Is A Map Model?

A Map Model, or Static Mesh as they are also known, is an advanced piece of geometry that can be added to any map to give it increased detail. Standard Quake 2 maps contain surfaces called "brushes". These are what makes up a level, be it a door, or a wall, or a sewer bar. In Quake 2 these had to be brushes, you had no choice. All is well and good until you see just how poor quality these are. Adding multiple sides over 4 starts to give serious precision errors to your brush and it starts to look out of place and sometimes can break your level/compile. A map model isn't like this. For a start, it IS just that; A model file. This means you can add whatever you want to your level, no matter how simple or complex the mesh may be. This means you can add perfectly textured curves, pipes and bends, or even huge decor and shapes. The only limit really is imagination with these.

Adding A Map Model To Your Level

Right then, I suppose you want to add something now yeah? Well can I just run through a few basic things first?

Map Models can be as complex or as simple as you like, that IS your call. But remember that you MUST clip them ingame in order for them to work well. You cant have a round hallway that the player just runs straight through can you? Dont worry, its not like you have to make the whole thing again in brush form. But you MUST make a simple version of the mesh in order for this to work well.

Ok then, lets do some work shall we?

First, take your map, and think about exactly where you want your model. For this example, I'll keep it simple. I will add a "pipe" model, to a wall. Easy stuff.

Right then, this is where you have to do a bit of swapping about, so stick with me.

First of all we are going to need a model. So make your mesh in whatever editor you like, and make sure it points to the correct texture locations for later. Export this to an MD3 file format. We now have our base model. Copy this model, and place it under "x:\Quake3Arena\baseq3\models\mapobjects". NOTE: The 0,0,0 origin of your model MUST be visible inside the level. For example, do NOT make a model thats bang on center in the model editor, make sure the center is off from the model and that the 0,0,0, origin will be INSIDE the level later on. Otherwise your model will not render correctly.

Next, create a small room in GTK 1.3 (The Classic version) and save it.

Next, open up GTK Rad 1.4 (The Quake 3 version), and load the previous small room map we just made in 1.3. Dont worry if the textures dont load, thats normal. Right click on the main window and select "Misc" and then "Misc_Model". A new window will pop up. Find the MD3 model from before that should be saved in "models/mapobjects" and add it. A small wireframe preview of the model will appear on the grid. Move this about and check its scale. If its to large/small, dont worry, just save your work, close GTK, re-size the model, and reload the map. Keep checking until its perfect. Right. This part is only needed for one thing; The models origin. So, place your model once the scale is correct in its needed location, and then (with the model still selected) press "N". Locate the "origin" field and copy the value to a safe place for now. Close the Entity window, and delete the map model, its not needed anymore. Save your work, and close GTK 1.4.

Now that you have them models origin, we can create a .dec file. Create a new folder in C:\ called "q", and inside there place this exe file q2e_dec.exe inside there. Also, create a new text document inside there with the exact same map name as the map we are adding the model too (So, if I was adding this to the first level of Quake 2, I would call this file "base1.txt".) Open the new text file, and add the following:

//Model Description
{
origin X Y Z
angles X Y Z
model *.*/*.*
}

This is pretty straight forward, save this file as we will come back to it in a second.

Now, copy your model folder into the newly created "q" folder. Dont worry about models/blah or anything, just make sure that model/tris.md3 is under "q", even if thats not its correctly directory structure. The structure is located inside the md3 anyway, so thats safe.

Right. Open that text file up we just made. Change Model Description to something that will tell you what model we are using, like "Pipes" or "Boxes". Its not needed, but it makes it easier to find your models if you need to change them later. In the origin field, copy the origin we found before in GTK Rad 1.4 into this location. In the angles field, leave it set to 0 0 0 unless you need to rotate your model at all. And lastly, in the model field, type the new directory of your model, the one we just copied into c:\q\. So here it may be "c:\q\test_boxes\tris.md3". Save the file, and close it. We are almost done with adding a model.

Now its time for a bit of DOS based action. Open up Command Prompt, and type in:

c:\q\q2e_dec.exe

Press Enter. You will see a few options pop up on what you can do with the file. So, we want to add "in" a txt file and get "out" a dec file. So, type the following, and press Enter:

c:\q\q2e_dec.exe -in c:\q\mapname.txt -out c:\q\mapname.dec

At this point in time you may be asking yourself "why put stuff in q?" well, if its not obvious, its because this means you get to type as little as possible, making this a quicker process. ;)

So ok, you typed the above, obviously replacing "mapname" with your map name, and pressed Enter. If you didn't get any errors, then you should now have a file called mapname.dec inside your c:\q\ folder.

Ok, take this new .dec file, and place it under baseq2/maps.

Now take your old model files, and place them in the correct directory structure under baseq2/ (For example, "Quake2/baseq2/models/test/test_box/tris.md3"). Delete the MD3 file. Its no longer needed. All thats needed are the textures in the correct locations.

And... Were pretty much done. Load up your map in Quake II Evolved. If all goes well, you should have a working map model in the map. If not, then check the console for any errors and try and see where you went wrong, or ask somebody at the forums.

One last thing to mention. Clipping. By default, map models will not be clipped to the player and his/her weapon. You will need to do this yourself, so make a basic shape of your model in the location of the model, and apply the clip shader to it there.

Things To Remember

The 0,0,0 origin of the model MUST be inside the level at all times. It cannot be outside in the void, or somewhere in a brush, so if you get any visual errors or problems, check that this is correct.

Map models NEED clipping. It looks stupid if you dont do it, and doesn't take long to add, so make the basic shape in brush work and apply clip to it all.

 

Here is a .pk2 file with an example map with a working map model inside so you can check out how its done for yourself.

That about wraps up our tutorial on adding map models to your level. If you have any questions please post them in our forums.

 

 

The Blur Logo and website ©2002-2004 Team Blur - All rights reserved. Reproduction of any material on this site without a working link to its original location is prohibited.