Master Of Orion 2 graphics and nightly hacking session

I wonder if some of you remember very oldskool game Master Of Orion 2 by Simtex. If you don’t you were probably too young to know of it’s existence. The game was released in 1995 and it was awesome 4X turn-based strategy game. The goal was simple. Manage your civilisation so it can finally get out of it’s cradle, show it the way to the stars, meet other races, trade or fight with them and build your empire. You could either be peaceful or take your name as a violent warrior. You could develop new technologies, build fleets, spy, sabotage, make enemies or alliances, fight space creatures, gather strategic resources, expand your presence through the galaxy and much, much more. Despite it’s simple principles, the game was intense. And for me it also helped to develop my imagination. How’s that? It’s simple. The game is a space opera. Each game is unique experience. And if you began thinking of a good story based on what’s developing in the game when you’re playing, most of sci-fi movies would be ashamed. The game offers much for a demanding player. Multitude of options, very flexible management of every aspect of the empire (ok, it’s not so cool when the game is nearing it’s end – too much micromanagement), various twists and turns, unique races with very different gameplay and much more.

I’m still playing it a lot, despite the fact that it’s more than eleven years old and the graphics is a little bit inadequate today. But it doesn’t matter really. The game has enormous playability almost unseen these days. Why am I talking about this? Well… I could really loose patience waiting for FreeOrion to be completed. It’s a free reimplementation of MOO2, but loosely based on it. But FreeOrion is a new game and some of it’s aspects that the developers are pushing doesn’t suit me very well. That’s why few months ago I began writing a simple engine in Python and SDL to learn and also to make a remake of MOO2. That was my goal. However I didn’t have time to finish it, so the project stalled. I’m still thinking about creating a reimplementation of MOO2 someday.

I was wondering how the graphics in MOO2 are saved (in what format). I’ve began looking at several sites explaining LBX files. It seemed that they’re simple archives. So I asked grandpa google to help me. I got few sites explaining the format and even depacker that even compiled under linux. Wow! I’ve began reading about the format, but I couldn’t find anything regarding graphics. Even though I’ve found something regarding graphic format used by Simtex it seemed that the guy who began hacking it died sometime ago and the information was incomplete and wasn’t very useful. I immediatelly realised that it could be a fine challenge for me, and because I have holidays now (no more faculty of physics stuff for few days, yeah!) I thought… Hmm… Why not to test myself? Brain that’s not used is not worth a single cent. I had a theoretical knowledge about analysing data streams (I’m crappy self-taught admin ya know) and I know theoretical basis for cracking, so I began reverse-engineering graphics format used in MOO2. I’ve depacked few LBX files from MOO2 and began to analyse them with yer olde hexedit. But manually analysing few hundred files just to see differences in them (it wasn’t time for “what this or those byte does?”) is real pain in the ass. So I’ve written a little helper script in Python for helping me in seeing differences between the files. After few hours I wasn’t much more knowledgeable than I was before. So I’ve depacked NEWGAME.LBX, because I knew this file should have screen for new game, and I knew were to look for changes. I began bruteforcing the file with FF in hexedit. After many “oops. I screwed again” I finally began to realise the pattern. I made some assumptions of course (e.g. that the pixels are represented by the 8-bit colormap) and some of them turned out wrong, but some were actually true. It really helped me that I had theoretical basis so I knew what to look for, and if I could find something I didn’t give up, I just tried to make a new assumption. After few hours spent with hexedit and calculator I’ve finally deciphered most of the format. It wasn’t very hard really, but time consuming, I admit. So when I knew that I could make some use with this knowledge I realised that I could try to quickly hack a viewer for MOO2 graphic format. mcedit is my best friend. 😉

I’ve written few routines in Python as a basis for future program for viewing those graphic files. The result is below:

MOO2GFX Viewer

Ok. Maybe it’s not what you’ve expected, but take into account that I just wanted a proof that it’s possible to view (and possibly edit in future) graphics from MOO2. This program is quick and dirty hack written within few hours and I’m really fucked up right now (you know, nightly hacking session, etc.), it’s christmas eve and I’m doing something like this because I wanted to. It has problem with the color palette and it’s not showing the file properly, but that’s normal. Bugs are everywhere after such session and I’m not willing to hunt them down now. I don’t know why the palette is screwed. I’ve hacked the NEWGAME.LBX graphics so I’ve got whole 256 color palette which I’ve ripped with gimp, then saved as .h file, removed unneeded C header code and made palette map which my program should properly interpret. Perhaps it’s the TkInter Canvas problem or something. I’m not going to look for bugs now. Also as you can see there’s a problem with few lines. The image is cropped, but I think this is because the format has some quirks in it that I haven’t deciphered yet. Also the file reader is crappy really and because the format is using something like 00 00 00 as horizontal line terminator and also as EOF
the program doesn’t check for bugs within the format itself. Also the information I have gathered about the format is not complete. There are some mysterious bytes that doesn’t do anything visually.
I’ll try to work on this later, after I get some sleep. The proof is there. I tried to test it on other graphic files, but it seems that it’s not working with them right now. I have two guesses. Either I have deciphered graphic format for MOO2 GUI or there’s something else with those f*cking line/file terminators. I’ve seen debug from the program that showed wrongly parsed bytes on some lines. So I guess it really needs polishing and further research. When I’ll have a program that can open most graphic files from MOO2, I will release it’s code under GPL and release information about the format I have gathered. Until then enjoy the screenshot.

About Wolverine

If you are looking for IT consultant, let me know! karol at karoltomala dot REMOVE com Just remove the REMOVE word from the e-mail above!
This entry was posted in Hacking, Master Of Orion 2. Bookmark the permalink.

2 Responses to Master Of Orion 2 graphics and nightly hacking session

  1. Anon says:

    Just stumbled across this while looking for something else entirely – the hex format for MOO2 save files, in the hope of creating a difficulty higher than impossible. That said, with regard to your palette problems: It’s been several years since your blog entry, but you might be interested in something like Debabelizer to fix your images. Photoshop has some similar palette tools. Of course, both are expensive, but I’m sure there’s alternative software out there. It would be great to see someone do something interesting with the MOO2 graphics in the current era.

  2. Wolverine says:

    Thanks for your input. If you looked further into my posts I actually made a fully functioning graphics viewer for MOO2.

Leave a Reply

Your email address will not be published. Required fields are marked *