The data.json file is perhaps the most important file in the load process. It contains all of the chips, a core component of the engine, which define the specs for configuring PV8 to play the game. Here is a breakdown of the main chips built into the engine:
Since the data.json contains information on which chips the system should use, as well as properties like the system colors, number of colors per sprite and more, this file defines how the actual engine and the rest of the files are loaded into memory.
Here is a sample of what a typical data.json file looks like:
Each block of data in the .json file defines a chip for the engine to initialize and its settings. Let’s take a look at the SpriteChipand how it gets serialized. The first line of the .json object is the engine’s qualified class name:
When this is parsed, an instance of this class is automatically created. Next are properties that can be configured on the chip. Only a handful of properties can be configured from the .json file. Here are the four main properties of the SpriteChip:
After the chip is serialized, the .json properties are passed to a special method that all chips share and the values for each property are set. In this chip, you can change the size of sprites system-wide, as well as the memory size where sprites are stored. By default, sprite RAM can store 32 columns and 32 rows of sprites for a total of 1,024 sprites.
While you can manually change values in this file, it’s best not to do so unless you know exactly what you are doing. The underlying engine that runs PV8 is incredibly open and allows for all kinds of customization. The Game Creator, however, has a lot of restrictions on top of it to better adhere to the predefined limitations of the fantasy consoles it attempts to emulate.
For example, changing the sprite widthand heightwill break the sprite parser and sprite tool inside the runner. However, you can increase the sprite RAM size by hand to something like 512x512 for 4,096 sprites. This doesn’t mean the tools will display all of these sprites accurately since they also have limitations around what can be displayed. Use caution when modifying this file.