repackaging?

Details about file formats, structure and contents in the original Master of Magic
Post Reply
rinnaldo
Posts: 4
Joined: Wed Aug 23, 2006 10:02 pm

repackaging?

Post by rinnaldo »

I apologize if this is a stupid question, but I'm new to this.

Once I've extracted and edited some portions of an lbx file, how do I repackage them back into that file, so that the game can use my changes?

Thanks for any help you can provide.

Rinnaldo
User avatar
Implode
Site Admin
Posts: 433
Joined: Fri Feb 24, 2006 3:35 am
Location: Newfoundland, Canada
Contact:

Post by Implode »

Sorry I've never had a need to repack LBX files so I've never written a tool to do it. There may be one out there that someone else has written... I've never looked for one though :)

Most guides that tell you about how to modify the game stats (changing spell costs, unit stats and such) just tell you the hex address directly in the LBX file, i.e. you edit the LBX file directly rather than extracting, modifying and then repacking.

Out of interest, what files are you trying to edit? :)

Implode.
rinnaldo
Posts: 4
Joined: Wed Aug 23, 2006 10:02 pm

Post by rinnaldo »

Well, I thought I might edit some graphics files to start with and see how it went. After unpacking Figure1.lbx, however, I see that it's made of like 480 pieces... So, that seems less fun, now. Maybe if there were a way to extract it all to one bmp file...

If it were relatively simple, I also thought I might try to write a couple new spells; that sort of thing.

Here's another question for ya: After unpacking some lbx files (copies in a separate folder), I tried to save a bmp file as Figures1.lbx to see if the game could read it. It couldn't and crashed it, as I expected. I changed it back. Later on, I tried playing the game as normal and it wouldn't start due to the "You must have 3700 kb" error, which I'd never gotten on this computer before (though I had on another one). Wtf?

So, since then, I've been playing it on DOSbox, which is okay when the cpu cycles are set to "auto" as someone on the forum recommended (horribly slow otherwise, and actually kind of slow on the map portions this way - but faster during combat).

Anyway, I'd rather run it just using the normal DOS (I'm using WIN98 SE), rather than DOSbox, if possible, but I don't know how to get it to do so again. I've tried changing the memory settings, the sound settings, etc. but nothing helped. Any thoughts?

Rinnaldo
rinnaldo
Posts: 4
Joined: Wed Aug 23, 2006 10:02 pm

Post by rinnaldo »

Well, oddly, the problem with the memory error seems to have been caused by using a mouse in a usb port... I changed it back (that's the only notable thing I changed today) and it works on DOS like it used to. Weird.

Hey Implode, I noticed your Editor tool for your IME edition of the game. Is there a way to use this on just a regular copy of the game, to alter graphics and so forth?

Rinnaldo
User avatar
Implode
Site Admin
Posts: 433
Joined: Fri Feb 24, 2006 3:35 am
Location: Newfoundland, Canada
Contact:

Post by Implode »

rinnaldo wrote:Hey Implode, I noticed your Editor tool for your IME edition of the game. Is there a way to use this on just a regular copy of the game, to alter graphics and so forth?
Short answer: no :)

Long answer: The two games use completely different file formats. I use XML for all the unit, spell, etc. data, and to tell the game which graphics file to use for each unit, building and so on. i.e. the graphics XML file says for a particular unit, its overland image is the 70th image in UNITS1.LBX, and then in the various FIGURESx.LBX files, there's 4 images of the unit walking and attacking, facing in each of 8 directions = 32 images.

For the graphics, wherever possible I read the graphics straight out of the original LBX files, to keep the download size of MoM IME as small as possible. New graphics I use my own graphics format (.ndgbmp) stored within my own archive format (.ndgarc).

The original MoM has all the data, sound, music and graphics in the LBX files. (Some of the data is also hard coded into WIZARDS.EXE). LBX files are like zip files, in that they contain multiple files, but they're not compressed. LBXExtract will undo the LBX files into their original files, but unless you run it with the /raw option, it also converts many of the MoM file formats into more modern formats. So, FIGURES1.LBX doesn't really contain 480 .bmp files - it contains 480 files in the weird format MoM uses for images.

So to change the graphics, not only do you need something to repack .LBX files (which would be simple to write), you also need a converter to convert from .gif, .bmp or whatever you're saving your graphics in into the MoM file format. I'd have to do a lot more looking into the MoM image format to be able to write that, currently I have a decompressor for reading the MoM image format, but I swiped most of the code from elsewhere and don't totally follow how it works. Also, your images would have to only be 256 colours, using the original MoM palette.
rinnaldo wrote:I also thought I might try to write a couple new spells
Even if you could edit the data and graphics, the effects of each spell are all hard coded into the game so you'd never be able to change them. You can change unit stats, costs, spell research and casting costs, but I think that's about it.

Implode.
rinnaldo
Posts: 4
Joined: Wed Aug 23, 2006 10:02 pm

Post by rinnaldo »

Okay, thanks for all the info. :)
Post Reply