Color-coded NPCs for Retrodays tileset based on hostility/friendliness

Quick representation done in of what it could look like. Green NPCs are followers, Blue NPCs are neutral, red NPCS are hostile and trying to kill you

Could the Retrodays tileset get color-coded NPCs(Based on hostility/friendliness)? When playing without tilesets, the NPCs are all color-coded based on if they’re neutral, following you, or trying to kill you. Its a shame that Retrodays doesn’t have that.

Generic color coding would be unlikely to happen since tilesets don’t support coloring without replacing the entire tile.

Having an overlay icon for effects and hostility would be pretty easy to write.

Overlays would work perfectly, because you’d just draw the npc in a new color and it would work. At least in this kind of tileset! Another thing would be to give NPCs random colors, and you’d remember more or less what color your peeps were. It’s doable in the tilese really easily with random tiles, though it’s not what you asked for!

I would love to be able to do overlays for effects, like drunk and sleeping, and hostility. In fact, I made an issue about it.

But there is no way to do it right now, I don’t think. Randomly assigned tiles, sure, but not based on hostility as the code stands right now.

The simplest way (no positioning, just binary “has overlay x/doesn’t have x”) to add effect/attitude overlays is actually pretty trivial to code. The code for it would be barely above copy+paste and changing 2-3 strings.
The biggest problem here is getting two people with tiles builds - one to write it, other (with merge rights) to test it. I don’t play with tiles and don’t have the necessary setup on Windows (I’m currently on Windows because I couldn’t get my Ubuntu LTS to stop kernel panicking randomly).

In case anyone is interested in coding this:

In player.cpp, there if player::get_overlay_ids().
In this function, overlay strings are generated from mutations, worn items and wielded weapon.
Adding effects to it would require iterating over “effects” map (a field in Creature class) and adding effect ids with some prepended string.
For example, it could be done like:

for( const auto &eff_pr : effects ) {
    rval.push_back( "effect_" + eff_pr.first.str() );

And that’s it for effects. It would be really simple, would have order scrambled if a new effect was added and would have unpredictable ordering, but it would be enough to have effect overlays.
Similar for attitude:

if( is_npc() ) {
    switch( attitude_to( g->u ) ) {
        case A_HOSTILE:
            rval.push_back( "attitude_hostile" );
        case A_NEUTRAL:
            rval.push_back( "attitude_neutral" );
        case A_FRIENDLY:
            rval.push_back( "attitude_friendly" );
        case A_ANY:
            debugmsg( "Invalid attitude for %s", disp_name().c_str() );

It would be easy to improve on it by adding some effect ordering (to keep it from getting scrambled), either by first inserting the effect ids into an ordered map (alphanumeric ordering) or by adding an order field to effects and copying the solution for ordered mutation overlays.
It would also be possible to add custom overlays for effects on particular body parts (ie. infected left arm) with a minor change to the code above, but I’m not sure if it’s worth having an extra tile for every effect-bodypart combo.

One thing that may actually be necessary would be adding visibility field (boolean - you can’t see parasites in the guts, but can see bleeding) to effects to prevent them from leaking information not available to players otherwise. But that’s also easy.