Made some progress on the cell / tile / terrain definition mix-up that I inherited from Hibernator. Following this convention now:

  • cells are the raw integer values taken from map data. On their own, they map to whichever tileset is associated with the map, left-to-right, top-to-bottom. Within Lua and LÖVE, they are one-indexed, and everywhere else (Tiled, GraphicsGale), they are zero-indexed.
  • Tilesets contain a sparse array of tile_defs, which represent additional handling data for a tile, including a string referring to what kind of terrain it’s supposed to be (along with the animation info I threw in earlier).
  • terrain_defs are tables of key-value pairs that describe how higher-level game logic should treat a particular tile, such as whether it’s intended to be an obstacle to the player.

Cells are just integer numbers, tile_defs are per-tileset, and terrain_defs are project-wide.

If you’re curious, here’s the Hibernator terrain mapping. This was annoying but generally livable, since the game only had a single tileset, and I could cross-reference it using the grid snap mode in GraphicsGale. But it was holding things back quite a bit in the current project.

The tile ID values mapped to the following:

1 = default
2 = empty
3 = solid
4 = hazard_passable
5 = hazard_impassable
6 = ladder
7 = water

During development, I used the “1-8?” blocks to keep track of how many jump power-ups were necessary to travel through various routes of the map. The “default” and “empty” terrains being effectively the same but technically different caused some subtle bugs at times.