Are randomized textures possible?

Started by Ekksu, February 12, 2017, 04:03:55 PM

Previous topic - Next topic

Ekksu

Is it possible to have random textures for animals or items? Like, if I fill a folder with a bunch of different textures, is there a way to just point the game towards the folder and have it pick a random set of textures?

Thirite

You can set a random texture for simple objects- I believe that's how stone chunks select what texture to use. But for animals you'd have to write a class for its graphics set which gives the rendering methods a specific set of pawn graphics from a list of possible ones. The random graphic given would have to be somehow saved to the pawn so that it didn't just select a new one each time the graphics are resolved/game reloads.

Ekksu

Ah, shoot, there goes my dreams of random rabbit and cat textures :T

But thank you!! I'll just hafta make a few new species to get all the cute textures.

Thirite

I wouldn't throw out the idea so quickly. From a design standpoint it would be a much better solution than different raceDefs for different breeds of the same species. I'll look into a solution.

Ekksu

Aaah, thank you!! I'm just not very good at coding, so idk where I would even start with C# or anything beyond minor xml tuning. I'm sure I can probably figure it out if I know what to do, though!

zeidrich

Quote from: Thirite on February 12, 2017, 04:14:58 PM
You can set a random texture for simple objects- I believe that's how stone chunks select what texture to use. But for animals you'd have to write a class for its graphics set which gives the rendering methods a specific set of pawn graphics from a list of possible ones. The random graphic given would have to be somehow saved to the pawn so that it didn't just select a new one each time the graphics are resolved/game reloads.

Instead of saving the graphic to the pawn, you could do something like determine the texture procedurally using the thingIDNumber as the seed. This would mean additional data wouldn't need to be saved for the pawns.

Thirite

I've actually been making a framework to allow variable animal texture sets and winter coats for the Community Animal Project (Animals+). It just works as a class inheriting from the base Pawn to have extended functionality. It's pretty neat though; I've defined a custom XML file that can be used to list all possible variant skins- whether it uses a different texture set, different colour modulation, shader, and even the rarity of that skin. It's admittedly buggy and unfinished right now, but you'll be able to see it in action soon™.

WalkingProblem

Quote from: Thirite on February 24, 2017, 06:08:56 PM
I've actually been making a framework to allow variable animal texture sets and winter coats for the Community Animal Project (Animals+). It just works as a class inheriting from the base Pawn to have extended functionality. It's pretty neat though; I've defined a custom XML file that can be used to list all possible variant skins- whether it uses a different texture set, different colour modulation, shader, and even the rarity of that skin. It's admittedly buggy and unfinished right now, but you'll be able to see it in action soon™.

I'm waiting for it!

Need it for my Minions Mod~ =D