Skip to content

Palettes and Remaps

pchote edited this page May 3, 2011 · 15 revisions

OpenRA loads native ra/cnc palettes which are a list of 256 colors in a custom format (TODO: explain the color format).

Certain color indices have hard-coded meanings as transparent or shadow colors. Index 0 is mapped to transparent. If the Transparent flag (explained below) is true, indices 1 and 3 will be mapped to a light shadow color and index 4 to a darker shadow color.

Palette Traits

Palettes must be defined with a trait before they can be used ingame. The Name field is used both by internal palette lookups, and by custom palette overrides on unit Render* traits.

The following traits can be added to the World actor:

PaletteFromFile@chrome:
	Name: <string>                    # Internal palette name
	Filename: <string>                # Filename to load
	Tileset: <string, default null>   # If defined, load the palette only for this tileset
	Transparent: <bool, default true> # Map indices 1,3,4 to shadow if true

This is the most basic palette definition.

PaletteFromCurrentTileset:
	Name: <string>                    # Internal palette name
	Transparent: <bool, default true> # Map indices 1,3,4 to shadow if true

This trait loads the palette specified in the current tileset definition.

PaletteFromRGBA:
	Name: <string> # Internal palette name
	R: <0-255>     # Red color component
	G: <0-255>     # Green color component
	B: <0-255>     # Blue color component
	A: <0-255>     # Alpha color component

This trait creates a single color palette without any base palette file. This is used to define the palettes for iron curtain and low-power.

ShroudPalette:
	Name: <string> # Internal palette name
	IsFog: <bool>  # True for for, false for shroud

This trait adds the hard-coded fog and shroud palettes to the game.

Player color palettes

Player palettes work slightly differently to the other palette definitions. The PlayerColorPalette trait is added to the Player actor definition.

PlayerColorPalette:
	BasePalette: <string>                # The Name of the palette to base off
	BaseName: <string, default `player'> # The prefix for the resulting player palettes
	PaletteFormat: <enum: ra|cnc|d2k>    # Remap style, see below

This trait takes the specified base palette and remap style, and creates a palette for each player in the game using the color they chose in the lobby. Internally, each definition is mapped to N "normal" palettes named i where i is the player index from [0-N). Multiple per-player palettes can be defined by adding multiple PlayerColorPalette traits to the player actor.

OpenRA supports remappable ranges for player colors, supporting ra,cnc, and d2k style palettes.

  • ra: A ramp of 16 colors, starting at index 80
  • d2k: A ramp of 16 colors, starting at index 240
  • cnc: Two ramps of 8 colors each, starting at index 176. One ramp is used for buildings, the other for units.

Required palettes

TODO: give a list of palettes that the engine and/or core traits are hardcoded to reference - terrain, effect, shadow, player0-N, etc...

Specifying custom unit palettes

Actor rendering is handled by the family of the Render* traits. The behavior for specifying custom palettes is defined in the common base class to these traits, which means that it is the same for all of the Render* traits.

Render* will render the unit with the default player palette by default. This can be overridden with a custom player palette by adding a PlayerPalette override that gives the BaseName of the desired PlayerColorPalette.

Render*:
    PlayerPalette: <custom PlayerColorPalette BaseName>

If you want to disable player colors, you can also specify a static palette by overriding the Palette with the name of the palette to use.

Render*:
    Palette: <custom palette Name>

Palette Modifiers

TODO

Players ๐ŸŽฒ

Modders โœ๏ธ

Developers ๐Ÿ”ง

Clone this wiki locally