Terrain graphics (TERRAIN.LBX subfile 0)

Details about file formats, structure and contents in the original Master of Magic
Post Reply
User avatar
Implode
Site Admin
Posts: 433
Joined: Fri Feb 24, 2006 3:35 am
Location: Newfoundland, Canada
Contact:

Terrain graphics (TERRAIN.LBX subfile 0)

Post by Implode »

The terrain graphics in TERRAIN.LBX aren't in the same graphics format as the rest of the MoM graphics. The format is much simpler.

TERRAIN.LBX subfile 0 has a 192 byte header on it - I've no idea what this is for so skip it.

Each terrain tile is then made up of
An 8 byte header
The image data
A 4 byte footer

The first byte of the header is the width - this is always 20. The second byte is the height - this is always 18. I've no idea what the remaining 6 bytes in the header or the 4 bytes in the footer are for.

The image data is therefore always 20 * 18 = 360 bytes long, so each image including the header and footer takes up 372 bytes. Each byte of image data is an index into the standard MoM palette (see code in post about standard graphics format for this palette). There are 1,761 images.

The LBX extractor program on the downloads page will extract all 1,761 images out as BMP files. It also creates a single BMP file TERRAIN_000.bmp containing all the tile images listed out and numbered.

After many hours of shuffling the tiles around into a logical sequence (shuffling around to group similar tilesets together), I ended up with this. FYI the pink numbers the bracket the grass/sea border tiles are animation numbers used within MoM IME, this is what gives the coastline that nice rippling effect :)

Implode.
Hammerhands
Posts: 22
Joined: Wed Apr 05, 2006 8:34 am
Contact:

terrain and lbx

Post by Hammerhands »

In the old days we padded files of this type to get an offset in memory or hide data strings from easy access. I would love to play with determining the meaning or use of the data in that lbx that isnt bitmaps

btw in testing your work so far ive noticed none of neutral towns
can be invaded and the neutral troops are non aggressive. Are you planing on recreating the normal actions form MOM orig or are you playing with alrtering thier behaviors?
User avatar
Implode
Site Admin
Posts: 433
Joined: Fri Feb 24, 2006 3:35 am
Location: Newfoundland, Canada
Contact:

Re: terrain and lbx

Post by Implode »

Hammerhands wrote:btw in testing your work so far ive noticed none of neutral towns
can be invaded and the neutral troops are non aggressive. Are you planing on recreating the normal actions form MOM orig or are you playing with alrtering thier behaviors?
I just haven't written that part yet - it'll be 99% like the original, I'll only change things that I think really unbalanced the original game or where they really don't make sense for a multiplayer game.

Implode.
Hammerhands
Posts: 22
Joined: Wed Apr 05, 2006 8:34 am
Contact:

just a thought

Post by Hammerhands »

if you do see remapping the game terrain as an option

I would love to make areas like a cloud world where you have to cast flight on troops to move from cloud to cloud for an example

and there are many other ideas we had during the original story boarding that never made it to production the biggest we wanted to see was a map editor for the game allowing players to create scenarios never happened

also we wanted to be able to replace the wizard pics allowing players to be different than NPC's never happened.

back then software theft was so rampart that nothing that opened a door was ever considered so the ideas were shot down

also originally the spell of mastery as it eventually was named was supposed to require obtaining at least 10 books from the map in addition to your starting books that was also nerfed in the final released version.

the original design was for the spell to be used to end a stalemate it ended being the way game ended every time.

we also wanted to be able to route troops automatically ending the move new troops every time they are produced never happened.

the funny thing is with all the fear of illegal copies of thier software it was the LBX bug that forced the creation of run without CD patch and thus made game shareware


I found the cause and called the company described the error producing problem to them and expected them to use my CURE. but nope they patched the game to run without CD.
Here was the problem as best I can recall it was along time ago
Most people were using Win 3.1 with OS and main device being a harddrive their CD ws usually a slave drive using an Atapi driver
the driver back then had a bug in it for primary interupt 14 slave device the I/O block info was incorrect it was a typo I corrected it on my system and another using a Sound Blaster CD with a different so SB said lol with the exact same typo.

the problem was this windows would sometimes need to do housekeeping during the reading of the open LBX file causing it to switch high memory banks making the BUFFER dissappear. why because the driver didnt use a low memory pointer to buffer which would have allowed the OS to error trap and recover on error. the driver did prepare a low memory buffer
for main irq 14 and main/slave for IRQ15 which many people didnt have
old motherboards rarely had second IDE port it didnt make a low memory buffer pointer for IRQ 14 secondary device because of a typo
instead it ended up pointing directly to the buffer which could become unavailable if windows needed to switch memory banks during housekeeping. the game was impatient if the file load got interupted you got a crash LBX error. Instead of just correcting the driver most of the CD using world was using they chose to patch the game to not require the CD as the harddrive C: would never have a file access interupt conflict or buffer loss and yes it ended the bug and retail sales of the CD's.
User avatar
Implode
Site Admin
Posts: 433
Joined: Fri Feb 24, 2006 3:35 am
Location: Newfoundland, Canada
Contact:

Customizing graphics

Post by Implode »

Hammerhands wrote:also we wanted to be able to replace the wizard pics allowing players to be different than NPC's never happened.
You can do that already, have a poke about in the XML files. For example look in the main XML file that the server uses (Master of Magic Database.xml) and search for Rjak, you'll see his code is WZ07. If you look the graphics XML file that the client uses (Master of Magic Graphics.xml) you'll find this section:

Code: Select all

<wizard wizardid="WZ07">
	<portraitnumber>6</portraitnumber>
	<flagcolour>571D56</flagcolour>
	<portraitfile>WIZARDS.LBX</portraitfile>
</wizard>
Ignoring flagcolour, the portrait file and number specify where to get Rjak's portrait from. You can change this to any .LBX, .NDGBMP, .NDGARC or .BMP file. So for example say you draw a nice 24 bit colour version of the photo called Rjak.bmp, put this in the same folder as MomAdditionalGraphics.ndgarc, you'd replace the XML by this:

Code: Select all

<wizard wizardid="WZ07">
	<portraitnumber>0</portraitnumber>
	<flagcolour>571D56</flagcolour>
	<portraitfile>RJAK.BMP</portraitfile>
</wizard>
You also need to add a registry key, under HKEY_CURRENT_USER\Software\MoM IME add another key PathToCustomGraphics specifying the location of the .bmp file. (I just tried this to make sure it really works before I made any outrageous claims 8) )

Or you can add new sections to add new Wizards... new units... new spells... new complete races if you really want. My intention is to have every single graphic and animation in the game configurable in this way.

Also have you also that you can click Custom not only for wizard picks, but you can click Custom for the wizard photo as well and pick a .bmp file? However don't try this in a game with more than one human player in 0.8.6.x, there's a bug in it (but in a single player game it should work fine). Trying to fix it in 0.8.7.
Hammerhands wrote:the original design was for the spell to be used to end a stalemate it ended being the way game ended every time.
Yes, because it gives you a bonus score. If it didn't, I wouldn't feel the need to use it.
Hammerhands wrote:the funny thing is with all the fear of illegal copies of thier software it was the LBX bug that forced the creation of run without CD patch and thus made game shareware
Funny, I never had a problem with the CD, I actually didn't know how to get it to run without the CD until the v1.3.1 patch came out and the readme file had instructions in it saying how to do it!

Implode.
Post Reply