Something went wrong. Try again later
    Follow

    Puzznic

    Game » consists of 10 releases. Released 1989

    A Taito puzzle game that involves matching same-colored gems. Players often have to think several moves in advance before committing to a course of action.

    Technical Notes on the Level Format of Puzznic for MS-DOS

    Avatar image for eloj
    eloj

    753

    Forum Posts

    761

    Wiki Points

    0

    Followers

    Reviews: 0

    User Lists: 7

    Edited By eloj

    Technical Notes on the Puzznic Level Format (PC/MS-DOS)

    This post contains some technical details regarding the file format used by the MS-DOS version of the Taito puzzle game Puzznic.

    Puzznic PC/MS-DOS options.
    Puzznic PC/MS-DOS options.

    Compression

    Headerless LZW with variable length code words ranging from 9 to 12 bits. The string table can contain a maximum of 2^12 (4096) entries.

    The initial table for codes 0 through 255 contains the corresponding octet, as expected.

    Code 256 is reserved for a clear (or reset) symbol.

    Code 257 is reserved for EOF.

    The first free code is thus 258.

    The clear code resets the state to the inital one, with 9-bit codes, and the next available code being 258. The compressor will signal this when it runs out of space in the string table.

    The current code length is increased once the last code we can express has been written to the table. I.e once the 512:th string is written, the current code width is expanded from 9 to 10 bits, and then again at 1024 to 11 bits and 2048 to 12 bits. Since 12-bits is the upper limit, it's a decoding error if we ever have to expand to 13 bits and the next symbol is not the clear symbol.

    The files start with a reset symbol, and end properly with the EOF symbol.

    LSB-first packing is used. For instance, if a file starts with the octets 00, 05 and 08, after shifting in 16 bits we're holding the value 0x500. Masking off the lowest 9 bits (0x500 & 0x1FF) we get 0x100, the reset symbol (256). After shifting out the previous code word, we're holding 2. Having read 16 bits and shifted out 9 bits, we shift in the next octet by 7 bits, holding 2 + (8 << 7) or 0x0402, masking 0x1FF bits gives the code word 2, and so on.

    While I have not tested it, it's possible that the LZW code from a GIF decompressor would work, if properly initialized.

    Reference data

    The level files I have decompressed are:

    $ sha256sum LEVELMP1.MAP EXTRA.PUZ

    8b57ee1e373c926182e47afd3d97477c07f98ad6dde076cdf3c3f703f250d46c LEVELMP1.MAP

    f397e1e1b58d02ca6f469c8af0f5e50620621f267f48cb71af545f77d550607a EXTRA.PUZ

    They are 5596 and 6227 bytes respectively, and decompress to 18432 bytes.

    Level format

    Each file contains a number of playfields, where each occupy 128 bytes; 10x12 bytes for the blocks, and 8 bytes of unknown data. The unknown data seems to have high entropy, and is likely just garbage for padding. While each playfield has a par-time, these seems to be related to the level number and not stored with the playfield data.

    The MS-DOS version of Puzznic comes with a built-in level editor.
    The MS-DOS version of Puzznic comes with a built-in level editor.

    The game divides the playfields into levels and problems, such that there are eight levels and each level contains level-number of sets of problems, where each set has four playfields. This gives us the total number of playfields as A046092(8), the 9:th triangular number times 4, i.e 2*8*(8+1), or unrolled: (1*4) + (2*4) + (3*4) + (4*4) + (5*4) + (6*4) + (7*4) + (8*4) = 144.

    We can go from a level, set and problem number to the linear playfield number via 2*(level-1)*level + (set-1)*4 + (field-1).

    The playfield number for level 3, problem 2-3 is 2*(3-1)*3 + (2-1)*4 + (3-1) = 18, which means the data for that level is at offset 18*128 or 2304 in the file.

    Level 3, Problem 2-3 playfield data. Seen also in editor shot above.
    Level 3, Problem 2-3 playfield data. Seen also in editor shot above.

    The octets maps to blocks as follows:

    • 0x00 metal
    • 0x01 blank
    • 0x02 brick_wall
    • 0x03 lift-updown
    • 0x04 lift-leftright
    • 0x14 red-circle
    • 0x15 diamond
    • 0x16 pink-cube
    • 0x17 triangle
    • 0x18 gray-pentagon
    • 0x19 green-bar
    • 0x1a blue-pyramid
    • 0x1b checkered-box

    eof

    Avatar image for citizencoffeecake
    citizencoffeecake

    1643

    Forum Posts

    213

    Wiki Points

    0

    Followers

    Reviews: 0

    User Lists: 3

    So what would one do with this information?

    Avatar image for shindig
    Shindig

    7024

    Forum Posts

    0

    Wiki Points

    0

    Followers

    Reviews: 0

    User Lists: 0

    Crime.

    Avatar image for imhungry
    imhungry

    1619

    Forum Posts

    1315

    Wiki Points

    0

    Followers

    Reviews: 3

    User Lists: 3

    I have no idea what this post is but I think I'm into it?

    Avatar image for stordoff
    stordoff

    1375

    Forum Posts

    10952

    Wiki Points

    0

    Followers

    Reviews: 24

    User Lists: 4

    I have no use for this information, but love that it's available.

    Not sure if you can move a blog post after the fact, but tying to the Puzznic forum rather than General Discussion may make more sense.

    Avatar image for bobafettjm
    bobafettjm

    2639

    Forum Posts

    874055

    Wiki Points

    0

    Followers

    Reviews: 4

    User Lists: 69

    I feel like this should totally be wiki information. Maybe in the guide section?

    Avatar image for eloj
    eloj

    753

    Forum Posts

    761

    Wiki Points

    0

    Followers

    Reviews: 0

    User Lists: 7

    Avatar image for imhungry
    imhungry

    1619

    Forum Posts

    1315

    Wiki Points

    0

    Followers

    Reviews: 3

    User Lists: 3

    This is a top tier necro. I love this thread even more.

    This edit will also create new pages on Giant Bomb for:

    Beware, you are proposing to add brand new pages to the wiki along with your edits. Make sure this is what you intended. This will likely increase the time it takes for your changes to go live.

    Comment and Save

    Until you earn 1000 points all your submissions need to be vetted by other Giant Bomb users. This process takes no more than a few hours and we'll send you an email once approved.