Trending
Opinion: How will Project 2025 impact game developers?
The Heritage Foundation's manifesto for the possible next administration could do great harm to many, including large portions of the game development community.
A technical and in-depth look at the particle systems that make Slime Rancher 2 feel like a winter wonderland.
Game Developer Deep Dives are an ongoing series with the goal of shedding light on specific design, art, or technical features within a video game in order to show how seemingly simple, fundamental design decisions aren't really that simple at all.
Earlier installments cover topics such as lessons learned from ten years of development with Ingress engineering director Michael Romero, how legendary Dwarf Fortress programmer Tarn Adams updated the game for its official Steam release, and how architect and solo developer Jack Strait made an entire horror game in PowerPoint.
In this edition, Monomi Park tech artist Edward del Villar dissects the techniques they used to develop the particle behaviors that enhance the finer details of the new snowy Powderfall Bluffs location in Slime Rancher 2.
We're thrilled about the recent release of a major update in our game in early access Slime Rancher 2, called Song of the Sabers. It introduces players to our latest creation, Powderfall Bluffs, a new snow-covered zone surrounded by a massive half-melted ice dome that has quickly become a fan favorite.
One of the most exciting features of this new area is the ability for players to interact with snow in various ways. We've put a lot of effort into creating a sense of immersion by allowing players to traverse deep snow, catch falling snowflakes, and engage in playful snowball fights with the slimes.
In this technical deep dive, we'd like to share our approach to achieving the snow interaction feature. By delving into the nuts and bolts of our system, we can help players understand how this exciting new feature was brought to life.
Snow Interactions in Powderfall Bluffs
In Powderfall Bluffs, we wanted players to feel fully immersed in the snowy environment, so we made sure that both the slimes and the player left a trail behind them as they moved through deep snow. When the first art tests were shown to the team, it became immediately clear that this was going to be an important part of the experience: without actually changing their behavior, slimes that were simply jumping around now felt like they were frolicking and playing in the snow. This visual interaction was crucial to capturing the feeling of snow, so we made it a top priority during development to get it right.
To accomplish this feature, we built upon an existing 'Environment Interaction' system that was already in use throughout the game. Environmental Interaction occurs when slimes and the player move through the game world, and even the wind has an effect created by a player tool called the ‘Vac’. This system is most noticeable in the way grass and foliage sway, the water ripples in shallow ponds and streams, and the subtle trails and footprints left behind in sandy areas of the game.
When these ground interactions were originally implemented, there was always the intention that they could be expanded in the future if we ever wanted to add interactive mud or snow to the game, which thankfully worked out well when developing Powderfall Bluffs.
Footprints visible in the sand in the Conservatory
By extending the Environment Interaction system, we were able to create an authentic, visually stunning, and immersive snow experience for players to enjoy. It's a small detail that may go unnoticed by some, but it's those details that make the overall gaming experience richer and more enjoyable.
To achieve the deep snow interaction in Powderfall Bluffs, we utilized a technique inspired by the 2016 SIGGRAPH talk, "The Technical Art of Uncharted 4," by Waylon Brinck and Andrew Maximov. The approach involves rendering a top-down interaction buffer containing all the interaction information packed into an RGBA render texture. When actors touch the environment, particles are spawned and drawn into the buffer, which is then sampled by the environment shaders to create visually pleasing interactions.
This technique allows the system to handle hundreds of slimes simultaneously moving through the grass, creating ripples in the water, and deforming the snow, all while maintaining optimal performance with only a single draw call per interaction type. By drawing from the best practices of industry professionals, we were able to create a powerful system that provides a playful and engaging environment for players to enjoy.
The top-down Environmental Interaction render-texture
The different interaction types are each drawn additively in a four-channel render texture that supports both positive and negative values. The ground interactions are stored in the Red channel, Grass is in the Green channel, and Water Ripples are in the Blue channel, while also using the Alpha channel for additional grass pushdown. We then used offset sampling to derive rough directional vectors based on the slope of these height maps to generate normals, which are used to calculate lighting for the interactions.
What it would look like if interaction particles were visible in-game
Here you can see what it would look like if the environment interactions particles were visible in the standard player camera. The ‘grass interaction’ particles wobble back and forth between Green and Minus Green (0,1,0,0) and (0,-1,0,0) based on a sine wave. This has the effect of making the grass sway back and forth after it’s nudged by a passing slime.
The environment interaction buffer is only captured directly in front of the player and fades off with distance from the player so that interactions don’t visibly pop in and out of existence as you move towards or away from them. The capture area is constantly in motion as the player moves and looks around the world, so the transform is locked to a step size that matches the projection volume divided by the buffer resolution, pixel-snapping the render texture in world space and preventing any visible jitter.
The environment shaders access a global projection position and size, which they use to transform the world position of the buffer so that all the interactions line up.
The different environment shaders use this render texture in different ways. For grass and foliage shaders, this is used to create some side-to-side motion on the vertices. For water and sand shaders, it’s used to adjust surface normals to create the illusion of a slight vertical offset. For the snow in Powderfall Bluffs, however, we needed significantly more geometric detail than exists on our current terrain meshes to create compelling deformations.
To achieve this, all snowy surfaces in Powderfall Bluffs are covered in additional ‘snow topper’ meshes that were procedurally generated offline from the underlying geometry and surface normals of the terrain. The interactive snow shader samples the ground interaction heightmap, which then offsets the vertices of these ‘snow-topper’ meshes, pushing the snow down where a slime has moved across it and pushing it up around the edges of the interaction as the snow is displaced.
The higher-resolution snow meshes, fading in via a Level-of-Detail system
These snow-topper meshes have a relatively high triangle count compared to the usual ground meshes, so we use an aggressive Level-of-Detail setup on them to keep geometry under control even when the entire local area is covered in snow. The vertex offset fades out with the distance from the camera, lowering the snow flat with the ground surface further away from the player to create a nicer transition when approaching snow, and preventing the deep snow from visually covering up and hiding smaller objects.
In addition to the deformation, when a slime is jumping around in the snow, we also spawn some snow particles on impact and add a temporary snow-covering layer to the part of the slime that was immersed in the snow. The snow-covering layer on the slimes allows two simultaneous areas of coverage, so it’s also used when a slime is hit by a snowball.
One challenge of having a purely top-down interaction system is that there’s no easy way to store the vertical position of a particle since all interaction particles are drawn to the same buffer additively with an orthographic projection. As an example, since we also use this system for foliage interaction, this means that a slime moving underneath a tree is also interacting with the leaves on the top of the tree! Thankfully this didn’t prove to be a huge issue with the existing areas of the game, as the trees with interactive foliage are all rather thin without any real overhanging geometry. Another similar issue occurs when the player uses the Vac, which also spawns interaction particles, on or around a tree. Any grass or foliage interaction from the Vac will wobble the entire tree in a vertical column where the interaction occurs. But because the player is directly facing the area that they’re interacting with, they don’t notice the grass moving underneath a tree while they’re using the Vac on the leaves at the top of a tree.
For the snow interaction in Powderfall Bluffs, however, some areas proved to be more challenging, due to the zone being much more vertically diverse with snow-covered overlapping land bridges and overhangs. While there’s no real fix for areas like this, fading the interaction effect out by vertical distance from the camera, both from the interaction particle’s position and the environment’s position, means that it rarely becomes apparent.
A ‘snow-occlusion’ quad that’s placed around a teleporter to prevent snow from covering it
In addition to the dynamic slime interactions, there were places where we needed to make sure that static environment assets, such as hen nests, veggie patches, or placeable decorations weren’t buried underneath very deep snow. In these situations, a simple ‘snow occlusion’ quad is placed in the scene that writes directly to the environment interaction buffer when the player is near to ensure that the snow is always pushed down in that area.
This technique has a lot of potential and flexibility and we’re always thinking about exciting ways we could leverage it to add additional polish and fun interactions to the game. As an example, vertex offset could be added to water, and a skirting mesh with lapping animated waves could be added around the shoreline of shallow bodies of water, or turbulence particles could be added underneath waterfalls to create ripples that additively boost the dynamic interactions from slimes.
Overall, building on top of the existing environmental interaction system worked well for developing the interactive deep snow in the Song of the Sabers update, and allowed us to quickly develop and deliver an engaging and playful experience that’s unique to Powderfall Bluffs in the Slime Rancher world.
You May Also Like