-
Notifications
You must be signed in to change notification settings - Fork 0
JSON Content System
garrison hinson-hasty edited this page May 26, 2021
·
25 revisions
There's a lot of "stuff" that needs to be represented in the world, so having automatic content loading is super convenient. The content system loads data from JSON files in the assets folder, and saves them to be used and reused. It also tries to provide helpful messages when something is missing, it isn't perfect but will catch most common mistakes.
Each subheader below specifies the format of each object in its list within the JSON file:
Key | Type | Status | Possible Values |
---|---|---|---|
name |
string |
required | |
path |
string |
required | path from assets/ without file ending |
type |
string |
required | texture, voxel, connected, sheet |
transparent |
bool |
required, except for voxels* | |
connected-tags |
string[] |
optional | connected textured-blocks connect to blocks with shared tags |
*voxels are never transparent.
Key | Type | Status | Possible Values |
---|---|---|---|
name |
string |
required | |
path |
string |
required | path from assets/ without file ending |
type |
string |
optional | static, human; defaults to static |
size |
v2i |
optional | size of sprite in its sheet, defaults to image size |
offset |
v2i |
optional | offset of sprite drawing |
anim-lengths |
int[] |
optional | lengths of each animation row, defaults to [1]
|
Key | Type | Status | Possible Values |
---|---|---|---|
name |
string |
required | |
type |
string |
optional, defaults to stateless | stateless, plant |
texture |
string |
optional, defaults to name | texture name |
sheet cell |
v2i |
optional | initial sheet cell for sheet textures |
collision |
string |
optional, defaults to default | none, custom, default |
bbox |
bbox_t |
required for custom collision | [v3d position, v3d size] |
subtype |
string |
required for certain block types* | name of subtype |
*see subtypes below for which are required
Key | Type | Status | Possible Values |
---|---|---|---|
name |
string |
required | |
fullgrown |
int |
required | maximum growth value (number of textures - 1) |
growth-rate |
double |
required | growth delta per second |
fonts does not use a list, but a set number of fonts corresponding to font_e
(see fonts.h and fonts_load
in font.c)
Key | Type | Status | Possible Values |
---|---|---|---|
path |
string |
required | path to font sheet from assets/ |
char-size |
v2i |
required | size of one character |