Let's start with the first question posted.
are the hair and skin colors preset or are they also assigned by the game?
We made five presets for the skin colors and six for the hair color. Those are assigned to the closest matching color in the raws, for example dwarves with chestnut hair and brown hair take the same brown preset. Initially we wanted to assign the colors just by a color overlay using the actual colors values from the raw files, but a brown haired, brown skinned, brown beared dwarf turned out to be somewhat unreadable because of low contrast; while a alabaster-skinned, black haired, red-bearded dwarf would look comical at best.
The colors and which sprites are assigned can be decided by any modder or tileset-maker in the raws:
Here the difference between light brown stubble and dark brown stubble assignments, taken from graphics_creatures_layered.txt:
[LAYER:STUBBLE_LBROWN:DWARF_HAIR:5:0]
[CONDITION_TISSUE_LAYER:BY_CATEGORY:HEAD:HAIR]
[TISSUE_MIN_LENGTH:1]
[TISSUE_MAX_LENGTH:49]
[TISSUE_MAY_HAVE_COLOR:AMBER:AUBURN:BURNT_SIENNA:DARK_CHESTNUT:LIGHT_BROWN:OCHRE:PALE_BROWN:SEPIA:TAUPE_DARK:TAUPE_GRAY:TAUPE_MEDIUM]
[SHUT_OFF_IF_ITEM_PRESENT:BY_CATEGORY:HEAD:HELM:ITEM_HELM_SCARF_HEAD:ITEM_HELM_TURBAN:ITEM_HELM_HELM:ITEM_HELM_VEIL_HEAD:ITEM_HELM_HOOD]
[SHUT_OFF_IF_ITEM_PRESENT:BY_CATEGORY:BODY_UPPER:ARMOR:ITEM_ARMOR_CLOAK]
[LAYER:STUBBLE_DBROWN:DWARF_HAIR:6:0]
[CONDITION_TISSUE_LAYER:BY_CATEGORY:HEAD:HAIR]
[TISSUE_MIN_LENGTH:1]
[TISSUE_MAX_LENGTH:49]
[TISSUE_MAY_HAVE_COLOR:BROWN:BURNT_UMBER:CHOCOLATE:DARK_BROWN]
[SHUT_OFF_IF_ITEM_PRESENT:BY_CATEGORY:HEAD:HELM:ITEM_HELM_SCARF_HEAD:ITEM_HELM_TURBAN:ITEM_HELM_HELM:ITEM_HELM_VEIL_HEAD:ITEM_HELM_HOOD]
[SHUT_OFF_IF_ITEM_PRESENT:BY_CATEGORY:BODY_UPPER:ARMOR:ITEM_ARMOR_CLOAK]
As you can see it looks for the hair tissue color in the creature raws. It starts with LAYER:STUBBLE_LBROWN:DWARF_HAIR:5:0, so we are looking for very short light brown hair on dwarves, followed by the tile coordinates in the spritesheet, 5:0.
It has a condition: CONDITION_TISSUE_LAYER:BY_CATEGORY:HEAD:HAIR, aka the creature needs to have hair in the first place. If the dwarf is bald, it doesn't get a sprite. The other conditions are [TISSUE_MIN_LENGTH:1] to [TISSUE_MAX_LENGTH:49], which means that the hair has to be in this length range to count as "stubble". The final condition is the actual color, where we added the raw-defined colors that are closest to light brown: [TISSUE_MAY_HAVE_COLOR:AMBER:AUBURN:BURNT_SIENNA:DARK_CHESTNUT:LIGHT_BROWN:OCHRE:PALE_BROWN:SEPIA:TAUPE_DARK:TAUPE_GRAY:TAUPE_MEDIUM]
In theory you could split those up into one color each, as you like. Or add pink-haired dwarves. Or make only one hair color and ignore the raws and the extra work.
The last two lines are important to make hair look good with clothing: In case you are wearing helmets, the hair is not shown, since it would either be hidden anyway or the hair sprite would spill over the helmet sprite, which would look odd: [SHUT_OFF_IF_ITEM_PRESENT:BY_CATEGORY:HEAD:HELM:ITEM_HELM_SCARF_HEAD:ITEM_HELM_TURBAN:ITEM_HELM_HELM:ITEM_HELM_VEIL_HEAD:ITEM_HELM_HOOD]
[SHUT_OFF_IF_ITEM_PRESENT:BY_CATEGORY:BODY_UPPER:ARMOR:ITEM_ARMOR_CLOAK]
The spritesheet looks like this, except for a lot more hair styles in the end:
I will probably make a sheet with all raw-based colors down the line, just because I'm curious, even if it only ends up in my own private set.
Next question:
How does the top layers work? do they support opacity?
We haven't done much with top layers yet; those are for the end when we refine the look of the ingame objects. The code is written, works and we tested it on metal weapons. We split the spritesheet into a section that gets recolored based on the material color from the raws (like gold, silver, iron) and a part that always retains it's original color, copied on top. That layer supports opacity.
We also have a third file that's just the black outlines of the sprite for now, but technically it isn't needed. Just making extra sure that there is a strong contrast between item sprite and background sprites like floors, grass, etc.
The code looks like this:
[WEAPON_GRAPHICS:ITEM_WEAPON_CROSSBOW]
[WEAPON_GRAPHICS_DEFAULT:WEAPONS:0:6]
[WEAPON_GRAPHICS_MATERIAL:WEAPONS:0:6]
[WEAPON_GRAPHICS_WOOD:WEAPONS_WOOD:0:6]
[WEAPON_GRAPHICS_OUTLINE:WEAPONS_OUTLINE:0:6]
WEAPON_GRAPHICS_DEFAULT is the regular weapon sprite, if for some reason something doesn't use the material recolor. It would use the sprite as is.
WEAPON_GRAPHICS_MATERIAL is the sprite that gets recolored.
WEAPON_GRAPHICS_WOOD is the sprite that does not get recolored. Tarn called it wood because we tested it on the weapon shafts and grips, which look like wood. I assume the naming scheme might change later on.
WEAPON_GRAPHICS_OUTLINE is the black border around the sprite. Not sure if we keep it, because technically we could just use the WEAPON_GRAPHICS_WOOD sprite for that too.
Sprites would be in different sheets, but would look something like this:
General tile variation. To what extent does it apply? Terrain? Walls? Furniture?
We are currently using 4 variants for worldmap tiles, grasses, natural floors, natural walls, some furniture. Anything with a large surface area or anything that is being seen a lot in a fort. We want to make variants on furniture optional and/or selectable. Player should be able to easily cycle through a few looks for a bed or cabinet for example.
There aren't any clear rules for this yet since it's work in progress; making variants of sprites is not a high priority right now, it's more important to draw sprites for objects that don't have any yet.