Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Genome Integrations #82

Open
4 tasks
mjuvekar7 opened this issue Jan 30, 2018 · 7 comments
Open
4 tasks

Genome Integrations #82

mjuvekar7 opened this issue Jan 30, 2018 · 7 comments

Comments

@mjuvekar7
Copy link
Contributor

mjuvekar7 commented Jan 30, 2018

Now that we have a rudimentary Genome module more or less in place, we should start working on integrating Genome into SimpleFarming.

A high-level description of this integration and its goals can be found in #46. Note, however, that some aspects of that issue may be outdated. #57 aims at getting started with this integration, but needs a major rework due to the recent refactor (in my opinion, we should just close it and start from scratch, reusing code from it where possible).

This issue aims at proposing a rough series of small goals leading to a complete, functioning implementation.

  • Implement simple color variation in plants/bushes. There should be a way to specify two variants for a plant. The plant's gene sequence should contain two genes each of which can encode one of the two variants. One variant is dominant, while the other is recessive, and thus the color of the plant can be determined by simple dominance.
  • Create a "seed mixer" which allows you to cross seeds from two different plants (a similar item was implemented in Implemented Genetics in blueberry bush. #57; code could be reused from there). We might want this to be in another module, perhaps EdibleFlora, to comply with the refactor (consult @jellysnake).
  • Integrate SimpleFarming and Genome with the Hunger module, so that the "filling" factor of fruits can be determined and varied genetically. Partially implemented in Implemented Genetics in blueberry bush. #57.
  • Implement genetic mutations in a meaningful way.

Edit: Some specific details, as discussed with @jellysnake

  1. Changes to SimpleFarming:
    • Create new event called beforeProduceCreated
    • Fire this event whenever a new seed/plant item is created (or any other situation where a GenomeComponent should be added to some entity)
    • Note that SimpleFarming does not need to have Genome dependency
  2. Changes to EdibleFlora:
    • Create a GenomeAuthoritySystem which is active only when Genome is enabled
    • Listen for the beforeProduceCreated event in this system, and add the necessary GenomeComponents to the appropriate entities when such an event is received.
    • Create a seed mixer which applies appropriate BreedingAlgorithms to mix two seeds to give one daughter seed.
  3. Define effects of genes on specific traits (eg color) in the appropriate class(es)
@syntaxi
Copy link
Member

syntaxi commented Jan 31, 2018

I'm going to be discussing this in the context of Edible Flora because that's the module that actually holds the content.

I can see using Genome to provide great depth to EF. Currently there is a basic progression system where you can craft together some seeds to get more advanced seeds. I'm thinking we could have a system that still implements this by default but then also includes method of breeding should Genome be activated.

This is what I'm thinking:

Keep the default the same as it currently is, however move the recipes from In Hand to a block (there is already one in place).

If Genome is enabled then keep the recipes the same, however make it only produce a new seed randomly. If a new seed isn't produced its a even chance for another of the same type as the inputs.

Implement Genome breeding mechanics on a number of different options. Food, Thirst, Color, Growth Rate and Number of Produce. Perhaps even on it being Sustainable.

@Cervator
Copy link
Member

Cervator commented Feb 2, 2018

Maybe another thing to vary could be biome / environmental conditions the thing can thrive in. Such as developing a cold-hardy variety of wheat that'll still grow in colder climates.

If we do more advanced/detailed biomes where they have gradients by the edges where one biome turns into another you could start out with a crop only growing well in the center of a biome but keep breeding it nearer and nearer to the edge and only select seeds from plants that do well -> you've developed a new variant. In that case you wouldn't even need a manual seed mixer process, if you rely on random mutations and select for desired traits.

I would consider that fairly advanced and long term however, need more advanced plants and such in the first place :-)

@mjuvekar7
Copy link
Contributor Author

@jellysnake I don't understand the stuff after "This is what I'm thinking:" and before "Implement Genome breeding..."

@mjuvekar7
Copy link
Contributor Author

So you mean to say that the seed mixer thing should be in EF? (Could work)
What I have in mind for the seed mixer is:

  1. The player inputs 2 seeds into the mixer
  2. The mixer extracts the GenomeComponents of each seed
  3. The mixer creates a daughter GenomeComponent by crossing the 2 seeds using BreedingAlgorithms specified in the Genome metadata.
  4. A new seed is contained identical to the parents. The GenomeComponent formed in (3) is attached.
  5. Destroy parent seeds, output new seed.

@syntaxi
Copy link
Member

syntaxi commented Feb 2, 2018

So the way the farming family (Simple Farming, Edible Flora, Additional Vegetables & Additional Fruits) is structured is thus.

Simple Farming provides the system. It's not explicitly tied to Edible Flora, it /just/ provides the framework
Edible Flora provides the content. It uses Simple Farming as well as Hunger and Thirst.
Additional Fruits/Vegetables provides more content for Edible Flora. They are optional and used for people who want a richer and more expanded gameplay

Therefore if we want to add Genome to the content, it sits at the Edible Flora level because it's a system. This is why I'm wanting to reduce the impact on Simple Farming as much as possible.
So the seed mixer would exist in Edible Flora, the specific details of how the breeding works should be handled by Genome, only an interface should exist in Edible Flora.

What I mean by "the default" is the way Edible Flora currently works. I would also want to keep Edible Flora the same if the player doesn't activate Genome, only if it is activated do the advanced features emerge.

@jdrueckert
Copy link
Member

@vedant-shroff Mind updating this according to your progress during GSoC? 🙃

@vedant-shroff
Copy link
Contributor

So I have addressed most of the points mentioned in this issue as well as in #46 in my GSoC project, Genome Expansion. Although some discussion in this issue suggests adding genetics to edible flora, it was decided, after much back and forth, that the genetics would sit at the SimpleFarming level instead, so as to avoid re-writing code for other content modules (Like AdditionalFruits and so on). Genomes is now an optional dependency of SimpleFarming, and if genomes is activated, seeds can be bred with genetics. This builds upon the work done by @arpan98 in #57 but reworks a lot of things done there. A GenomeAuthoritySystem handles all the genetics related tasks and is optionally activated based on the modules selected.
Currently, the filling trait of seeds is affected by the genes they have. The genes are given to seeds when they are harvested for the first time and it is carried on for all the generations of that seed. The filling value is altered based on the genes that can be checked by the heldGenomeCheck or visually observed by a tint added to the seed based on the filling value. Three different varieties of tints are possible, thus creating different types of seeds that can be obtained. The tinting is done via an optional dependency on SubstanceMatters and therefore can be toggled by just deactivating the module.
The systems for adding new traits and genes to seeds are all in place and therefore adding new features should be an easy process now with a sort of template that can be followed. Genomes depends upon the content modules optionally, for example Genomes will depend upon thirst optionally if it is to modify the thirst value of a plant, and a system can be added to Genomes to modify this thirst with the corresponding handlers. More immediate scope for the genome integrations are regarding the varying growth rates of bushes based on the preferred biome of the seed (like @Cervator suggested above)
The seeds are bred in the SeedWorkstation that is present in EdibleFlora. New recipes were added to the block, but this is only a temporary solution and it is desirable at some point to take these recipes out of the SeedWorkstation and add them to another independent block. There is some work on a new crafting module which will allow dragging and dropping ingredients into input slots. This new crafting module would be a much more desirable to create the seed breeder in. Also, Genomes was changed a bit to allow registering breeding algorithms per trait rather than for an entire group, and therefore more complex variations are possible in seeds with different continuous and discrete traits. Mutation is only a random value right now and has not been played with much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants