Skip to content

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:

textures.json

textures

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.

sprites

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]

blocks.json

blocks

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

subtypes

plant

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.json

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
Clone this wiki locally