Hello everyone in the editing forum. :)
First off, I should say that, for the time being, I am going under the assumption that Pandemic / LucasArts will *not* be releasing any editing tools. Certainly not in the near future. Until I hear a specific confirmation along those lines, I don't think it's wise to assume they ever will.
Last night I started looking through a bunch of the *.lvl files. Here's what I've been able to figure out so far.
Each *.lvl file contains a series of what I'll call "chunks". In general, it doesn't seem to matter what order the chunks are in; although with some specific files (such as core.lvl or mission.lvl), it's definitely possible that order matters.
Integer values are stored with the least-significant byte first.
At the beginning of every *.lvl file is the 4-byte character string "ucfb". This is followed by a 4-byte integer indicating the size of the file (actually, the size minus 8; since it doesn't include this 8 bytes worth of header data).
Each chunk stores a particular kind of data, and has 8 bytes worth of header information. The first 4 bytes is a character string indicating the chunk type. The next 4 bytes is a 32-bit integer indicating the size of the chunk. In most chunks, there appear to be sub-chunks that I'll refer to as "sections". Each type of chunk seems to expect specific types of sections, often in a specific order.
Some of the chunk types I know of so far are as follows:
tex_ = Textures (can contain many)
skel = Unknown
modl = Model information
gmod = More model information?
coll = Collision information?
expc = Explosion information?
scr_ = Script?
I put together a really simple program that extracts some basic information from *.lvl files. You can see a (very preliminary) sample here:
Load\bes1.lvl (
http://personal.riley-man.com/swbf/r3-lvl-bes1.lvl.html)
The above is the Load/bes1.lvl file, which contains the big bitmap image you see when the Bespin Platforms map loads. (ie. when it zooms from the galaxy, to the system, to the terrain).
Since textures/bitmaps are typically the easiest thing to decipher, I'm starting there. I know a little about how they're stored, such as pixel dimensions. My plan is to extract the pixel data and throw it into individual BMP files. At first, they'll probably just be grayscale. Hopefully I'll be able to determine color information sometime soon. Most of the textures seem to be 16-bit color, so I don't know if the R-G-B bits are 5-6-5 or 6-4-6 or something else.
What I do know about the tex_ chunk is they expect a NAME, INFO, and one or more FMT_ sections. From there, it's organized rather strange. Each FMT_ section contains an INFO (yes, another one) and one or more FACE sections. Each FACE section seems to contain one or more LVL_ sections. And each LVL_section contains an INFO (yet again!) and a BODY section. The BODY section is where the pixel data is actually stored.
What I hope to come of this is that, assuming editing tools never come, we can eventually build new maps and insert them into the game. If editing tools do come, then what the hey -- it's always good to know the file structure! ;)