stamps

  • Simon
    20th Aug 2010 Administrator 1 Permalink
    I can give you a run-down on the save file format.
    The first 12 bytes are the file header containing the following information:
    [0-2] = Magic number
    [3] = Legacy Enabled (Save version 34 and higher)
    [4] = Save Version
    [5] = Cell Size (Usually 4 for this version of Powder Toy)
    [6] = Cells X
    [7] = Cells Y
    [8 -11] = Particle Count
    Starting at the 12th byte is the BZip Compressed data. The data format is as follows:
    Starting at byte 1 (Not byte 0) The first {CellsX*CellsY} bytes is the Wall Data to be scanned from top to bottom (left to right)
    The next two sets of data is the wall properties, the length is the number of Wall block read before that are type 4 (Fan), The first set is fan velocity x, then fan velocity y.
    After that starts the particles, {(CellsX*CellSize)*(CellsY*CellSize)} in length, again scanning top to bottom, left to right.

    The next is the particle properties, in 4 sets of {ParticleCount} (A fifth set is for clone-type, but only for particle types 9, 6 and 15)
    Set 1&2 is the interleaved particle velocities (x and y)
    Set 3 is the particle life
    Set 4 is the particle temperature
    Set 5 is the Clone-Type, this set length is the number of occurrences of type 9, 6 and 15 in the particles data.

    The next byte is the number of signs
    Following data contains the sign data;
    For each sign, there is a block of data:
    [0&1] Is the Sign X coord
    [2&3] Is the Sign Y coord
    [4] Is the sign justification (1 is centre, 2 is right, 3 is left)
    [5] Is the sign text length
    [6 to Sign text length] Is the sign text.
  • vsams14
    20th Aug 2010 Member 0 Permalink
    Thanks simon, thats exactly what i was looking for! I would still like to know how tpt writes data into the stm file. does it create a text file, write the data, then change the extension, or is there an algorithm that allows it to actually save as an stm right away? I still hold on whether stamps can be edited through notepad or some other software other than tpt, and what code I have to place in the powder.def file for it to remember my username and password to sign me in automatically.
  • ssc4k
    20th Aug 2010 Member 0 Permalink
    When I get home (I just left town for 2 days) I can provide a version that will let you save stamps uncompressed if you like. Then you would be able to edit it in notepad.
  • vsams14
    20th Aug 2010 Member 0 Permalink
    that would be nice, but i would still like to know how it compresses the stamp as well

    EDIT - and the gif idea would work prettty well for importing hand-made items as long as they were the right color



    *Please do not double post.*
  • ssc4k
    20th Aug 2010 Member 0 Permalink
    I was thinking about making something that converts colors and dithers images then compresses and saves them once I had some more time. Well if you can compile you can see exactly how it's compressed (using bzip) in the source and modify it to compress your edited files into TPT format.
  • vsams14
    20th Aug 2010 Member 0 Permalink
    Can you please clarify the last sentence? If I can compile what? And where do I get bzip?
    Thanks!
  • ssc4k
    20th Aug 2010 Member 0 Permalink
    Compile the source code, and it's a requirement to compile the source. I don't think you can just bzip a txt file with and hex edit the beginning but if you want try try http://www.bzip.org/
  • vsams14
    20th Aug 2010 Member 0 Permalink
    what do you mean by "source code"? tpt source or something else? I am sorry that I can't seem to understand you, but I'm pretty tired, so it may be that my attention span is shortening...
  • vsams14
    20th Aug 2010 Member 0 Permalink
    hey, ssc4k, can you please clarify exactly what needs to be done for this to work? sorry that I couldn't follow you earlier! i got bzip, but I am unsure of what source I am supposed to compile.
  • vsams14
    20th Aug 2010 Member 0 Permalink
    alright, someone's on vacation... If anyone else understands what ssc4k was talking about, please let me know!
Locked by jacob1: necro