Skip to content

JSON Content System

garrison hinson-hasty edited this page May 10, 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

Key Type Status Possible Values
name string required
path string optional, defaults to name path from assets/ without file ending
type string required sprite, texture, voxel, connected, sheet
transparent bool required, except for voxels and sprites*
sprite-type string optional, sprite only static, human; defaults to static
sprite-size v2i optional, sprite only size of sprite in its sheet, defaults to image size
anim-lengths int[] optional, sprite only lengths of each animation row, defaults to [1]

*voxels and sprites are never transparent.

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