No offense, but life keeps going. Either make yourself better every single day or be stuck with the same mentality that causes you to suffer. No one is going to give you a better life but you.
Retro Game Engine Update: Rain 🌧️
Recently I tackled how to handle weather, starting with rain, inside my custom game engine without adding some weather library or rain shader. Instead, its about 100 sprites that get re-rolled around the camera. Here is how it works.
The rain is a pool of of small sprite entities. Every few ticks, each one is re-placed at a random spot in the camera's view cone, between a near and far distance stet. Re-rolling the positions is what makes it read as falling.
I had some early failures trying to use a textured cube around the player, and with billboards which distorted and streaked odd depending on my camera angle. I discarded those and moved on to having streaks point along the worlds fall direction (with an additive slant value I an control on top of it).
The splashes are...more sprites. Rings on the ground, generated by probing straight down to find the surface, then lays the ring flat to the surface normal, so it sits right on slopes. Spots are picked in a uniform manner by the ground area inside the camera's footprint, so you never get a pile-up in front of your feet.
Shelter also blocks the rain, using the same downward probe done to align the splash rings properly, I also check "is this spot exposed to the sky?". If not, no rain drops or splashes get in there, which is nice.
The cost of this system has to be relatively cheap. My engine/game should run on a potato at all times. The real measured cost of this effect is the probe cost. so the more coverage I want the particles to have, the higher it gets. That being said, I was able to add a surface cache that dropped the average impact of rain down to only 0.01ms. Heavier rain sits at around 0.07ms. Either way, FPS still sits around 400 in this scene so I'm happy.
Its entirely data driven too. I can make weather entries in the editor as seen here, entirely driven by data. I can adjust values, see a live preview in the editor, and lock in the final look much faster.
This was really fun to work on, but also, its truly amazing to me how much the weather can impact the mood of the scene. What do you think? I'm excited to try snow in the future!