Blueprint File Format Metadata

From StarMade Wiki

Revision as of 02:33, 17 February 2017 by SgSkallagrim (talk | contribs)

meta.smbpm

A metafile can contain a huge abundance of information about a blueprint. Storage content, position and volume and shop prizes. Also wireless logic connections, transporter, jump drive/inhibitor, scanner, shipyard, warp gates, race gate positions and targets, information about power, shields, display content, some block amounts, AI configurations. Also location and rotation of docked entities and stuff that is yet unknown. The file is written using Big-endian.

Header of file

Purpose Data type
Version int32

Data

After the version comes a tag. There are 7 known tags that indicate how the bytes that come after them are read. The end of a file is reached if tag id '1' is read, or at the end of the tag id '2' data bytes. A version followed by a 1 byte is the shortest possible metadata file.

Purpose Data type
Tag byte
Tag Data
1 End of file
2 A collection of several Information. Is at the end of a metadata file and replaces tag '1'.
3 Position and orientation of entities docked to a Turret Docking Unit or Docking Module
4 Position and orientation of entities docked to a Rail and wireless connections
5 AI configuration, also contained in tag 2
6 Rail Docker position and orientation.
7 Storage/Factory block positions and their volume

Tag 2

A collection of several Information. Is at the end of a metadata file and replaces tag '1'. The tag byte is followed directly by a tag structure. A tag structure is defined by various tags that indicate a specific data structure. For example '-13'/'13' indicates a list of tag payloads. Here is a summary of one possibly structure:

       13: 'container'
       {
           -13: {}  // List of storage blocks and their contents
           3: 'shipMan0' 0,  // unknown
           -13: {-6: 50000.0, -6: 0.0, }  // Power, Aux Power
           6: 'sh' 1000.0,  // Shield
           -13: { }  // shop info for stations, an unknown int64 for ships
          -13: 'a' {}  // Unknown
           -13: {}  // position and content of Display Modules 
           -13: {}  //  A short list of block ids and their amount
           -1: 0,  // Warp gate info, unless it is a ship
           -13:
           {
              13: 'ACD' { }  // wireless logic
              13: 'TR' { }  // transporter
              13: 'A'  { }  // Turred Docker.            probably outdated since v0.1867
              13: 'A'  { }  // Entities docked to.   probably outdated since v0.1867
              13: 'J'  { }  // Jump Drive
              13: 'JP'  { }  // Jump Inhibitor
              13: 'SC'  { }  // Scanner
              13: 'SYRD' { }  // Shipyard
           }
          13: 'AIConfig1' {}  //  AI configuration, same as in tag '5'
         -13: { }  // unknown
         -1: 0,  // Race gate info, unless it is a ship
         -13: {}  // unknown
         -13: {}  // unknown
       }

Tag 3

This tag is followed by a list of information about docked entities.

Purpose Data type
Number of docked entities int32

Entity Position and orientation of entities docked to a Turret Docking Unit or Docking Module

Purpose Data type
String length int16
relative folder path String[length * char]
Position int32
Size [float, float, float]
Style int16
Orientation byte

Tag 4

Position and orientation of entities docked to a Rail and wireless connections

Tag 5

AI configuration, also contained in tag 2 This tag is followed by an integer indicating the byte size of the Tag structure after it.

Purpose Data type
Tag structure size int32
       13: 'AIConfig1'
       {
           -13:
           {
               -1: 1,
               -8: Ship,
           }
           -13:
           {
               -1: 2,
               -8: false,
           }
           -13:
           {
               -1: 0,
               -8: Any,
           }
       }

The tag structure contains three Tag payload lists. Each list starts with a byte representing:

Byte Meaning
0 Target
1 AI Type
2 Active

The byte is then followed by a string: AI types: "Ship", "Turret", "Fleet" Target: "Any", "Missiles", "Selected Target", "Astronauts"

Tag 6

Rail Docker position and orientation.

Purpose Data type
Number of Rail Docker entries int32

Rail Docker Position and orientation of Rail Docker blocks.

Purpose Data type
Position [int32, int32, int32]
Block id int16
Orientation 1 byte
Orientation 2 byte
Hit points byte

Tag 7

Storage/Factory block positions and their volume

Purpose Data type
Position int64
Volume Double

The (x, y, z) position is encoded into the int64 value. The bits 0-15 are x, 16-31 is y and 32-47 is z. Bit 48 to 63 are always 0.