The Starcraft Editing Bible

Chapter One: The Architecture of Starcraft Data

TBL Files (Brief Mention)

TBL or "Table" files will be the first type of file in the MPQs we will try to deal with, basically because they are simply organized lines of text. You probably already know that you have to edit the stat_txt.tbl file to change things like unit names, ranks, and other stuff, and that many of the other TBL files also contain text which is displayed in various places in the game (tool tips, error messages, etc.). For that stuff, you probably just need to skip ahead to the CWAD Manager reference for a little info on how the TBL Editor functions. This section of chapter 1 is to teach you actually what those other TBL files do and how they interact with the game (which will become even more apparent when we get to the DAT files).

The TBL files like stat_txt.tbl (that are just lines of game text) are pretty simple to figure out. What is important to remember is that these lines of text (remember, lines, not sentences -- think of each one as an "entry") are referenced many other files in the MPQ. For example, weapons.dat (editable by Arsenal III) references a line in stat_txt.tbl in the "Error Msg" variable (the message to display when the weapon being used can not appropriately target a unit). What this means is that when you see the Error Msg line in Arsenal III while editing the weapons.dat, the words that you see aren't actually stored in the weapons.dat file. All you really do is select a number; this number corresponds with a line in the stat_txt.tbl file and that's how the line is matched up with the actual message for the weapon. This occurs in many other instances too (almost all "string references") because, in particular, it would simply be unnecessarily redundant to have the game text in the TBL file and also store it in every other file that references it. The main point you should remember is that this means if you edit a line in a TBL file and then have another file such as weapons.dat reference that line, it will reference your edited line, not the original (even though Arsenal III may not be able to tell you that).

Here is a brief summary of the "game text" type TBL files:

rez\gluAll.tbl

In here, you'll find most of the text for game menu screens (like the score titles on the Victory/Defeat screens) and the Battle.net text.

rez\gluHist.tbl

The things you'll find here are the campaign mission titles and cinematic tiles.

rez\help_txt.tbl

You'll find the in-game pop-up menu text and the short cut hints here.

rez\network.tbl

This normal game text file contains a lot of the "system messages" like "Building exit is blocked" or "Cannot create more units." It also contains the race names (for when you select race), the tribe/brood/squadron names (for the Victory/Defeat screens), and a little bit more miscellaneous stuff.

rez\stat_txt.tbl

This is essentially the "main" tbl file that people talk about. It contains basically all the text most people would ever want to edit like unit names, weapon names, spell names, upgrade/tech names, ranks, miscellaneous unit text like "Parasite Detected" or "Detector", Advisor error messages like "You must build on creep." or "Not enough energy.", and a slew of other things like labels for things in the data files and AI scripts. If you're looking for some text, you'll most likely find it in here.

rez\tips.tbl

This tbl contains all the "Tool Tips" in Starcraft: the helpful hints you can ask Starcraft to give you when you start a mission, like "Combining different types of units during an attack makes your attack more effective. The strength of one unit will complement the weakness of another." :)


There are several other TBL files which are just as, if not more important. In TBL files such as images.tbl and portdata.tbl, you'll find not lines of game text but what appears to be a listing of paths to various files in the MPQ. In short, these TBL files tell Starcraft exactly where to look for certain files when it wants to load something. For example, images.tbl contains references to all the GRP (Starcraft graphic) files in the unit\ directory of the MPQs (Stardat and Broodat specifically). What this means is that Starcraft will look for these particular files in those specific path. For example, if I changed zerg\drone.grp to bobo\bear.grp, then Starcraft would use the bobo\bear.grp as the Zerg Drone (assuming that bobo\bear.grp existed in the MPQ).

Now, you might ask, how does Starcraft know that the line that normally says zerg\drone.grp is supposed to be the one it uses for the Zerg Drone graphic? (After all, all the lines are essentially arbitrarily ordered) Well, like the previous type of game text TBL file, these mpq paths TBLs are interconnected and referenced by many other places in other files. For example, the first variable in images.dat (called "File" in Arsenal III) is just a reference (often called a "pointer") to a line in images.tbl. This is how Starcraft knows to associate that particular GRP in the MPQ with a particular sprite (which has its other variables controlled by images.dat). That means images.dat (and most other files referencing GRP, WAV, or other media files in the MPQs) do not directly point to them, instead they point to a line in a TBL file which is then recognized as the path that Starcraft looks for the file in. So changing a line in one of these type of TBL files will cause all other files referencing them to change the MPQ file they ultimately point to also.

Here is a brief run-down:

arr\images.tbl

This is a listing of the grp files in the unit\ directory of the MPQ files (i.e., all the unit, weapon, doodad sprites, and stuff). Each line is listed as the path and file name that is appended to unit\ in the MPQ. For example, unit\zerg\drone.grp in the MPQ is listed as zerg\drone.grp.

arr\mapdata.tbl

This is a listing of all the campaign maps (and their respective directories) on the CDs (Install.exe). Each line is prepended to the \staredit\ paths in the Install.exe. For example, campaign\terran\terran01 points to campaign\terran\terran01\staredit\scenario.chk and all the wav files in campaign\terran\terran01\staredit\wav\ directory.

arr\portdata.tbl

This is a listing of the portrait files in the MPQs (*.smk files). The format is a little weird; each line is appended to the portrait\ directory and also prepended to the #.smk's in the MPQ. For example, tmarine\TMaFid0 in portdata.tbl refers to portrait\tmarine\TMaFid00.smk, portrait\tmarine\TMaFid01.smk, portrait\tmarine\TMaFid02.smk, etc. in the MPQ. It's pretty easy once you recognize it.

Here is a neat trick. Let's say you make a replacement portrait for a marine, but only want to use that one for all of the marine's four idle portraits and all three of his talking ones (this is common when you use still smk files instead of movies). You could make 7 copies of your replacement and place them all respectively in your CWAD or Custom MPQ, but that makes it a hell of a lot bigger. Instead do this:

First, change both the marine's portrait lines in the tbl -- tmarine\TMaFid0 (the idle portraits) and tmarine\TMaTlk0 (the talking portraits) -- to a new user defined line path. For example, change them both to mymarine\TMaFid0. Now place your custom portrait into your CWAD as portrait\mymarine\TMaFid00.smk. That's it; Starcraft will now only use the smk files with the portrait\mymarine\TMaFid0- prepended for the marine's portrait cycle.

arr\sfxdata.tbl

This tbl file is a listing of all the wav files in the MPQs. Each line is appended to the sound\ directory. It's pretty simple.

Just like the other three tbl's above, each line points Starcraft in the direction of the wav files in the MPQ. For sfxdata.tbl, it points to each individual file like the images.tbl. For example, if you changed the Terran\CIVILIAN\TCvWht00.WAV line to Terran\DROPSHIP\TDrPss00.WAV, then the Civilian would play the Dropship's annoyed sound sometimes when you click on him. :)

The primary use of this tbl is to save space. Let's say You have made replacement sounds for a Civilian, but only have 3 selected or "Wht" sounds; the original Civilian has 4. Now, the simple way to get rid of the fourth sound would be to duplicate one of the 3 replacement wavs you made and put it in your CWAD as the fourth one. However, that adds unneeded megs to your custom -- which can start to get very bulky if you do that a lot. If you simply redirect the fourth sound with the sfxdata.tbl, you save space. Just change Terran\CIVILIAN\TCvWht03.WAV (the fourth Civilian selected sound) to Terran\CIVILIAN\TCvWht00.WAV (or 01 or 02 depending on which one you want to duplicate).

Another common usage is to switch around sounds between units without adding too much space. For example, let's say you turn the Raynor marine unit into a Firebat using Arsenal III (by giving him a Firebat sprite and whatnot) and want him to use the normal Firebat sounds. Instead of putting all the Firebat wav files in your CWAD to replace Raynor's voice (that's a lot of useless room), simply edit the sfxdata.tbl to redirect Raynor's sounds to the Firebat's. This way, you also still have Raynor's original sounds if you want to have another unit use them.


TBL files will come into play again later when we want to add something completely new to the MPQ structure, like a graphic that wasn't there before, without replacing anything at all. How would we do this? Well, first we need to have a new reference to that new graphic (or sound, movie, etc.) file -- and we do that by adding a line to a TBL file. How? See the next section. :)

Copyright (c) 1999-2000 Jeffrey Pang. Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the
Free Software Foundation with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU Free Documentation License".

[an error occurred while processing this directive]