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

MAP, PIC and PAL formats figured out ! (almost)

Discussion in 'Civ1 - General Discussions' started by darkpanda, Oct 18, 2012.

  1. d0c

    d0c Chieftain

    Joined:
    Jan 8, 2018
    Messages:
    5
    Gender:
    Male
    I have just registered to get some more information about cived which source code I have been looking into to get better understanding of the Civilization.
    Great work darkpanda, really appreciate you work although the code sometimes is difficult to grasp. Hope you can answer some of my question.
    In the LZWDecoder's parseByteStreamToIndexes you are reading bytes in little endian mode and extracting only first 9 bits (mask 511dec), but I cannot understand why after first 256 bytes you switch to extracting 10 bits (mask 1023dec). Similar operation, switch to reading 11 bits happens at byte 512.
    Is this some kind of non standard LZW or optimization you did?
    Please elaborate if you can.
     
    Last edited: Jan 8, 2018
  2. darkpanda

    darkpanda Dark Prince

    Joined:
    Oct 28, 2007
    Messages:
    603
    Hi there,

    I didn't review my code yet but the rough idea is that Civ's LZW implementation uses a dictionary with 3 types of indices: 9-bit, 10-bit and 11-bit indices.

    IIRC one bit is always the same, so actual usable bits are 8, 9 and 10, which make it possible to store, respectively 256, 512 and 1024 index values for each index type.

    Hope this helps !
     

Share This Page