GSoC 2020: Genome Expansion |Wrapping up

Vedant Shroff
6 min readAug 28, 2020

--

Overview

For the last 3 months, I worked as a student developer for The Terasology Foundation, on my project ‘Genome Expansion’. The project was based on a game called Terasology, an open-source voxel-based world. Originally created as an open-source rendition of Minecraft written in Java, Terasology is a moddable and beautiful game that runs on its own engine with many different gameplay flavors.

A screenshot from Terasology highlighting the ‘god rays’

Project Summary

‘Genome Expansion’ was primarily concerned with adding integrations between existing modules, by adding and modifying content in Genomes and integrating it with WildAnimals and SimpleFarming, which are modules that add animals to the world and allow the planting and harvesting of wild bushes and seeds found around the world respectively. Adding Genes to plants and animals allows for a wide range of possibilities in the world since it creates variations in the otherwise simple and identical seeds. Once genetics are added to the seeds they can be modified in multiple ways by influencing different traits like the color, growth rate, filling(hunger restoration), etc. The module ‘Genomes’ already existed within Terasology but it was not in a state to be integrated with other modules since it was outdated and not maintained. Genomes was also missing key features that would allow it to be easily integrated with other modules. Apart from improving the Genomes module and integrating it with SimpleFarming, I also worked on adding a feature to breed seeds. The seeds can be bred to get more desirable genetics and hence, better plants. Cooking recipes that use these seeds were also modified to create better/worse products based on the genetics of the ingredients. After the completion of my project, adding new traits and such integrations has become a very easy process that has been documented and hence, easy to follow.

Work Completed

Following are the key goals I accomplished across the different work periods :

  • Genomes — New breeding algorithms for Discrete and Continuous traits were added. These breeding algorithms allow the addition of different kinds of traits to seeds and allow different breeding algorithms for different traits. The breeding mechanism was changed completely so that the genetic makeup of an organism no longer has to have a single breeding algorithm, but rather each trait can have its own type.
  • Integrating Genomes with SimpleFarming — Bushes that are used by SimpleFarming will now add Genes to the seeds when they are harvested. These genes are seed-based random values that can be used to affect different traits like the Filling of the seed/The growth rate of the bush when planted, etc. These genes persist across generations of the seed bush cycles.
  • Breeding — New recipes for breeding seeds were added. This allows for seeds with differing genetic makeup to be bred to produce a more desirable seed with better genes. The output is also tinted based on its genes and filling values.
The UI for breeding seeds
  • ModifiableValue type — Added a new DataType to the Terasology engine called ‘ModifiableValue’ which can be used to modify data stored in entity components without modifying the base value of the component, but rather adding modifiers which then create the correct result based on a formula. This is a versatile type that can be used throughout Terasology and is not limited to just one module.
  • Modifying the filling value of seeds — The filling value of the seeds will now be affected by the genes of the seed when harvested. These values are a continuous random value that are generated from the genes and used to create a modifier for the filling value which leads to more desirable varieties of seeds. In incorporating this feature, a workflow was followed which can be followed for adding other such traits with ease.
  • Tinting seeds — Seeds that are harvested from bushes now get a tint to their color based on the filling value. This serves as a visual representation for the filling obtained and the rarity of the seed. The tints are divided into categories based on their filling values. These categories can be used for other purposes like a selective variety of recipes in cooking.
A gold-tinted apple, the best possible variety
  • Cooking — Added a modifier to cooking which modifies the filling value of the cooked product based on the modified filling values of the input items. This worked well with the modified filling values generated via genes.
  • WildAnimals — Animals can now be bred with genetics again, this follows on a GSoC project from 2018 which added the module ‘WildAnimalsGenome’. The animals are bred via a Monoploid breeding algorithm and the speed of the child animal is determined after running the algorithm on the genes of the parent animals. Currently the only animal present in this module is a Deer, but adding new animals and new traits to them is a much easier task.
A baby deer with its parents
  • Existing modules using Genomes were all fixed to use the new Genome changes and are now in a working state.

Since no real implementation of Genomes existed, an approach of Test-Driven development was followed. Unit tests using JUnit 5 were written to replicate the intended behavior of the systems and development of the modules followed. Apart from the mentioned changes, countless hours of debugging and multiple minor changes to the engine as well as bug fixes and additions to the engine were done along the way. A detailed summary of my weekly progress as well as interaction with my mentors can be found on my Terasology forum thread. Listed below are all the pull requests made by me that were merged during GSoC 2020.

- https://github.com/Terasology/Genome/pull/10
- https://github.com/Terasology/Genome/pull/11
- https://github.com/Terasology/Genome/pull/12
- https://github.com/Terasology/Genome/pull/14
- https://github.com/Terasology/Genome/pull/15
- https://github.com/Terasology/SimpleFarming/pull/93
- https://github.com/Terasology/SimpleFarming/pull/94
- https://github.com/Terasology/SimpleFarming/pull/95
- https://github.com/Terasology/EdibleFlora/pull/6
- https://github.com/Terasology/EdibleFlora/pull/7
- https://github.com/Terasology/EdibleFlora/pull/8
- https://github.com/MovingBlocks/Terasology/pull/3858
- https://github.com/MovingBlocks/Terasology/pull/3904
- https://github.com/MovingBlocks/Terasology/pull/4060
- https://github.com/Terasology/EdibleSubstance/pull/4
- https://github.com/Terasology/Hunger/pull/20
- https://github.com/Terasology/Health/pull/38
- https://github.com/Terasology/BasicCrafting/pull/3
- https://github.com/Terasology/Cooking/pull/153
- https://github.com/Terasology/WildAnimalsGenome/pull/6

Apart from these PRs, issues have been created for certain stretch goals and reviews/merges were also made. A link to a set of intsructions to play or test my additions can be found here.

Conclusion

To conclude, I would like to thank everyone at The Terasology Foundation for helping me throughout the project duration and offering constant support and advice along every step of the way. The team was very welcoming and happy to answer any questions I had along with a lot of help with debugging and setting up workspaces. I would also like to give a special thanks to my mentors and other staff members that helped me through the proposal phase and found me worthy to be selected for GSoC 2020. My experience at the Terasology Foundation has been amazing and I learned so much along the way. I intend on contributing to Terasology for as long as I can after having such an awesome time working on this amazing game.

--

--