Originally Published: Sunday, 9 April 2000 Author: Jim Kutter
Published to: enhance_articles_multimedia/Images Articles Page: 1/1 - [Printable]

Developing Quake3 Skins with Linux-Only tools

In my last article, I mentioned that Linux had the potential to become a viable content creation OS. In this article, I take Quake 3 as a case study for developing content using the tools available under Linux.

   Page 1 of 1  

In my last article, I mentioned that Linux had the potential to become a viable content creation OS. In this article, I take Quake 3 as a case study for developing content using the tools available under Linux.

The most important thing to realize is that this article is not meant to be a tutorial on making great game content. That is not my specialty. The point of this article is to illustrate the advantages and disadvantages one may encounter while creating content for a game under Linux.

First, let's start by getting something to work with, and acquiring a feel for what we need to do. Quake 3's .pk3 files are nothing more than zip archives, so to read the contents we simply need a utility like zip. Once we have the game data unarchived, we can look for where to begin. Quake 3 stores the model data in the relative path of models/*. For my skin I wish to edit the Orbb player model, so I look in the models/players/orbb directory. Once there, one can find four main sets of files that define the orbb model. One set is the .md3 files. These files describe the geometry and the animation keyframes for the model. Currently under Linux, there are no means by which we can edit this data. However, that is the only information we cannot modify. Next there is an animation.cfg file, which is simply a text file describing what keyframes affect what tags within the model. (A quick note on tags. As far as I can tell, tags describe a set of triangles in the model, this probably includes surface attributes as well.) Since the layout of this file is unknown to me, and since we cannot modify the model's keyframe data directly we can safely ignore this file. The next two types of files are the most interesting.

First let's look at the .skin files, there should be three per skin. The suffix of the filename before the extension is the skin name. For example my skin is called "coyote," so my .skin files would be called upper_coyote.skin, lower_coyote.skin and head_coyote.skin. As you might guess, the files determine what part of the model the skin covers. These files are again, simply text files that describes what image should be used for the appropriate tag in the model file. Since we cannot modify the model tag information directly under Linux, all we can do is change which image file is being used for a given tag. Which brings us to the final type of file we are interested in, the images.

The images can be two types, .tga and .jpg. This is fortunate, becase we will need to use both to get something decent drawn. Quake 3 stored all the player model images in .tga format. Unfortunately, there seems to be a problem in the gimp version I was using. It exported layered images to .tga format flipped and backward (both width and height were negative) when read by Quake3. So, we must export to the other type, .jpg. For the images which require transparency (such as the skin icon), a hack is needed. I exported the images to .tif format (which supports layers and transparency, and gimp exports properly), then used ImageMagick to convert the .tifs to .tgas. Definately a hack, but it works. For the same reasons we can only change the skin appearance (model tags strike again) we want to modify the image only in the places where there was image data to begin with (otherwise Quake3 might place the wrong colors in the wrong spots). Once we have modified the images we are interested in relating to the skin, we need to modify the icon. This is the widget that allows us to select the skin from within Quake3. Like the .skin files, it needs to be named appropriately, and *must* be a .tga file. The icon image file needs to have the suffix before the extension of the skin name, so again my skin icon would be icon_coyote.tga. Once we have everything we need modified, we can create our own .pk3 file to distribute online.

To create the ready-to-use .pk3 file, we need to include which files relate to our skin (the image and the .skin files), and we need to re-create the path system Quake3 uses. As an example, I created a skin for the Orbb model, so I would place my image and .skin files in the relative path models/players/orbb/. Then I simply type 'zip -r coyote.pk3 models/players/orbb/*' using the zip archiving tool from ziptools. Quake3 will replace or add the files in a .pk3 to its internal filesystem.

So there we have it, the means by which to create content for a commercial game under Linux. Granted, Quake3 was an easy example because of it's ability to be extended by end-users, but there is no reason why professionals could not use the tools I used to create content for a game right from the start.





   Page 1 of 1