Terasology / SimpleFarming

Easy to understand growing of foods
11 stars 27 forks source link

Variation through Genetics #46

Open mjuvekar7 opened 7 years ago

mjuvekar7 commented 7 years ago

I am writing this post to suggest a neat new feature that could be added to this module: the addition of variety through simple genetics.

Currently, plants in the SimpleFarming module have very fixed properties that do not change much when new plants are grown. This can be improved by using simple genetics to produce variety in various properties of plants. The resultant genetic system could be used to create hybrids of various seeds, breed animals (when animals are added), etc.

Each seed (and thus each plant) should have a certain "genome" component, which has binary properties which can be one of two variants: one dominant and one recessive (somewhat like real life genetics). These traits will define hereditary features of the plant like color, height (tall/short), thickness (thick/thin), etc. Many of these properties may not seem binary, but once you know whether a tree is tall or short, you can add some noise to a pre-defined height corresponding to "tall" to get a unique-ish height. This could be further improved by adding support for continuous traits represented by floating point numbers (see Genetic Algorithms).

A system must also be created which will be able to take two genome components and create a hybrid from them. The basic outline of this process is to cross the two components using a Punett Square or something similar to find all possible outcomes with appropriate weights, and then to pick a random outcome from the weighted list. This system can lead to interesting gameplay options, such as creating hybrid seeds which have good traits of different kinds of seeds, and thus produce better stuff (see Hybrid Seeds).

Note that the mechanism for this already exists in a more abstract and general manner in the Genome module, which provides an infrastructure to create genes and cross them using different breeding algorithms. In fact, since the Genome module already contains a lot of the mechanism required to implement this system, it may make sense to extend the Genome module into a more specific system instead, and then use it to implement genetic variation in the SimpleFarming module.

This could also be extended to an animal husbandry module which could then be used to make interesting hybrid animals such as sheep which yield more wool of a desired color, or maybe cows which produce more milk and give more leather. The possibilities are nearly endless.

mjuvekar7 commented 7 years ago

Please do leave your suggestions in the comments :) @Cervator I believe you were interested in this.

Cervator commented 7 years ago

Yep! This sounds good to me :-)

We probably need to get food consumption fixed, that way one initial target could be how "filling" produce from a plant is. Easy value to vary.

jdrueckert commented 4 years ago

@vedant-shroff Mind updating this according to the progress achieved in your GSoC project?

vedant-shroff commented 4 years ago

https://github.com/Terasology/SimpleFarming/issues/82#issuecomment-702274894 has a summary of what I have added to integrate SimpleFarming with Genomes. The new integrations can be used easily to allow traits to be passed on from parents to offsprings and has been done successfully with bushes and seeds. This has also been done in WildAnimalsGenome which is now up to date with the latest version of Genomes, and adding new traits should be an easy procedure.