Difference between revisions of "Blueprint File Format Header"

From StarMade Wiki
m (Statistic)
m
Line 131: Line 131:
 
| Mining || double || 1
 
| Mining || double || 1
 
|}
 
|}
 +
 +
==Additional Resources==
 +
In order to assist developers, the following files are provided to help understand and work with blueprint files.
 +
 +
===010 Editor===
 +
The following *.bt files are format definitions for the [http://www.sweetscape.com/010editor 010 Hex Editor].
 +
 +
===smbph.bt===
 +
<pre>
 +
//--------------------------------------
 +
//--- 010 Editor v6.0 Binary Template
 +
//
 +
// File: smbph.bt
 +
// Revision: v0.199.435
 +
// Purpose: StarMade Blueprint Header file
 +
//--------------------------------------
 +
 +
struct Vector3f
 +
{
 +
    float x;
 +
    float y;
 +
    float z;
 +
};
 +
 +
enum <unsigned int> EntityType
 +
{
 +
    Ship = 0,
 +
    Shop = 1,
 +
    SpaceStatiion = 2,
 +
    Asteroid = 3,
 +
    Managed Asteroid = 4,
 +
    Planet = 5
 +
};
 +
 +
enum <unsigned int> ClassificationType
 +
{
 +
    General = 0,
 +
    Mining = 1,
 +
    Support = 2,
 +
    Cargo = 3,
 +
    Attack = 4,
 +
    Defense = 5,
 +
    Carrier = 6,
 +
    Scout = 7,
 +
    Scavenger = 8,
 +
    General = 9,
 +
    Shipyard = 10,
 +
    Outpost = 11,
 +
    Defense = 12,
 +
    Mining = 13,
 +
    Factory = 14,
 +
    Trade = 15,
 +
    Warp_Gate = 16,
 +
    Shopping = 17,
 +
    General = 18,
 +
    General = 19,
 +
    General = 20,
 +
    General = 21,
 +
    General = 22,
 +
};
 +
 +
typedef struct
 +
{
 +
    Vector3f min;
 +
    Vector3f max;
 +
} BoundingBox;
 +
 +
typedef struct
 +
{
 +
    short blockId;
 +
    int blockCount;
 +
} Element;
 +
 +
typedef struct
 +
{
 +
    int numElements;
 +
    Element elements[numElements];
 +
} ElementCountMap;
 +
 +
typedef struct
 +
{
 +
    int16 version;
 +
    double offensive0;
 +
    double defensive;
 +
    double power;
 +
    double mobility;
 +
    double danger;
 +
    double survivability;
 +
    double offensive1;
 +
    double support;
 +
    double mining;
 +
} Statistic;
 +
 +
typedef struct
 +
{
 +
    int version;
 +
    EntityType entityType;
 +
    ClassificationType classificationType;
 +
    BoundingBox boundingBox;
 +
    ElementCountMap elementCountMap;
 +
    byte hasStatistics;
 +
    Statistic statistic;
 +
} Header;
 +
 +
Header header;
 +
</pre>

Revision as of 11:33, 17 February 2017

header.smbph

A file that contains information about entity type/class, followed by its boundary around the blueprint. After that, the amount of blocks are listed. Ships also have statistics at the end of the file. Docked entities have their own header file and have no influence on the main entity header file. This file is written using Big-endian.

Header of file

Purpose Data type Version
Version int32 0
Entity type int32 0
Entity classification int32 3
Box min [float, float, float] 0
Box max [float, float, float] 0

Entity type

Name Id
Ship 0
Shop 1
Space Station 2
Asteroid 3
Managed Asteroid 4
Planet 5

Entity classification

Entity Id Name
Ship 0 General
1 Mining
2 Support
3 Cargo
4 Attack
5 Defence
6 Carrier
7 Scout
8 Scavenger
Space Station 9 General
10 Shipyard
11 Outpost
12 Defense
13 Mining
14 Factory
15 Trade
16 Warp Gate
17 Shopping
Asteroid 18 General
Managed Asteroid 19 General
Planet 20 General
Shop 21 General

Block quantities

Purpose Data type Version
Number of entries int32 0
Entry[Block id, Quantity] [int16, int32] 0

Statistic

Statistics were added with version 1 of the 'header.smbph'.

Purpose Data type Version
Has statistic Boolean (byte) 1

Statistic data

Only ships have this section!

Purpose Data type Statistic version
Statistic version int16 0
Offensive 1 double 0
Defensive double 0
Power double 0
Mobility double 0
Danger double 0
Survivability double 0
Offensive 2 double 0
Support double 0
Mining double 1

Additional Resources

In order to assist developers, the following files are provided to help understand and work with blueprint files.

010 Editor

The following *.bt files are format definitions for the 010 Hex Editor.

smbph.bt

//--------------------------------------
//--- 010 Editor v6.0 Binary Template
//
// File: smbph.bt
// Revision: v0.199.435
// Purpose: StarMade Blueprint Header file
//--------------------------------------

struct Vector3f
{
    float x;
    float y;
    float z;
};

enum <unsigned int> EntityType
{
    Ship = 0,
    Shop = 1,
    SpaceStatiion = 2,
    Asteroid = 3,
    Managed Asteroid = 4,
    Planet = 5
};

enum <unsigned int> ClassificationType
{
    General = 0,
    Mining = 1,
    Support = 2,
    Cargo = 3,
    Attack = 4,
    Defense = 5,
    Carrier = 6,
    Scout = 7,
    Scavenger = 8,
    General = 9,
    Shipyard = 10,
    Outpost = 11,
    Defense = 12,
    Mining = 13,
    Factory = 14,
    Trade = 15,
    Warp_Gate = 16,
    Shopping = 17,
    General = 18,
    General = 19,
    General = 20,
    General = 21,
    General = 22,
};

typedef struct
{
    Vector3f min;
    Vector3f max;
} BoundingBox;

typedef struct
{
    short blockId;
    int blockCount;
} Element;

typedef struct
{
    int numElements;
    Element elements[numElements];
} ElementCountMap;

typedef struct
{
    int16 version; 
    double offensive0;
    double defensive;
    double power;
    double mobility;
    double danger;
    double survivability;
    double offensive1;
    double support;
    double mining;
} Statistic;

typedef struct
{
    int version; 
    EntityType entityType;
    ClassificationType classificationType;
    BoundingBox boundingBox;
    ElementCountMap elementCountMap;
    byte hasStatistics;
    Statistic statistic;
} Header;

Header header;