Difference between revisions of "Blueprint File Format Logic"

From StarMade Wiki
(Created page with "=logic.smbpl = The logic file contains logic links between modules. ==Header of file== {| class="wikitable" ! Purpose !! Data type |- | Version || int32 |- | Controller Vers...")
 
m
 
Line 49: Line 49:
 
| Position || [int16, int16, int16, ]
 
| Position || [int16, int16, int16, ]
 
|}
 
|}
 +
 +
==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].
 +
 +
===smbpl.bt===
 +
<pre>
 +
//--------------------------------------
 +
//--- 010 Editor v6.0 Binary Template
 +
//
 +
// File: smbpl.bt
 +
// Revision: v0.199.435
 +
// Purpose: StarMade Blueprint Logic file
 +
//--------------------------------------
 +
 +
struct Vector3s
 +
{
 +
    short x;
 +
    short y;
 +
    short z;
 +
};
 +
 +
typedef struct
 +
{
 +
    short blockId;
 +
    int numBlocks;
 +
    Vector3s blockPositions[numBlocks];
 +
} ControllerGroup <optimize=false>;
 +
 +
typedef struct
 +
{
 +
    Vector3s controllerPosition;
 +
    int numGroups;
 +
    ControllerGroup groups[numGroups];
 +
} ControllerEntity <optimize=false>;
 +
 +
typedef struct
 +
{
 +
    int version;
 +
    int controllerVersion;  //  A number smaller than -1024.
 +
    int numControllers;
 +
    ControllerEntity entities[numControllers];
 +
} ControllerMap <optimize=false>;
 +
 +
ControllerMap controllerMap;
 +
</pre>

Latest revision as of 11:41, 17 February 2017

logic.smbpl

The logic file contains logic links between modules.

Header of file

Purpose Data type
Version int32
Controller Version int32

The 'Controller Version' will not exist in old logic files.
If this value is read and is positive, then the 'number of controllers' value was read, not the 'Controller Version'.
The 'Controller Version' is always negative.
If 'Controller Version' does not exist or is between -1024 <= x < 0 all positions are relative to a core/center at (8, 8, 8).
A value lower than -1024 means positions are relative to a core/center at (16, 16, 16).

The following description is only right for files where a 'Controller Version' does not exist or is lower than -1024.

Purpose Data type
Number of controller entries int32

Controller entry

Purpose Data type
Position [int16, int16, int16, ]
Number of group entries int32

Group entry

Purpose Data type
Block Id int16
Number of position entries int32

Position entry

Purpose Data type
Position [int16, int16, int16, ]

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.

smbpl.bt

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

struct Vector3s
{
    short x;
    short y;
    short z;
};

typedef struct
{
    short blockId;
    int numBlocks;
    Vector3s blockPositions[numBlocks];
} ControllerGroup <optimize=false>;

typedef struct
{
    Vector3s controllerPosition;
    int numGroups;
    ControllerGroup groups[numGroups];
} ControllerEntity <optimize=false>;

typedef struct
{
    int version;
    int controllerVersion;  //  A number smaller than -1024.
    int numControllers;
    ControllerEntity entities[numControllers];
} ControllerMap <optimize=false>;

ControllerMap controllerMap;