World Constants - Kermalis/PokemonGameEngine GitHub Wiki

Overview

The WorldConstants.cs file contains a partial Overworld class and other world-related enums. It's used in the _build, MapEditor, and game, so changes are automatically shared between projects.

Overworld class

This class has constants for how many pixels are in a tile (width and height), how many tiles are in a block (width and height), the amount of elevations, the maximum amount of sub-layers, and the player and camera obj IDs.

Tiles - If you change how many pixels are in a tile, you will need to recreate the tilesets and blocksets because they will most likely break due to the tile ids shifting (and visually they'd be wrong if they didn't break.) It's very important that you keep the amount of pixels in each direction divisible by 2. They should not be 9, for example.

Blocks - If you change how many tiles are in a block, you will need to recreate the blocksets and layouts for the same reason as above.

Elevations - You can reduce the amount of elevations without anything breaking (other than layouts/blocks that use those elevations). If you want to raise the amount of elevations past 8, you'll need to edit the map editor and game to use ushorts (or whatever data type will support the amount of elevations) instead of bytes from the layout. You'll also need to update any byte usage inside Obj classes and functions in reference to the elevations bitfield (such as HasElevation() and GetLowestElevation() (in this file)). The elevation byte in the Obj position does not need to be raised from a byte because that's not a bitfield; it stores the current elevation of the Obj. If you increase or decrease the amount of elevations, you should add/remove elevation checkboxes from the map editor (in this file). Do not change the amount of elevations to 0.

Sub-Layers - You can reduce the amount of sub-layers without anything breaking (other than blocks that use those sub-layers). If you want to raise the maximum amount of sub-layers past 256, you'll need to edit the map editor and game to use ushorts (or whatever data type will support the amount of layers) instead of bytes from the layout. It's pretty simple actually, since you do not need to edit the map drawing code or anything else. Do not change the maximum amount of sub-layers to 0.

Player/Camera IDs - You can change these freely for now, but just make sure no script expects another Obj to have those IDs.