-
Notifications
You must be signed in to change notification settings - Fork 1
Palettes and Remaps
OpenRA loads native RA/CnC palettes which are a list of 256 colors in the Westwood PAL format.
Certain color indices have hard-coded meanings as transparent or shadow colors. Index 0 is always mapped to transparent. The color (index) that is mapped to transparency can be custom defined in system.yaml
.
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. This is the most basic palette definition:
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
ShadowIndex: <list of integers> # Map listed indices to shadow
RA/CnC ShadowIndex is both at 4, the color does not matter as it is replaced by the engine. 3 is used by the GPS dots that were introduced in OpenRA.
ShadowIndex: <integer>
The index that is mapped to a transparent shadow can also be defined in cursors.yaml
:
PaletteFromCurrentTileset:
Name: <string> # Internal palette name
ShadowIndex: <list of integers> # Map listed indices to shadow
The PaletteFromCurrentTileset
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
The PaletteFromRGBA
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
The ShroudPalette
adds the hard-coded fog and shroud palettes to the game.
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
RemapIndex: <list of integers> # Remap indices, see below
This trait takes the specified base palette and remap index. It 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 that can be defined RemapIndex with .
-
ra: A ramp of 16 colors, starting at index 80 (default):
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95
-
d2k: A reversed ramp of 16 colors, starting at index 255:
255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240
-
cnc: Two ramps of 8 colors each, starting at index 176:
176, 178, 180, 182, 184, 186, 189, 191, 177, 179, 181, 183, 185, 187, 188, 190
-
terrain
is used as a basis for the player palette (requires remapping) -
player
is the default name for the remapped player color palette -
chrome
is used for icons -
effect
is used for explosions, bullet traces, etc. -
shadow
is a transparent grey color for shadows (airplanes, buildings) -
cloak
is the color seen by the owner of invisible units -
invuln
is the color used for the iron curtain in RA -
disabled
is the color buildings that are powered down
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>
World:
WaterPaletteRotation:
will add rotating blue pixels starting at Base: 96
(RA) and Base: 32
(CnC) for beaches and waterfalls.
World:
LightPaletteRotator:
uses the same mechanism to have blinking dots on the RA radar building.