After some time I’ve finished all essential functions in my MOO2 graphics viewer. All critical classes are almost finished (the only thing that is left in underlying functionality is palette merging in palette class, shouldn’t be hard to do). The GUI is still in the state as it was before, but all essential classes are finished and this is the reason I’m releasing the code to the public. It’s licensed under GPL version 2 (see www.fsf.org website for details regarding the license) so you can do almost anything you want with the code as long as you stay in compliance with the license. The Viewer and associated programs could be used as a technology demonstrator with some patience and little changes in the code. To run it you will need Python (for Windows possibly from http://www.activestate.com/products/activepython/) version 2.4 at least and Python Imaging Library (could be obtained from http://www.pythonware.com/products/pil/). This piece of software was developed under Mandriva Linux 2007 so it will probably need slight changes within the code to run properly on other operating systems, but Python is fairly portable and I have used struct.pack/struct.unpack functions to stay in compliance with other systems/architectures. As I don’t have MacOS X I’m not sure about big endian architectures. struct.pack/unpack functions have little endianess specified, but I’m not sure about byte sizes of integers and longs. It certainly runs under Linux and intel x86 architecture.
Before you get overhyped TOO MUCH you have to be warned. This release is intended PRIMARILY FOR CODERS!!! Power users should be able to make use of this software, but it’s NOT beginners friendly right now. I’ve decided to release the code, because I won’t have time to code this app for some time and I know there are some people subscribing to my feed eagerly waiting to get some information regarding the graphic formats used in MOO2. The source is extensively commented so you should be able to make use of it and learn few bits from it. The code is not optimised, I know that few things could be speeded up, but I don’t have time for it right now. It should be treated as Master Of Orion 2 graphic formats reading/saving demonstrator.
There are few basic classes within the code: Graphic, Palette (needs internal structure rewrite to be more efficient), LBX and Converter module. There are also some GUI specific classes and few support programs that I won’t describe here, because they are still work in progress and are only included so you could see how to use those four basic classes. With some skill you should be able to utilize this app for basic MOO2 moding, because I have included MOO2GFX to PNG and PNG to MOO2GFX converter. The app is slow, I know about this, but it’s not optimised as I have said. Most of the drawing and reading/writing is done as pixel by pixel so it is THAT SLOW. Despite this fact it is fairly usable for advanced users and you can do with it things like this:
Take notice that I haven’t implemented internal palette merging and I didn’t have time to write functions that will take proper merged palettes so you could import files with those palettes. That’s why there are some glitches. It still needs further research on which palettes are used for what. If you’ll be able to run this program please send me your findings regarding palettes so I could include them in this application when I’ll be able to finish the GUI. You can experiment freely, as you can see in the screenshots MOO2 accepts every graphic file that was converted from PNG to MOO2 graphics and then packed with my LBX compressor. Palette class has exportgimp() function to export palettes as GIMP (www.gimp.org) palettes so you can convert PNG to indexed palette and then use convert.py class to create a graphic file. After this you can use packer.py (needs changing filenames inside) or use lbx.py class to create new archive from specified directory. Of course there’s still some work to do, but this is just a demonstration of what will be possible in near future. So. All you brave programmers and adventurers download this program now!!! Happy MOOding… 🙂