Biome Specific Content Enhancements for Terasology
Final Report - GSoC 2020
In this post I aim to summarize all of the work I have done during the past months in the GSoC coding period.
The aim of the project was to introduce some Biome-Specific Content to Terasology. These content enhancements were made basically in the form of impacts of a biome’s characteristics on the player. The two main biomes focused upon for the task were the Desert and the Snow biomes owing to the extreme nature of climatic conditions in these biomes.
The Journey
The project started out by implementing some extreme effects that the player would have to deal with traversing these biomes. These effects were implemented following Terasology’s “Event-Component-System” (ECS) approach. For a start these effects were implemented in a test “danger zone” and were later shifted to their appropriate places of action.
Extreme Climate Effects
The effects in the Snow biome were attributed to the extremely low probable body temperatures of the player when in Snow and hence were named Hypothermia Effects.
- Visible Breath Particle Effect
- Movement and Jump Speed Reductions
- Frostbite periodic damage and stun
The effects in Desert were attributed to the extremely high probable body temperature of the player when in Desert and hence were named Hyperthermia Effects.
- Increased Thirst Decay
- Movement and Jump Speed Reductions
- Player Weakness due to heat
A list of PRs implementing these effects -
https://github.com/Terasology/ClimateConditions/pull/8
https://github.com/Terasology/ClimateConditions/pull/9
https://github.com/Terasology/ClimateConditions/pull/10
https://github.com/Terasology/ClimateConditions/pull/11
https://github.com/Terasology/ClimateConditions/pull/12
https://github.com/Terasology/ClimateConditions/pull/15
https://github.com/Terasology/ClimateConditions/pull/19
https://github.com/Terasology/ClimateConditions/pull/20
https://github.com/Terasology/ClimateConditions/pull/22
While implementing these effects a lot of other related issues were found/ fixed/ implemented and some new features were added. Some of these include adding new AffectThirst and AffectHunger events which are sent out by their respective systems and can be used by by other modules to modify them:
https://github.com/Terasology/Thirst/pull/16
https://github.com/Terasology/Hunger/pull/19
https://github.com/Terasology/Thirst/pull/17
Added a new event and system in the Health module which makes use of events to change max Health and supports changing the maximum number of Health bar UI icons displayed when max Health is modified.
https://github.com/Terasology/Health/pull/45
https://github.com/MovingBlocks/Terasology/pull/4058
https://github.com/Terasology/Health/pull/46
https://github.com/Terasology/Health/pull/47
Items to Overcome Extreme Climatic Effects
Next task taken upon was adding items to overcome these obstacles. The items include wool vest, arabic thawb, sand slippers and waterskin.
This involved creating item prefabs, adding drops to animals like sheep, deer, etc for raw materials, adding crafting recipes for these items.
https://github.com/Terasology/ManualLabor/pull/30
https://github.com/Terasology/WildAnimals/pull/56
https://github.com/Terasology/ManualLabor/pull/34
https://github.com/Terasology/ManualLabor/pull/33
While adding these items, a new feature: filling bar for fluid item containers was added
https://github.com/Terasology/Fluid/pull/20
The Body Temperature System
Simultaneously with all these tasks, a new Body Temperature System was built which would help make the transition from the Hypo/Hyperthermia Effects being triggered when in danger zone to Hypo/Hyperthermia Effects being triggered when the body temperature actually reaches extreme values. The Body Temperature System reacts on climate information such as ambient temperature and in case of it growing very high or low can result in the player becoming Hypo- or Hyperthermic. Being a rather complex topic, it required a lot of discussion, brainstorming and review cycles.
Along with building a body temperature system, gradations were introduced in Hypo/Hyperthermia Effects so that the player would start being affected with minor effects in lower thermia stages and the effects become worse with further deviation of body temperature towards the extreme temperatures.
https://github.com/Terasology/ClimateConditions/pull/24
https://github.com/Terasology/ClimateConditions/pull/17
https://github.com/Terasology/ClimateConditions/pull/26
While working on the body temperature system, a lot of events which had a before - after style functionality were noticed. Thus, a new abstract event - BeforeAfterEvent was introduced so as to have all such events inherit this event to avoid repetition of code. (The transition has not yet been made for all such events, and is still under progress)
https://github.com/MovingBlocks/Terasology/pull/4095
Alteration Effect for Item Effects
After a Body Temperature System was in place, a way to implement the effects of items to overcome obstacles was available. A new Body Temperature Alteration Effect was introduced which could be used by wool vest and arabic thawb to slow down the change in temperature to extreme values and completely avoid it in relatively less harsh climates. The alteration effect was then used in delta prefabs of the items in the Equipments module to add their functionality.
Along the way necessary modifications were made in events like AbstractValueModifiableEvent and OnEffectModifyEvent and the Equipments module.
https://github.com/Terasology/Equipment/pull/125
https://github.com/MovingBlocks/Terasology/pull/4123
https://github.com/Terasology/AlterationEffects/pull/24
https://github.com/Terasology/ClimateConditions/pull/29
Surprise Structures in Biomes - Igloo & Oasis
Next task was to introduce some surprise structures in the extreme biomes.
- Igloos in the Snow Biome
- Oasis in the Desert
Oasis - The task of building an Oasis was very much related to the TSoC project of
@Sin3point14 which involved heavy usage of the lake module, and hence was done in collaboration with him. The tasks undertaken in collaboration include cleaning up and improving the Lakes module, increasing the size of lakes along with varying probability of spawn in different biomes.
https://github.com/Terasology/Lakes/pull/6/commits
Next, while implementing Igloos in the snow biome, a way to use Structural Templates during World Generation was implemented which could prove to be useful for a lot of future projects. Addition of the method in the Tutorial World Generation is pending for the same and shall be added soon.
Subsequently, a new Igloo Structure Template was created using the Structure Template module and was then distributed in the Snow Biome using the same new method during World Gen.
https://github.com/Terasology/ClimateConditions/pull/28
Wrapping Up
With this the core of the project had been completed and some wrap up tasks and minor bug fixes were worked on.
One of the major ones being - addition of a small UI icon on the screen when the player is under the effect of Hypo/Hyperthermia, the icon disappears when the body temperature returns to a normal range.
https://github.com/Terasology/ClimateConditions/pull/31
https://github.com/Terasology/ClimateConditions/pull/27
https://github.com/Terasology/JoshariasSurvival/pull/38
What was not achieved?
Although my work is complete and playable and the objective of the project as a whole was completed and implemented, there are still a few things pending according to my proposal:
1.Recovery Effects in Surprise Structures - After a discussion, a decision was made to let go of this part, instead chests will be placed in the surprise structures filled with rare items such as gold, diamond. The chests are already spawned in the igloo right now but the reward item spawning mechanism needs to be added.
2.Hunting Trap- This wasn’t implemented owing to timeline constraints. Since this was not a core part of the project idea, it doesn’t really affect the gameplay.
3.Dizziness Effect in Desert - New additions in rendering could now make this effect possible, an attempt to implement the effect shall be made soon.
Bugs found during development:
The particle effects in general are not replicated properly in non server instances in multiplayer gameplay. This was noticed when the visible breath effect on the players was visible on the server instance of the game but wasn’t visible in the non server instances.
My Experience
I had an amazing time working on the project throughout the summer and I believe I have learnt a lot along the way. I think my GSoC journey has been fairly smooth and the credit definitely goes to my mentors and the whole Terasology community. The community is extremely helpful and approachable, and there was always someone to guide me out of any sort of issue that I ran into. The discussions and brainstorming sessions with the mentors in the weekly meetings were also amazing. And I definitely had a lot of fun throughout the entire program.