World of Banished

MODS Garage => Tips and Help => Topic started by: Verteiron on December 08, 2014, 08:39:59 PM

Title: Looking for detailed info on adding citizen textures (long post)
Post by: Verteiron on December 08, 2014, 08:39:59 PM
My Diversity mod changes the skin color of Citizens. It has some limitations, though, and I'd like to overcome them.

Ideally I'd like to have the Citizens pass their skin color to their children. Unfortunately, there doesn't seem to be a way to influence newly-created citizens, so I'd be happy with citizens having with a random skin color and keeping it through their lifespan.

Citizens are (randomly?) assigned one of 8 textures present in in either MaleCitizen.png or FemaleCitizen.png. This includes both skin and clothing, so if I just included different skin tones in that file, each race would always be wearing the same set of clothes. I need to find some way to get citizens using more than 8 textures, but this is turning out to be way harder than I imagined.

Citizens (and Nomads) use OpaqueCharacterMaterial.rsc to assign their textures, and they are the only models that do so. OpaqueCharacterMaterial extends the VertexProgram vs from OpaqueSkinMaterial.rsc with the following line:

outputTexcoord.x = (outputTexcoord.x + localToWorld[3][3]) / 8.0;

This is what divides the texture into 8 parts. If I double the width of (Fe)MaleCitizen.png, add 8 more textures to it, and increase this divisor to 16.0, the textures get applied properly, but only up to 8. Anything right of the halfway mark is completely ignored.  >:(

Since the "only use up to 8 textures" behavior seems immutable, I've tried any number of other increasingly desperate methods to get around it, all to no avail. These include:


I'm on the verge of giving up on this idea, really, but I want to make sure this is really as hard as it seems. I need to be able to do any one of the following:

If anyone can help me with any of this, or come up with some more creative (or simpler!) method of accomplishing this, please let me know, as this has been driving me mad for days!

ps - While I'm at it, I'd also like to know if it's possible to store arbitrary data (like, say, a race or skin color flag) in a Citizen. Oh, and a pony.
Title: Re: Looking for detailed info on adding citizen textures (long post)
Post by: Verteiron on December 17, 2014, 07:47:58 PM
Just to save everyone else the headache: I actually got a response from the dev about this. He says that the game is hardcoded to only use 8 textures, so I guess that's pretty much that.

I thought I was making some headway by introducing random selections into the programmable shader, but I can still not get more than 8 total, so... guess I'll just release a version of Diversity with everyone's clothes and skin color-coded.