[NEWBIE] Is It Possible? (Inter-species, Gender-drops, independent variants?)

Started by Implekins, July 23, 2017, 10:13:10 PM

Previous topic - Next topic

Implekins

Disclaimer: I have little to no previous knowledge of coding.  I do not know if I will get anywhere with these ideas, but it never hurts to ask.  And it might provide some ideas to other modders as well.

1) I'm curious as to whether or not it's presently possible to implement the ability for animals to inter-breed between species, such as rabbits x elephants, or even mechanoids x pawns. Or would it require a rewrite of a mass of code?

2) Is it possible for drops to be limited to a specific gender of an animal? 
Example: A male deer may drop antlers, whereas a female would not.

3) Is it possible to "randomize" the coloring of an animal's base color and "markings" separately? 
I have not looked at any code, I've only looked at the images presently available to me.  So any "knowledge" I have of the current workings is speculation.  So, based off my current observations, and if I'm correct...

Within the original game's textures, Boomalopes have a base sprite. (Direct link in case below image does not load.)  They also have a secondary sprite "map" in red and black. (Link)


And, also based off a mod (currently known as Animal Collab Proj) that adds creatures with variants: The sheep sprites (link) contain a black-and-red "map." (link

It also appears as though they are given colors to spawn with: (240, 240, 240) is a white color, (64, 64, 64) is a nearly black color, and (129, 100, 78) is a brown color, within a text file.

Would it be possible to create an additional sprite map? For example, the Boomalope's sacs, such as this: (Link)


And therefore, would it be possible to provide it with separate color-codes so that the body will spawn in colors independent from the sac's colors?

Of course, this is all based off the fact that my speculation is correct.  If I'm incorrect, then my theorizing would be painfully flawed...  Regardless: would this be of any possibility?  To be able to spawn an animal with independently-colored body parts as variants?  Or would I simply have to custom-color the sprites?

dburgdorf

I haven't done much with the animal code, but so far as I'm aware:

1) No. You could certainly create a new type of animal and call it a cross-breed of species X and species Y, but there's no way within current game mechanics to actually have different species cross-breed.

2) I could be wrong, but I'm fairly sure that vanilla code already has gender-locked drops, specifically antlers.

3) I don't believe so. The red/black images you're looking at are, as you surmised, masks that determine which parts of the base graphic are and are not altered by the color applied. But I don't believe there's any mechanism available to allow for multiple masks to be separately applied to the same image.
- Rainbeau Flambe (aka Darryl Burgdorf) -
Old. Short. Grumpy. Bearded. "Yeah, I'm a dorf."



Buy me a Dr Pepper?

kaptain_kavern

2) I can confirm this one. Have a look at XML code for the elephant in Core. You'll find all the XML tag you'll need.

Like dburgdorf just explained more than half of what you're dreaming of is not easily feasible at all (sorry). Except creating lots of new animals that you'll define as inter-breed species, but I can't see an easy way to emulate genetics or at least heredity and such.

The only thing I've seen that is a little bit on par with what you explained is in Animal Collab Project. They have a custom DLL/assembly that permit animals to have their textures picked randomly from a pool of textures. To have several textures for one species.

_______________________________

To "help" you visualise a bit more about difficulty in RW modding :

Adding a modified version of something (item,mechanics, thought, animals, factions) that is already in the game is, most of the time, on the easy side. Because mostly it will involve a bit of XML (and XML is a human readable "data storage" langage)
Adding completely new things will, most of the time, require C# (voodoo to me :p)

jamaicancastle

Quote from: dburgdorf on July 24, 2017, 10:25:00 AM
I haven't done much with the animal code, but so far as I'm aware:
3) I don't believe so. The red/black images you're looking at are, as you surmised, masks that determine which parts of the base graphic are and are not altered by the color applied. But I don't believe there's any mechanism available to allow for multiple masks to be separately applied to the same image.

It is possible to have a mask with two color channels in RW (the second channel uses green rather than red). They're then assigned in code using "color" and "colorTwo". You can see how this works with the different mineable materials (compacted steel, components, etc.). However I can't promise that it will work on animals, nor that it can be used with a color generator like your sheep example.

AngleWyrm


The More Monster Girls mod (A17 version here) adds a variety of creatures to the game, which might be a fun starting point from which to experiment with cross-breeding and genetics.

Maybe breeding a forest fairy with a pawn results in a half-elf, and two half-elves might produce another half-elf or a pawn or a full elf. And a half-elf breeding with a pawn would produce either a pawn or another half-elf. Similar with an elf breeding with a half-elf, either an elf or a half-elf. and for an elf breeding with a pawn, a half-elf.

It would require artwork and design for both half-elf and full elf.

Are you an artist?
My 5-point rating system: Yay, Kay, Meh, Erm, Bleh

AngleWyrm


Nice! That's a great looking horse.

The mod Children & Pregnancy does some coding specific to pawn pregnancy and birth. To include a wider spread of breed-ables could be done by adapting that approach to a more general case.

The do lovin' act could have a check for viable pregnancies, and if the result is an implemented creature then there's a chance of getting the pregnant health condition. There's a father & mother involved and tracked, so at the time of birth the type of child born could be determined by parents.
My 5-point rating system: Yay, Kay, Meh, Erm, Bleh

AngleWyrm


Here's a layout of an approach to crossbreeding that can be read from and updated in xml files and patches. The basic information stored is {Father, Mother, Offspring, (Chances) } where chances are optional and defaults to one chance.

The Father, Mother and Offspring would be the PawnKind, and there could be multiple entries for any given pair. To extend the elf example: There could be multiple outcomes of a male forest fairy breeding with a female human; maybe it usually results in a half-elf, but could also produce a human or a fairy. And further, a female human could carry these results but a fairy could only bear another fairy offspring because of size.
<Defs>
    <CrossBreed> // Fairy-Human ==> HalfElf
        <Father>Fairy</Father>
        <Mother>Human</Mother>
        <Offspring>HalfElf<Offspring>
        <Chances>3</Chances> // three outcomes out of however many of this pairing are in the set of all crossbreeds are HalfElf
    </CrossBreed>

    <CrossBreed> // Fairy-Human ==> Human
        <Father>Fairy</Father>
        <Mother>Human</Mother>
        <Offspring>Human</Offspring>
    </CrossBreed>

    <CrossBreed> // Fairy-Human ==> Fairy
        <Father>Fairy</Father>
        <Mother>Human</Mother>
        <Offspring>Fairy</Offspring>
    </CrossBreed>

    <CrossBreed> // Human-Fairy ==> Fairy
        <Father>Human</Father>
        <Mother>Fairy</Mother>
        <Offspring>Fairy</Offspring>
    <CrossBreed>


This might be further refined to reduce search lengths for the sake of other mods that aren't generally looking for crossbreeding data by enclosing the list of CrossBreed items in an additional container such as

<Defs>
   <CrossBreedsList>
      <CrossBreed />
      <CrossBreed />
        ...
      <CrossBreed />
    </CrossBreedsList>
</Defs>
My 5-point rating system: Yay, Kay, Meh, Erm, Bleh