A desert gardening survival game. Start from a tiny spring and cultivate a blooming garden. Explore a vast world amid the sands and uncover its mysteries. Can you defend against the relentless forces of nature and mysterious wraith corruption, to bring life to a dying world?
Thanks so much to The Side Quest podcast for inviting us to talk about Wildmender, development, gaming, and everything in between.
We had a great time :D
How we created the ideal water system for Wildmender
Over the last 4 years of work, we've created a gardening survival game in a desert world that let people create massive and complex oasis where each plant is alive. At the heart of a system-driven, procedurally generated ecology is a water simulation and terraforming system, and this post is to share a bit of how we built it.
We knew early on that the game would include some level of soil and water simulation, just as an outgrowth of wanting to simulate an ecosystem. The early builds used a simple set of flags for soil, which plants could respond to or modify, and had water present only as static objects. Each tile of soil (a 1x1 “meter” square of the game world) could be rock or sand, and have a certain level of fertility or toxicity. Establishing this early put limits on how much we could scale the world, since we knew we needed to store a certain amount of data for each tile.
Since the terrain was already being procedurally generated, letting players shape it to customize their garden was a pretty natural thing to add. The water simulation was added at first in response to this - flat, static bodies of water could easily create very strange results if we let the player dig terrain out from under them. Another neat benefit of this simulation was that it made water a fixed-sum resource - anything the player took out of the ground for their own use wasn’t available for plants, and vice versa. This really resonated well with the whole concept of desert survival and water as a critical resource.
The water simulation at its core is a grid-based solution. Tiles with a higher water level spread it to adjacent tiles in discrete steps. We broke the world up into “simulation cells” (of 32 by 32 tiles each) which let us break things like the water simulation into smaller chunks that we could compute in the background without interrupting the player. The amount of water in each tile is then combined with the height of the underlying terrain to create a water mesh for each simulation cell. Later on, this same simulation cell concept helped us with various optimizations - we could turn off all the water calculations and extra data on cells that didn’t have any water, which is most of the world.
Early on, we were mostly concerned with just communicating what was happening with simple blocks of color - but once the basic simulation worked, we needed to decide how the water should look for the final game. Given the stylized look we were building for the rest of the game, we decided the water should be similarly stylized - the blue-and-white colors made this critical resource stand out to the player more than a more muted, natural, transparent appearance did. White “foam” was added to create clear edges for any body of water (through a combination of screen depth, height above the terrain, and noise.)
We tweaked the water rendering repeatedly over the rest of the project, adding features to the simulation and a custom water shader that relied on data the simulation provided. Flowing water was indicated with animated textures based on the height difference, using a texturing technique called flowmaps. Different colors would indicate clean or toxic water. Purely aesthetic touches like cleaning up the edges of bodies of water, smooth animation of the water mesh, and GPU tessellation on high-end machines got added over time, as well.
The “simulation cell” concept also came into play as we built up the idea of biome transformations. Under the hood, living plants contribute “biomass” to nearby cells, while other factors like wind erosion remove biomass - but if enough accumulates, the cell changes to a new biome, which typically makes survival easier for both plants and players. This system provided a good, organic feel, and it fulfilled one of our main goals of making the player’s home garden an inherently safe and sheltered place - but the way it worked was pretty opaque to players. Various tricks of terrain texturing helped address this, showing changes around plants that were creating a biome transition before that transition actually happened.
As we fleshed out the rest of the game, we started adding new ways to interact with the system we already had. The spade and its upgrades had existed from fairly early, but playtesting revealed a big demand for tools that would help shape the garden at a larger scale. The Earthwright’s Chisel, which allowed the players to manipulate terrain on a larger scale such as digging an entire trench at once, attempted to do this in a way that was both powerful and imprecise, so it didn’t completely overshadow the spade.
We also extended the original biome system with the concept of Mothers and distinct habitats. Mothers gave players more direct control over how their garden developed, in a way that was visibly transformative and rewarding. Giving the ability to create Mothers as a reward for each temple tied back into our basic exploration and growth loops. And while the “advanced” biomes are still generally all better than the base desert, specializing plants to prefer their specific habitats made choosing which biome to create a more meaningful choice.
Water feeds plants, which produce biomass, which changes the biome to something more habitable that loses less water. Plants create shade and block wind-borne threats, which lets other plants thrive more easily. But if those plants become unhealthy or are killed, biomass drops and the whole biome can regress back to desert - and since desert is less habitable for plants, it tends to stay that way unless the player acts to fix it somehow. The whole simulation is “sticky” in important ways - it reinforces its own state, positive or negative. This both makes the garden a source of safety to the player, and allows us to threaten it - with storms, wraiths, or other disasters - in a way that demands players take action.