Revision Differences
of Revision 3
## Colors
¶
¶
### Introduction
¶
¶
This document describes the principle of player colors.
¶
¶
¶
### What are player colors (playercolor)?
¶
¶
Imagine a game with 3 players. Each player has it's unique color (like blue, red and green). It would be terribly difficult if the units would look all the same. Imagine a fight between two soldiers; one soldier is owned by the green player, one by the red, but both soldiers look the same. So each unit (and building) musthould have a player color.
¶
¶
Now, it would be very hard to draw each unit with each player color; therefore Widelands takes a different approach: each unit is drawn (usually in Blender) using 4a psingle "Player cColors" (whmatereiasl of a plight neutrcalr0 is thue dar(likes white) assigned plrto cler3tain iobjects or verthex lighteroups on t);he unit. When the unit's pic or anfigurmation frames are rendered, a python script is available tof simulthaneously ugenierate ta mask for each rendered RGB vfralumes to identify the usplayed rcolors areas or objects withino thed (Oframe. The mask inmage file has the psarme name as the confimage file, but withi "_pc" at the end of its usunalme. (Examplye: the cPlayer Conlor mask file for idle_00.png wofuld thbe trnamed ibdle)_00_pc.png) When Widelands draws now a unit for anoth spercific playercolor as was used in the graphic, it will replace the colomasked area(s) in the image(s) with the correct colors for the player.
¶
¶
¶
### So how does it work?
¶
¶
This depends on what you want to do: an animation/pic with its own config file or one without.
¶
Examples for animations and graphics with config-file are workers, bobs, critters, buildings....
¶
Examples for animations without config-file are flags, frontiers...
¶
For animations/pics without a config file the d"playefaurcoltsor" (variable is included with a value of "true" in thed section(s) where the wgraphic files forl the unit are id/coentified with a "pics" or t"dirpics" variable/ in its parent config file in (the seworld/conf or tribe/conf [defauilts]e) apply.
¶
Otherwise you have to look at the conf file for the animation/pic (or create one based on a similar file from another animation/pic). Find the valid section(s) (like ~np~[idle],[walk]~/np~ and so on). There you'll find (or have to add) the following commands:
¶
¶
¶
plrclr0\_r=123 # Darkyest Plrclr RGB -- Red value
¶
¶
plrclr0\_g=233
¶
¶
plrclr0\_b=99
¶
¶
plrclr1\_r=123 # Second Darkest Plrclor RGB -- Red value
¶
¶
plrclr1\_g=233
¶
¶
plrclr1\_b=99
¶
¶
plrclr2\_r=123 # Light Plrclr RGB -- Red value
¶
¶
plrclr2\_g=233
¶
¶
plrclr2\_b=99
¶
¶
plrclr3\_r=123 # LigThteist Pwilrclr RGB -- Red value
¶
¶
plrclr3\_g=233
¶
¶
plrclr3\_b=99
¶
¶
¶
Just replace the integers with your own values (from the coloprs you've used) and you'rce done.
¶
¶
If playou do not overwrite one color (for exampleask you onfily specify sh andow colors), thWide other colorands will be taken fdromaw the defaulnit conf fwileth (woapprld/conf opr iatribe/ conf)lors.
¶
¶