Skip to content

Compare: Palettes and Remaps

New page
Showing with 881 additions and 747 deletions.
  1. +2 −11 Compiling.textile
  2. +25 −0 Dedicated-old.md
  3. +0 −25 Dedicated.md
  4. +10 −10 FAQ.md
  5. +13 −0 Game-Content.textile
  6. +1 −1 Game-Translation-(Spanish).md
  7. +4 −45 Hacky-AI.md
  8. +1 −2 Home.textile
  9. +18 −0 Installation.md
  10. +0 −10 Installation.textile
  11. +105 −0 Mapping-modding-Ideas.md
  12. +141 −435 Mapping.md
  13. +32 −33 Modding-Guide.md
  14. +37 −20 Palettes-and-Remaps.md
  15. +120 −128 Pixelart.md
  16. +3 −6 Playing-the-game.md
  17. +1 −1 Playtest-or-Release-Checklist.md
  18. +2 −3 Random-Snippets.md
  19. +9 −8 Settings.md
  20. +350 −0 The-New-Player's-Guide-to-OpenRA.md
  21. +7 −9 Trait-Documentation.md
57 changes: 37 additions & 20 deletions Palettes-and-Remaps.md
@@ -1,27 +1,30 @@
TODO: This is not hardcoded anymore since playtest-20120630-2.
OpenRA loads native RA/CnC palettes which are a list of 256 colors in the [Westwood PAL format](http://freecnc.org/dev/pal-format/).

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 always mapped to transparent. The color (index) that is mapped to transparency can be custom defined in `system.yaml`.

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:
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
Transparent: <bool, default true> # Map indices 1,3,4 to shadow if true
ShadowIndex: <list of integers> # Map listed indices to shadow

This is the most basic palette definition.
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.

The index that is mapped to a transparent shadow can also be defined in `cursors.yaml`:

ShadowIndex: <integer>

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

This trait loads the palette specified in the current tileset definition.
The `PaletteFromCurrentTileset` trait loads the palette specified in the current tileset definition.

PaletteFromRGBA:
Name: <string> # Internal palette name
Expand All @@ -30,33 +33,41 @@ This trait loads the palette specified in the current tileset definition.
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.
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

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

The `ShroudPalette` 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.
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
RemapIndex: <list of integers> # Remap indices, 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 <BaseName>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.
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 <BaseName>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.
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`

* ra: A ramp of 16 colors, starting at index 80
* d2k: A ramp of 16 colors, starting at index 240, and reversed wrt ra ramp.
* cnc: Two ramps of 8 colors each, starting at index 176.

### 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...
* `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


### Using custom 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.
Expand All @@ -73,5 +84,11 @@ If you want to disable player colors, you can also specify a static palette by o


### Palette Modifiers
World:
WaterPaletteRotation:
will add rotating blue pixels starting at `Base: 96` (RA) and `Base: 32` (CnC) for beaches and waterfalls.

World:
LightPaletteRotator:

TODO
uses the same mechanism to have blinking dots on the RA radar building.