Skip to content

OpenRCT2 JSON Sprite File

zrowny edited this page May 26, 2021 · 2 revisions

OpenRCT2 JSON Sprite File Description

When building OpenRCT2, one of the resources that is compiled is g2.dat. This is a sprite file, analogous to g1.dat that comes with vanilla RCT2. OpenRCT2's command line is actually used for building this file. See the page on the sprite compiler for details about its use. It uses a JSON file as a description of the sprite file it's building. The JSON file consists of an array of image entries that will be included in the sprite file.

Image Entries

*items* : object

An image entry in the sprite file

path : string : required
The relative path to this image.
x_offset : integer
The relative horizontal offset of this image. Defaults to 0.
y_offset : integer
The relative vertical offset of this image. Defaults to 0.
palette : string
If set to "keep", OpenRCT2 will assume this image is indexed with the correct palette, and will just import the palette indices directly.
forceBMP : boolean
If true, this tells OpenRCT2 that this image should be stored in a raw format instead of being run-length encoded (RLE). Requires "palette" to be set as well.

Example

Excerpt from sprites.json, used to build g2.dat

[
    ...
    {
        "path": "font/cyrillic/U1084-tiny.png",
        "y_offset": 1,
        "palette": "keep",
        "forceBmp": true
    },
    {
        "path": "font/cyrillic/U1085-tiny.png",
        "y_offset": 2,
        "palette": "keep",
        "forceBmp": true
    },
    ...
    {
        "path": "track/rmc/small_turn_left_bank_to_gentle_up_2_1.png",
        "x_offset": -28,
        "y_offset": -39,
        "palette": "keep"
    },
    {
        "path": "track/rmc/small_turn_left_bank_to_gentle_up_2_2.png",
        "x_offset": -28,
        "y_offset": -39,
        "palette": "keep"
    }
    ...
]