Thursday 27 June 2019

Genetics Development - Day 6 - Adding to the Genetics and Breaking IT ALL!

So, after ending Day 5 with the basics of inheritance of both sex, and wing type figured out, the models displaying correctly and everything working exactly as I would like, it is now time to try and expand it to include a 'sex-linked' inheritance pattern, white eyes.

Of course, doing this breaks EVERYTHING!!! OK, well not everything, but the basic premise of the whole system I have in place is now untenable. I believe this is because I have the sex type calling a particular geometry by using 'minecraft:variant', and wing type calling a particular texture by using 'minecraft:mark_variant', which leaves me no way to call another texture 'automatically' through this entity.

I can get the white eyes to appear on the fly through external editing, and the inheritance appears to work find on the genotypes of the offspring, but I cannot get it to display the correct phenotype, because it gets 'normal wings' texture before it gets the 'white eyes' texture. Basically it get's a 'mark_variant' for normal wings, because that is what it has, and that doesn't then get overwritten by the white eyes 'mark_variant'.

Now I have figured out the issue, what is the resolution? After quite a few hours fiddling around and trying to understand, I think I need to, somehow, give particular variants, and mark_variants based on the multiple separate genes I have. Each gene marks a 'birth_event' which I then use to add component groups to the flies, which in the past was assigning the variants and mark_variant data.

The first step I have taken is to make all 'geometry' alterations, so that is sex, and vestigial wing type (and later curly wings too) based on variant, and all textures based on mark_variant. This means quite a bit of explicitness in the entity definition and a whole heap of individual textures for each possible phenotype, which I was trying to avoid in some respects, but looks like the entity definition file in the behaviour pack is going to be as large as it needs to be!

Next steps? I have quite a a few options to explore for day 7 and beyond, and they are as follows;

  • Use scripts and custom variables to control and assign the appropriate data to the flies.
  • Use family tags at birth, to then assign the specific variant and mark variants.
  • Use 'materials' as the third 'data change' in the render controller.
  • Use a 'villager' style system to assign different geometries and textures as they assign different professions in the vanilla game.
  • Use 'masked' textures (again as they do in villagers) to 'overlay' multiple parts of the flies.
I think the most likely option for me to initially explore is the 'materials' method, and making the eyes a 'material' that I can alter based on genetics. Second to that will likely be a combination of the masked textures and the villager professions.

There are of course pros and cons in each, and in reality what I want to do may be more readily accessible in the API, so when I have some brain power, I am going to head down the path of exploring that, but I am also really enjoying exploring and I am learning a lot about how entities work in Minecraft, which I am thinking will be beneficial in a lot of future projects too.

But, that is where I finish day 6, a little further along, but also taking a significant step backwards. One thing that has crossed my mind, is to completely separate the different inheritance patterns, and realistically that would work quite well, as in have a "drosophila v" for vestigial, and "drosophila we" for white eyes, which would definitely work, but I am interested in seeing whether I can combine multiple inheritance patterns and weave them into some semblance of correct genetics for this organism.

No comments:

Post a Comment