itch.io is community of indie game creators and players

Devlogs

Tilengine 2.13 with per-tile palette selector

Tilengine
A downloadable tool for Windows and Linux

Per-tile palette selector

Tilengine 2.13 introduces a feature common to all 8/16-bit era video chipsets: the ability to set an individual palette on each tile of the tilemap.

This feature doesn't break any compatibility, as the standard per-tileset and per-layer palette schemes continues working without changes. But now, each tile descriptor adds three palette selector bits, which add the ability to set one of the new eight global palettes on that specific tile. These global palettes can be set with the API function TLN_SetGlobalPalette(int index, TLN_Palette palette). By default global palettes are not set, so the renderer ignores the palette selector bits and defaults to the layer or tileset palette. But once the corresponding global palette is set, it takes precedence and the renderer picks this one.

This is how actual 2D graphics work: there's no concept of tileset or layer palette. Insetad there's a fixed number of hardware palettes of 16 colors each. Sega Master System has 2, Sega MegaDrive/Genesis has 4, Super Nintendo has 8... And each tile of the tilemap can select which palette is using. This allows to create colour variations of the same tileset, and show more than 16 colors onscreen. Tilengine doesn't have this limitation as its palettes can have up to 256 colors each, but this new feature brings a closer approach on how these systems actually work.

Base tileset in plain green:

Main layer in Tiled using the base tileset

Palette-selector layer superimposed. Tile indexes in this layer are used to set the palette selector bits in tiles on main layer

Final output. Observe how colous in some tiles are changed respect to the base tileset colour according to the palette selector layer



New getters

Additionally, this release adds various getters to retrieve the current position of layers and sprites:

  • TLN_GetSpriteX() and TLN_GetSpriteY() to get position of a sprite
  • TLN_GetLsyerX() and TLN_GetLayerY() to get postion of a background layer

Files

  • Linux ARMv7l (Raspberry Pi, BeagleBone...) 403 kB
    Nov 12, 2022
  • Linux Desktop 32-bit 420 kB
    Nov 12, 2022
  • Linux Desktop 64-bit 415 kB
    Nov 12, 2022
  • Windows 32-bit 479 kB
    Nov 12, 2022
  • Windows 64-bit 501 kB
    Nov 12, 2022
Download Tilengine
Read comments (2)