Palette Swapping

Hi all, just a status update on what we’ve been up to.

Recently, we’ve been working on palette swapping for all the assets! This is necessary as, in multiplayer, more than one player can be playing with any given faction.

Palette swapping might be the oldest trick in the book, but in a modern game it actually involves a little bit of art workflow and pipeline changes. This is because the game is not limited to 256 colours, and because of how modern graphics hardware works.

The process is:

  1. Every unit is drawn using the “red team” colour palette. This palette includes three ranges, a “faction colour” range (which is red), a “skintone” range, and a “fixed colours range”.

    A small fragment of the Wargroove palette.
    A small fragment of the Wargroove palette.
  2. Every asset produced by an artist goes through a converter that looks up all the 32-bit RGBA colours in the palette, and outputs a greyscale image, where the intensity of each pixel represents the index of that pixel in the palette. This is done automatically as part of building the game. On the example below, the bright red tones are represented by the third entry in the palette (counting from zero, that means that it has index 2), so it gets stored in the image as a tone of grey with intensity of “2”, or #020202.

    They greyscale image represents the indices of the unique colours in the image.
  3. When drawing on the screen, for each greyscale pixel, the shader looks up the corresponding colour on the palette image, adjusting for the current palette swap parameters (unit faction colour and skin tone, for example). On the example below, #020202 (index 2) becomes one tone of blue, and #040404 (index 4) becomes a darker tone of blue.

    Colours on the greyscale image have been adjusted for readability.

This saves us a lot of video memory and bandwidth, and allows us to have units with different team palettes and skin colours at no extra work per unit.

A few of the Cherrystone Kingdom skintones.

Each faction in the game will have its default colour (for example, the Cherrystone Kingdom is red), but you’ll be able to override the colours in a multiplayer match. We’re also investigating providing “colour blind friendly” palettes, which would override how you see all colours, to make them more easily distinguishable.

Want to hear more about how things work behind-the-scenes? Let us know in the forum!