Before we begin, a bit of self-promotion right away - 11th Dream releases this Friday on Steam!
11th Dream is a fast-paced action shooter game, it forces the player to act quickly and strategize correctly, so most of the time it is impossible to look around and appreciate environment effects.
However, eye-candy effects should not be underestimated. When done right, they can shift atmosphere of your game to the next level. In 11th Dream, we have implemented two major environment effects: rain and wind. We wanted the rain to bring soothing feeling, nostalgia, but discomfort as well when faced directly. The wind should evoke movement, cold and vastness.
11th Dream builds on custom engine - we wanted to bring an original look and as we use to say, absence of easily accessible technology drives our imagination. On the other hand, we had to figure how to implement the weather effects ourselves.
The rain in our game is pretty simple particle system, where every raindrop is rendered as a sprite which is partially oriented to the camera. Raindrops are spawned way above the camera with slightly randomized velocity and once they reach the surface, we spawn a small sprite at the point of collision as "droplets". The raindrop can then respawn and the process repeats.
The question was, how to detect collisions with ground? The usual small scale approach, ray casting, was out of question because of performance demands. Other approach, screen-space collision detection, is fast but does not easily solve building interiors, simply because the ceiling might not be visible on screen at all.
The "simple indie" solution, in our case, is to pre-render a height map. Then, for any location in the game level, we know the surface level. All we have to do then is to compare the vertical position of the raindrop with the surface level sampled from the height map. When we are below, the raindrop is stopped and respawned.
The method is slightly inaccurate next to vertical walls since the height map can never really cover perfectly vertical surfaces. This inaccuracy can be hidden by increasing the resolution of the height map.
It is probably an overstatement, but the wind is just a horizontal rain. We can still use the height map for the collisions with the environment, but for wind particle movement we need more.
weather normal map
We ended up blurring the height map and then generating a normal map from the blurred image. This way we can steer the wind particle again just with one sample from the normal map. Additionally, we randomize the particle movement every frame.
The wind particle is then rendered using multiple oriented billboards to show the curved particle trail.
We hope that you enjoyed the peek behind the scenes of 11th Dream. If you have any questions, you are welcome on our Discord server, feel free to ask us anything! Follow our game page here on indiedb or on Twitter or Instagram for development news and sneak peaks.