Log in

View Full Version : The .paks and what to do about them.



khelvan
03-18-2005, 04:11
Ok, as we know, making changes to some of the graphics files, such as faction icons, requires unpacking the .pak files and editting the files therein. Now, currently it seems the only way to get these to the end user is to either pack up the complete .pak (which may mean hundreds of MB) and make it part of the download, or to write a very involved installation routine to unpack the files, insert the changes, and repack them.

However, many games have a naming convention where similarly named files are checked before the main archive, and any files in the "patch" file are used instead of the corresponding file in the main archive. This is done by some developers for ease of patching, so that the entire .pak does not have to be re-sent. For instance:

filename.pak is the main archive,
filename_001.pak would be checked first.

Does anyone know if such a naming convention exists in RTW?

Thanks,

-khel

khelvan
03-19-2005, 06:27
Anyone have any experience with this?

Cheers,

-khel

bouis
03-19-2005, 09:10
This is funny. I've been trying to figure this out, so I asked Tyr, he said EB surely knows how to do it, he asks you and now you ask everyone else.

Since the 1.2 patch you can't just unpack them then delete them and have it work. Thanks CA!

I can't see any easy way to do this. Sim assures me it can be done by repacking the files ourselves, then doing some sort of binary "diff" (like the one for text files) on them and creating a patcher. But I have no idea how to do that.

khelvan
03-19-2005, 09:32
The logistics of getting all the graphics files out to end users hasn't come up yet for EB, really. We assumed that because of all the content that our download is going to be huge...v0.4a was less than 4MB, and the graphics it had were only for less than 20 new units; about 1/25th of the total. That doesn't include any buildings, faction icons, or other large files. So there is no getting around it, our download is going to be massive.

However, I don't think it ever occured to anyone to try and find a way to handle the .pak issue above; up until now none of our internal releases included things such as the new faction icons.

I guess I've been spoiled by the mod work I'm doing for another game, where a mod development kit was released with the game and tools were supplied for this. However, you would think that even without such tools, CA would have some sort of internal mechanism for dealing with patch files that affect the .paks. Otherwise they would be faced with the same problem we are; I suppose it is possible that they have a programmer waste time coming up with an install program that unpacks the relevant .pak files and repacks it with patched content, but I don't think that is a likely scenario...they must have an easier way.

When we have some time we'll play around with the naming routine, to see if we can come up with some way to get a new .pak read before the originals.

bouis
03-19-2005, 10:31
It would be nice if that was possible. But why I expect to find that it isn't? When they said this game's middle name was "moddable" they neglected mention that its first name was "superficially."

I've been looking into patching the pak files, (and it should be possible!) -- but the problem is going to be determining the order that the files are originally packed. If they're out of order I can't see it working correctly.

Someone needs to ask the author of xpak about this one.

bouis
03-19-2005, 13:36
Oh yeah, this is quite possible. Here's how I did it.

Unpak the pak file using xpak.

Create a list of the files in the format that xpak uses to create new pak files. I believe that they're packed/unpacked in alphabetical order, but to be safe, it's best to use a file lister that can sort the new files by the time they were created.

For example, I did this one (http://www.twcenter.net/forums/index.php?act=Attach&type=post&id=1812017089) which works for the ui_0.pak.

Now create a new pak file from the files that came out of the original one. Do a checksum comparison between to new pak and the old one to verify that they're identical. If they're not you need to fix the order of the files.

Now that you've done this, change the files you want to change. Now re-pack them again. The new pak file and the original will be different (obviously).

Now get a binary file patcher. I used RTPatch, which is less than ideal because it uses a GUI interface (not sure if you can make it do a command line one.) What this does is compare the original and the new pak file and produce a small executable file that contains the differences and can turn the old one into the new one. Some patchers can also turn the new one into an old one. Continuing my example, I changed two character pictures in this 148mb pak file, then repaked, and made a patch, which was only 110 kb. The results speak for themselves:

Click Here for picture (http://www.datasync.com/~bouis/realhannibal.JPG)

Duke John
03-19-2005, 15:28
Can't you write a bat file that unpacks, moves new files into the directory and packs them back.


CA would have some sort of internal mechanism for dealing with patch files that affect the .paks.
Well actually CA just made a new pak called patch_0.pak and probably added some code so that the contents of the pack overrides the other packs.

bouis
03-19-2005, 15:45
Using a batch file is possible but it has a number of problems, in that it would take a long time to process and would require a lot of disk space.

A patch is a much more elegant way to handle it.

khelvan
03-19-2005, 20:55
Well actually CA just made a new pak called patch_0.pak and probably added some code so that the contents of the pack overrides the other packs.Right, that was my point, this is exactly the sort of thing I was looking for. The question is if we can follow this naming convention and create our own "patches" for the .paks.

Vercingetorix
03-19-2005, 22:29
I'm pretty sure the game only reads certain paks. The game doesn't load everything in the packs folder that has a .pak extension as you might expect. What I think we could do is put all our new stuff in patch_0.pak since we know the game reads that file.

bouis
03-20-2005, 11:38
I have done text files to successfully repack ui_0, ui_1, and patch_0 to be identical to the originals. If anyone wants them lemme know.