Latest Posts

AboutColors

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) should 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 a single "Player Color" material of a light neutral hue (like white) assigned to certain objects or vertex groups on the unit. When the unit's pic or animation frames are rendered, a python script is available to simultaneously generate a mask for each rendered frame to identify the playercolor areas or objects within the frame. The mask image file has the same name as the image file but with "_pc" at the end of its name. (Example: the Player Color mask file for idle_00.png would be named idle_00_pc.png) When Widelands draws now a unit for a specific player, it will replace the masked area(s) in the image(s) with the correct color for the player.

When an animation comes with a bunch of .png files and a bunch of _pc.png files Widelands will figure out automatically that those have player colors. If there are no _pc.png files, it is assumed that the animation has no player colors.

Tagged with: Development, help