- Let the record show that I have the worst ways to relieve my boredom.
- Values are in big-endian/Motorola order.
An item starts with a type identifier. These are:
1 Null 2 A 64-bit double-precision float value 3 A boolean value 4 An integer value 5 A text string 6 An array or list 7 An object or map
A double is in the usual industry standard format.
2 400921FB544117444716 3.1415927
A boolean item is followed by a single byte. If that byte equals zero, the value is false. Anything else means true
3 0 false 3 1 true
- An integer is in a variable-length encoded format, like a MIDI delta time, or a UTF-8 character. The most significant bit of a given part indicates if there's another to follow. Numbers can run up to 10 parts long, which comes out to a 64-bit value.
- Signed numbers have the sign bit moved from the most to the least-significant bit for storage.
- Variable-length integers that signify the length of a string or the amount of items in an array or object are always unsigned. Values are always signed.
A text string is encoded as a variable-length integer that counts the amount of characters, followed by that many characters.
5 13 Hello, world!
An array is encoded as a variable-length integer that counts the amount of items in the array, followed by that many items.
6 2 item 0 item 1
An object is like an array, but each item is preceded by a text string representing that item's key.
7 2 key 0 item 0 key 1 item 1
- There is always a single root item. This will usually be an object.
Starbound data files start with an identifying header,
SBVJ01, which stands for Starbound Versioned JSON, version 1, followed by an identifier text string. After the identifier there's a bool to indicate if the data is versioned. If true, there's a 32-bit version number (not variable-length), followed by the root item. The offsets in the table assume the files are indeed versioned. (thanks to kyren for clearing that up.)
File Identifier Data start *.player PlayerEntity 0x18 *.metadata PlayerMetadata 0x1A *.clientcontext ClientContext 0x19 universe.dat UniverseSettings 0x1C
- Shipworlds, chunks, and worlds are a different beast entirely.