1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Colonization picture viewer

Discussion in 'Other Sid Meier Games' started by angrylion, Dec 29, 2007.

  1. thomasd

    thomasd Chieftain

    Joined:
    Dec 30, 2007
    Messages:
    8
    Hi,

    colowin uses different Resources (stored in the dlls), that are way easier to extract, but don't have the dos-nostalgic-look :).

    Anyway, thanks to the scummvm-project and its support for M4/MADS, we were able to decompress the .ss and .pik files, and I made a simple java-based image viewer.

    The link above leads to the commit that actually removed MADS-Support from scummvm, but feel free to take a look at these files, decompression and run-length-decoding of images is all there.

    So here's the Image Viewer, extract the .zip and start it with something like:
    Code:
    java -jar JColoViewer.jar
    Of course you would need to install java first :)

    It should be pretty self-explanatory, just open a file (.pik or .ss) and there you are.
    The left pane is debug-only information about the compressed file structure.
    If you are opening a .ss file, try clicking on the prev/next image buttons to see all images in the file.

    Please let me know if something does not work, or if there are some features you would like to see implemented.

    Regards, Thomas
     

    Attached Files:

  2. Fankman

    Fankman Chieftain

    Joined:
    Jan 12, 2009
    Messages:
    15
    Thanks for this great tool, thomasd :goodjob:

    Its possible to build a version with an export-function (bmp, jpg)?
     
  3. thomasd

    thomasd Chieftain

    Joined:
    Dec 30, 2007
    Messages:
    8
    Hi Fankman, thanks for the feedback!

    There you go, an export function is added (available after opening a file).
    Currently it justs exports to the subdirectory "exported" - tell me if you want to be able to specify the export directory.

    The export image type is PNG - do you need other types as well?
     

    Attached Files:

  4. Fankman

    Fankman Chieftain

    Joined:
    Jan 12, 2009
    Messages:
    15
    Very fast, i am impressed :bowdown:

    PNG ist the best way to store the picture, without loosing image-informations. Thanks, you're genius :goodjob:
     
  5. Fankman

    Fankman Chieftain

    Joined:
    Jan 12, 2009
    Messages:
    15
    Oh, one more thing... ;)

    If you like optimize your program, then you can add the ff-filetype. The ff-files are the fonts in Colonization. And i think these are also bitmaps.

    I've found this, maybe it's helpful:
    http://scummvm.sourcearchive.com/documentation/1.2.0-1/engines_2m4_2font_8h-source.html

    And finally, and this would lift your programm to a higher level, is a Edit-Mode.
    A simple 1px-drawing Pen with a 16-color-palette would be great. And then i can begin to mod the graphics :crazyeye:
     
  6. thomasd

    thomasd Chieftain

    Joined:
    Dec 30, 2007
    Messages:
    8
    And here we go, it took a bit longer, but I managed to implement a simple edit mode and font display.

    The image editor ist a simple 1x1 pixel brush, whose color can be chosen from the palette window (see screenshots).

    Please try it out, hope it helps :)

    Edit:
    Fonts now render correctly, but exporting them is currently disabled.
     

    Attached Files:

  7. Pham Nuwen

    Pham Nuwen Chieftain

    Joined:
    Jul 26, 2012
    Messages:
    3
    Hello guys. I've come across implementation of madspack2.0 fab section decoder on the internet, so i tried it in java and it seems to decode FAB sections from Colonization files well. So I analyzed the decoding algorithm a little and created a little dumb encoding routine that encodes decoded data to something else than the original, but the encoded result decodes to the same as the original. Problem is, that when I try to just replace a FAB section in SS file, it does not work with your viewing programs, so it won't work with the game either. My encoding routine does not perform any compression, just encodes the data, so that decoder decodes it right. That means pictures encoded by my algorithm are bigger than the original ones after encoding. It might be the case, that MADSPACK files contain some information about sizes of fab sections in the header, before the fab sections. Do you know anything about this? I think it would be great, if after 20 years or something we would have picture editor for colonization. I have some ideas... :D

    BTW thomasd: I have some issues with your program. are you interested to know?
    BTW2 - i have some ideas about how to implement compression as well, but don't want to do it if it won't be worth the effort

    Thank you very much for reply.
     
  8. thomasd

    thomasd Chieftain

    Joined:
    Dec 30, 2007
    Messages:
    8
    Hi!

    I have never gotten around to implement an encoding/compression algorithm in my app, so congrats for your effort!

    Are you setting the header sizes correctly? Specifically each FAB entry has a compressed size and uncompressed size, if they are the same, my application treats them as uncompressed (and the game hopefully as well, but I didn't test that).

    Sure I'm interested in the issues - what's not working for you?

    PS: Compression support would be awesome, then we could turn this in to a real Colonization file editor!
     
  9. Pham Nuwen

    Pham Nuwen Chieftain

    Joined:
    Jul 26, 2012
    Messages:
    3
    Fast reply, great. Let's start with your program:

    I have issues with some SS/PIK files - certain pictures are not displayed correctly. For example image 13 in building.ss - it probably should be college, but the picture does not change when i'm on 12 and press the down key. then when i press down key again, i get university, and when i press up again, nothing changes. also the list does not show which row is selected correctly, when this happens. I have the same issue in many other ss files on certain pictures. these pictures were ok for angryfire's program (but other were problematic). Also for colony.pik it says succesfully loaded 2 entries, but nothing changes in the picture or the list.

    The second problem is that the scaling bar is too much to the right, so i can see only two options: 1 or 2.

    The last problem is that I can edit picture even with edit mode off, all you have to do is pick a color.

    Screenshot is in attachment. I use Ubuntu 10.10 with Java 1.6.0_20


    As for my attempts, I just used hex editor to manually copy out some sample fab sections for testing and then tried to manually replace the fab sections with result of my algorithm. I didn't analyze the header of the files at all, neither the content of the decoded data. My algorithm actually inflates the data by about 1/8 plus some constant, so I wonder how the reverse compression is handled by colonize decoder :) let's try it.

    So now my task is to analyze the header of ss files, where exactly are the sizes of the sections...
     

    Attached Files:

  10. Pham Nuwen

    Pham Nuwen Chieftain

    Joined:
    Jul 26, 2012
    Messages:
    3
    It works!!! :woohoo:

    More or less. The problem was in an additional byte that was accidentally added at the gluing place between original parts of ss file and my encoded part. :blush: I also found the size of fab section in header and changed it and it works, even in the game! The only problem is some kind of black noise added. Don't know where it comes from but it's probably just my bug, something I will hopefully cope with. People, I think we're going to have a Colonization graphics editor.
     
  11. Fankman

    Fankman Chieftain

    Joined:
    Jan 12, 2009
    Messages:
    15
    Sorry for my late answer. this tool is amazing, simple and useful.
    Really, a great job :goodjob:

    Now, if you have more motivation, you can unlock the font-export-function ;)

    And a import-tool would be great. So we can replace the message-images in the game. A large 320x200px-image is impossible to realize, when you must place pixel by pixel :D

    Do you have news, Pham Nuwen?
    I'm very interested to see a real Colo-Image-Editor before i die :D
     
  12. thomasd

    thomasd Chieftain

    Joined:
    Dec 30, 2007
    Messages:
    8
    Hi guys,

    here is an updated Version of my picture viewer.

    Changelog:
    • Use system look&feel on non-Mac OS X Platforms (fixes UI bugs like the zoom-slider)
    • Display Tooltip with color information when hovering over a pixel (works best in edit mode)

    I'm afraid exporting fonts will take a little longer - I will have to read about windows bitmap font formats first...
     

    Attached Files:

  13. Zharramadar

    Zharramadar Chieftain

    Joined:
    Jan 14, 2008
    Messages:
    10
    Location:
    Curitiba, Brazil
    Sorry for necroing this thread, specially since the last time I posted here was in 2008, but since no one ever posted their source code for viewing colonization files, I'm attaching here both the binary and the source code (made in C#, .NET Framework 4.5) for a colonization viewer that will open .PIK files, .SS files and .FF files.

    Basically I followed what ScummVM did, just ported to C# (makes easy to port to other languages rather than C++).

    If this does not open for you, try installing .NET Framework 4.5 in your machine.

    Hope this helps someone who wants to use the original Colonization files for anything (maybe making a TTF from the colonization fonts???)

    -Roger-
     

    Attached Files:

  14. institution

    institution Chieftain

    Joined:
    May 7, 2014
    Messages:
    7
    Hi Zharramadar.

    I've also (thanks to this thread and ScummVM) made madspack decoder (Python and C++ versions). However, it lacks .FF support.

    So probably I will use your version to extract fonts when I go back to work on cc94.
     
  15. Zharramadar

    Zharramadar Chieftain

    Joined:
    Jan 14, 2008
    Messages:
    10
    Location:
    Curitiba, Brazil
    Very nice, very nice. I thought on making a clone of Colonization myself, maybe adding multiplayer over internet to it, but these days, I do not have too much free time to spend to make one, unfortunately I must focus now on things that will give me money =(

    Hope you can achieve a very good Colonization clone, would love to play it.

    If you have any questions about the FF part of the code, just let me know. PM me might be faster, as I'll get an e-mail about it.
     
  16. Roscado

    Roscado Chieftain

    Joined:
    Nov 11, 2010
    Messages:
    2
    Hi,

    Sorry for the offtopic.

    We are trying to translate the Microprose game Rex Nebular, Dragonsphere and Return of the Phantom. These games work under mad engine.

    The global.hag file contains text files, this file can be unpacked and packed with some programs created by users.

    The content of global.hag file:

    Messages.dat

    This file contains texts but not know how to unpack and re-pack it.
    Here are some explanations of Alpobemp (http://www.icgag.it/alpobemp/?page_id=189#comment-684) of the file structure.

    Quote:
    "The compression algorithm which is based Dragonsphere, rex nebular, return of the phantom, is a particular case of LZ, LZEXE of Fabrice Bellard (the string" FAB "at the beginning of each sentence suggests).
    In this discussion of a forum is discussed:http://www.abandonware-forums.org/s...on-rex-nebular&p=338779&viewfull=1#post338779.

    The code decompression of LZEXE is public (google is easy to find), but must be modified to accommodate the use of the game (LZEXE compressed exe executable files, not just data files).

    As for compression, the code is not available, unlike the decompression. I used a "tactical" not have compressed the modified text, using the prefixes "FF" before each 16 characters of text (meaning "takes the following 16 characters are according").


    Well, unfortunately Alpobemp no longer have the code, because the theft of your pc and backup a few years ago and we not know how to create the code.

    Vocab.dat

    Contains texts.

    * .ff

    Contains fonts, Alpobemp created a program to modify fonts it works perfectly.

    http://www.icgag.it/alpobemp/html/EXEC/DrawFontMADS.exe

    Possibly also work with civilization.

    * .ss

    Unknown content.

    We have not found pictures of the games and texts of the introduction maybe found in the * .ss , * .int or *.CNV, *.CND

    I understand it is very difficult but maybe is possible adapt the code done by institution for these games.

    I uploaded the files GLOBAL.HAG of Dragonsphere and Rex Nebular unpacked.

    http://www.mediafire.com/download/r2ocr4hm4mc3mbb/GLOBAL.HAG+unpacked.rar

    Greetings and thank you for your time.
     
  17. Rinin

    Rinin Chieftain

    Joined:
    Mar 26, 2015
    Messages:
    2
    Well, bless this long-living theme. If someone will use awesome tool provided by Zharramadar, you should probably add a bit to decompression function:

    Almoste everywhere
    should be replaced with
    And you'll got picture with full alpha channel. Then you only need to replace
    with
    And you will got nice png withoup blackness on right side for *.SS pictures.
     
  18. Rinin

    Rinin Chieftain

    Joined:
    Mar 26, 2015
    Messages:
    2
    And you should also fix typo in
    MadPacksImage.cs
    to
    and probably even to
    because paletteData is allways lower than 64, so with this you'll take brighter images
     
  19. kylecs

    kylecs Chieftain

    Joined:
    Aug 3, 2015
    Messages:
    8
    Hey Folks, I found this thread and it is exactly what i have been looking for. However, I am new to this board so i might be missing something, but when i click the attachment .zip files, nothing downloads. I am using Chrome on a macbook. Am i missing something to make the download happen?
     
  20. dalgo

    dalgo Emperor

    Joined:
    Feb 23, 2002
    Messages:
    1,426
    Gender:
    Male
    Location:
    Auckland, New Zealand
    I can't help you with this except to say I have the same problem, none of the zip files will download. I am using Internet Explorer and Windows so it's not your system at fault.
     

Share This Page