When Pixel Vision 8 runs a game, each file is loaded in a specific order. Knowing this order is important to understand how a game’s data is parsed by the engine. Here are the steps that Pixel Vision 8 performs when loading a game’s files:
This file overrides any default chip settings before anything else is parsed.
All of the colors in this file will replace the default system colors.
This is stored in a temporary ColorChip and used instead of the system colors for parsing sprites, font, and tilemap PNG files.
This PNG file is cut up into 8x8 sprites based on the system colors or color map that was previously loaded.
tilemap.png or tilemap.json
This file can be a PNG or JSON. If both are present, the json file will be the one that is loaded. When parsing a PNG, you can set a flag that will add any tiles that are not found in the SpriteChip’s memory.
Each font PNG is cut up into 8x8 sprites and added to the SpriteChip’s memory if there is space. After each font is parsed, references to each character sprite are saved in the FontChip under the font file’s name minus the .font.png extension.
Each sound effect is parsed and stored in the sound chip.
The music file contains songs and patterns. Patterns are collections of sound effects the tracker plays in a specific order and frequency while the songs are collections of patterns.
This contains additional information about the game that is not used to configure any of the other parsers.
Once these files are loaded into memory, changes made to them will not be reflected in the game at run-time.
If your project has a
code.lua file, it will automatically be loaded as the main game script after the
data.json file has been parsed. Any additional
.lua files in your project will also be loaded but they are not parsed until you call
LoadScript(). This allows you to break your game’s logic up over multiple Lua files. See the section on using Shared Libraries to learn more about how this works.