Ship File Format

    Joined
    Jun 22, 2013
    Messages
    14
    Reaction score
    0
    • Legacy Citizen 2
    • Legacy Citizen
    Ah, that makes sense :)

    Also, please refer to my last commits referred here: https://github.com/StarMade/StarMade/pull/6
    The first ~64KB section is mostly understood now

    * The first 32KB section is a table which I called chunkIndex table. It is arranged in 16x16x16 grid and consists of an int which is an index into the list of chunks and an int which is the chunk size in bytes. The ship origin will be in the middle of the grid and nonexistant chunks have an index of -1.
    Note: I found out that it\'s possible for the file to contain redundant/unused chunks which are not referenced by the index table
    * The second 32KB section is a table consisting of timestamps. It is also arranged in a 16x16x16 grid and is a long int in millisecond time format. Nonexistant chunks may have a 0 timestamp but I also found that empty chunks nearby to the ship are seemingly \"preallocated\" with a timestamp
     
    Joined
    Jun 25, 2013
    Messages
    403
    Reaction score
    11
    • Legacy Citizen 2
    • Legacy Citizen
    That must be for collision detection or some like. Beats my theory that they were thumbnail images. :) How very... Minecraft. They have timestamp tables much the same.

    Looks like the data can be re-created from the chunk data. So I\'m going to change my code to just throw it away.

    (Interestingly, the timestamp in the header is often different by a ms or two from the one in the chunk. That probably means they keep them separate in memory and update them each with their own call to System.curretTimeMillis(). Sloppy. Wish we had deobfusticated code and I could send them a fix!)

    My code is reading everything (except meta) fine now. I have unit tests that read all blueprints and also the objects in server-data. Looks like for large objects they have a file convention to cover things not in the address space. I\'m going to work on some higher-level constructs to grouping those together. Plus some routines to get arbitrary blocks in \"universal\" coordinates.

    If I have time after that, I was thinking of making a simple ship viewer applet. I\'m sure there must be people out there writing sites for people to publish and rate ships on. They would probably welcome an applet to let people \"preview\" ships...
     
    Joined
    Jun 25, 2013
    Messages
    403
    Reaction score
    11
    • Legacy Citizen 2
    • Legacy Citizen
    Did anyone notice the planet format is the same as the ship format? I found my ship-reading code was able to read planets just as well.

    Interesting possibilities. I know people have talked about an off-line ship editor. I\'m not convinced of the need for that. But an off-line planet editor... that could be useful. Pick a planet and turn it into an awesome base. I wonder if you put enough thrusters on it if you could turn a planet into a ship. :)

    Also, until we hack the planetary generation code, people can start writing planetary modifiers that can be later ported into planetary generators.
     
    Joined
    Jun 29, 2013
    Messages
    245
    Reaction score
    68
    • Legacy Citizen 2
    • Legacy Citizen
    Blueprint format needs to be redone. In particular, the price tag should be removed entirely, so a server calculates it on its own when it recieves the blueprint file. The way the file deals with docked ships and turrets could also use an improvement.
     
    Joined
    Jun 22, 2013
    Messages
    14
    Reaction score
    0
    • Legacy Citizen 2
    • Legacy Citizen
    I didn\'t see price stored anywhere in the .sment/files in the blueprint folder. It must be in the database where the ship descriptions/etc. are?
     
    Joined
    Jun 25, 2013
    Messages
    403
    Reaction score
    11
    • Legacy Citizen 2
    • Legacy Citizen
    So I\'m trying to update my viewer to handle wedges. I figured that orientation would be the key. It is, but for the life of me I can\'t work out what the values are. First I created a simple, ball like ship, pictured below. Then I dumped the orientation values. I got this:



    Z=6
    6: - - - - -
    7: - - 0 - -
    8: - 5 0 1 -
    9: - - 0 - -
    10: - - - - -
    Z=7
    6: - - 0 - -
    7: - 0 0 0 -
    8: 5 0 0 0 1
    9: - 0 0 0 -
    10: - - 0 - -
    Z=8
    6: - 6 0 2 -
    7: 6 2 0 0 2
    8: 0 0 0 0 0
    9: 2 0 0 0 6
    10: - 2 0 6 -
    Z=9
    6: - - 4 - -
    7: - 0 1 0 -
    8: 7 0 - 0 3
    9: - 6 0 0 -
    10: - - 4 - -
    Z=10
    6: - - - - -
    7: - - 4 - -
    8: - 7 - 3 -
    9: - - 4 - -
    10: - - - - -


    You can see there are wedges that are clearly pointing in different directions with different orientations.

    Thinking about it logically, there are only three bits, but there are many more orientations. A wedge can face 12 different ways. Oddly, when I use the editor in game, it seems to cycle through 16 shapes.

    I am completely confused...
     
    Joined
    Jun 22, 2013
    Messages
    14
    Reaction score
    0
    • Legacy Citizen 2
    • Legacy Citizen
    Looked at the code again and I think I was slightly off (again) about the bitfield of the blocks.

    Here it is again amended, let me know if this helps, and I will update the script as well.

    23-21 3 lower bits of orientation
    20 isActive or MSB of the orientation
    19-11 hitpoints
    10-0 blockID

    The isActive bit which seems to serve two purposes. Either an extra bit for orientation, or for blocks such as plexdoors or plexlights it stores the on/off state of the block.
     
    Joined
    Jun 25, 2013
    Messages
    403
    Reaction score
    11
    • Legacy Citizen 2
    • Legacy Citizen
    That did it. Oh, and the fact I was pulling the wrong bits anyway. >_<

    For reference, here are the orientation values for the above \"golf ball\" ship:

    Code:
    Z=6
     6:  -- -- -- -- --
     7:  -- --  4 -- --
     8:  -- 10  0  8 --
     9:  -- --  0 -- --
    10:  -- -- -- -- --
    Z=7
     6:  -- --  4 -- --
     7:  --  0  0  0 --
     8:  10  0  0  0 12
     9:  --  0  0  0 --
    10:  -- --  0 -- --
    Z=8
     6:  --  7  0  5 --
     7:   7  5  0  0  5
     8:   0  0  0  0  0
     9:   1  0  0  0  3
    10:  --  1  0  3 --
    Z=9
     6:  -- --  6 -- --
     7:  --  0  8  0 --
     8:  11  0 --  0 13
     9:  --  3  0  0 --
    10:  -- --  2 -- --
    Z=10
     6:  -- -- -- -- --
     7:  -- --  6 -- --
     8:  -- 11 -- 13 --
     9:  -- --  2 -- --
    10:  -- -- -- -- --
     
    Joined
    Jul 14, 2013
    Messages
    55
    Reaction score
    0
    if i gave one of you guys a ship bp could you turn the core around? i build a ship half way untill i realized the core was facing backwards
     
    Joined
    Jun 25, 2013
    Messages
    403
    Reaction score
    11
    • Legacy Citizen 2
    • Legacy Citizen
    Subscribe to the \"Offline Ship Viewer\" thread. Someone just requested the ability to move the core. I can probably do a rotate as well. I\'ll update there when I have it done.
     

    Vii

    Joined
    Jul 4, 2013
    Messages
    126
    Reaction score
    0
    • Legacy Citizen 2
    • Legacy Citizen
    I have the ability to take 3d models and voxelize them, like so, using 3ds Max and Rayfire voxelizer.




    The program allows me to export the voxels as a point cloud. Would it be possible to write something that can take one of these point clouds and turn it into a schematic? Preferably putting the core on the origin of the model
     
    Joined
    Jun 25, 2013
    Messages
    403
    Reaction score
    11
    • Legacy Citizen 2
    • Legacy Citizen
    I just added to my ship editor the ability to either rotate around the core or move it. Try it out!
     
    Joined
    Jun 25, 2013
    Messages
    403
    Reaction score
    11
    • Legacy Citizen 2
    • Legacy Citizen
    So I wrote a mod for my editor that would let you scale up an existing ship design. I double the standard Isanth and saved it. But when I read it into StarMade each 16x16x16 cube had been rotate 90 degrees.

    Any idea what\'s going on there? When I read and write it from my editor, it looks fine. If I was twisting the axis in the program, then I would expect to see it all messed up when I read it in.

    I noticed the .ent file contains some data. For example the bounding box. I\'m wondering if there is something in there that orientates individual cubes. Any thoughts?
     
    Joined
    Jan 22, 2014
    Messages
    1,047
    Reaction score
    299
    Does someone already know what has changed with the new file format? My script is throwing an exception because the ZLib header check on chunk inflation fails.
     
    Joined
    Jan 22, 2014
    Messages
    1,047
    Reaction score
    299
    At the beginning of each chunk there is a new byte which always seems to be 0xFF.

    I also believe to have found out the significance of the int at the beginning of each smd2 file (the wiki states \"unknown int\"). I believe it to be the version number of the file format. For the old files I tested, it was always 0, for the new ones it was 1.
     
    Joined
    Jun 29, 2013
    Messages
    144
    Reaction score
    64
    • Modder
    • Legacy Citizen 4
    • Purchased!
    I\'ve tested this new byte in SMDecoder.php and seams to works correctly, i\'ve tested this on 4 differents bp without anny kind of error.

    Thanks @der_scheme and good work