View Full Version : DB Files

28 Aug 03, 14:45
OK, now for the delicate question:

Can you give me any insight into the structure of the databases, particularly the .wep and .veh files? Just a little, mind you; I don't need a field-by-field breakdown.

What I would like to be able to do is to "sort" my custom databases so as to make maintenance easier. Right now, it seems to store them in whatever order you entered them, which is the same order they come out in the export ascii file, and as far as I can tell you can't safely reorder them in Excel; i.e. the import process seems to be ordinal only and makes no attempt to match the names up again. Given that the pK matrix expands as the product of vehicles and weapon listings, it quickly adds up to a lot of scrolling and makes it easy to miss things.

It would be very helpful maintenance-wise to be able to group "like" systems together. I am capable of doing this manually with a hex editor, but I just need to know how to identify the start and end of given weapons and vehicle records. Also, if there is any file-level prefix information that is sensitive to the order of the following records. Right now, my best option when I add something into the "middle" of the DB seems to be to recopy all the "following" records in order and delete the original ones --- big drag, to say the least.


--- Kevin

Pat Proctor
28 Aug 03, 17:32
Unfortunately, there is no easy way to sort the vehicles and weapons manually. There are a couple of obstacles to this...

1) Units reference vehicles by their zero-based index location in the vehicle list. So if you have any units built with your database, changing the order of vehicles in the database will break the unit list.
2) Similarly, the weapons are referenced by number index in the vehicle list. Shuffling weapons will break your vehicle list.
3) You can not simply cut the data at the begining of the vehicle or weapon name, because there is a great number of binary values, of variable length, in front of these values.

In other words, I wrote all of this code and I wouldn't know where to begin to reorder the data manually. Sorry.

29 Aug 03, 13:51
Bummer. Your mention of the offset indexing scheme does provide some useful insight, though.

Let me ask this: when you copy a weapon/vehicle, and if you select "Yes" to the "Ignore existing" dialog, what exactly happens? Is the "old" version deleted and a new copy appended to the end of the list, or does it just leave the old version in place and not really copy anything? In general, what is the intended purpose of that dialog?

--- Kevin

29 Aug 03, 13:57
2) Similarly, the weapons are referenced by number index in the vehicle list. Shuffling weapons will break your vehicle list.

My impression of this is that if you "shuffle" your weapons list, what happens is the vehicle weapons lists retain their field data, but the specific weapon selected by that list entry will be whatever weapon now occupies the corresponding ordinal "slot" in the .WEP file. Going back and simply reselecting the correct weapon in the Edit dialog will fix the problem, as opposed to having to delete the entire weapon entry and reenter all the associated values. Of course, until this is done it's liable to exhibit "undefined behavior". (I love that term.) Does this sound right to you?

What happens when you open a different weapon file in an existing DB? Does it blow away all vehicle weapons regardless, does it rematch on weapon names, or does it just ensure that there is some entry in the indexed slot? Or something else?

--- Kevin