One of the things I’ve always been keen to try out in The Swindle is the idea that you can come back to the levels over and over. I didn’t want them to be like Green Hill Zone Act 1 where you whip through and never see it again, I want you to be able to explore and re-explore.
In order to keep that from feeling stale, I implemented a Day/ Night cycle, so the same level can feel varied depending on whether it’s an orange-y dawn, a purple-y dusk or pitch black night. Time of Day isn’t just about visuals, it’ll effect gameplay too. You’re harder to spot at night time, but they switch the lights on, for example.
Along with that, I’m adding in some weather, so it can now start raining. Here’s the tech of how it’s done.
(uh, you’ll probably have to click these screenshots to see what I’m on about)
The trouble is, raindrops are expensive; rendering every drop would slow everything right down. So first up, we’ve got a Plane with a simple seamless rain texture on it. That’s layered to the Background, and is only displayed by our Background camera. It has a little script attached to it that scrolls the texture, making it feel like rain.
Next, we’ve got a Particle System that spawns individual raindrops. Thanks to Unity4’s magic ability to have rain collide with World, rather than just planes, the raindrops themselves can be destroyed on contact with tiles and physics objects (stuff like the crates you see here).
As the raindrops are destroyed, they’re spawning two subemitter effects – the first is a simple splash to show impact. The second is a nice shader effect drawn in front of the objects, which distorts as it drips down.
Neither the RainDrop particle system itself or the heavy rain plane are particularly big; dropping rain over the entire map when you can only see a portion of it feels foolhardy. The WeatherSystem object was initially childed to the camera system, so they’d pan around with you, but this led to problems when you go into buildings, or underground. With the rain always spawning just above you but offscreen, it was possible to make it rain inside. So instead the WeatherSystem’s is its own object, and position is tied to the camera’s movements with certain restrictions in place. It never moves down below ground level, for example, so if you go deep into the sewers you won’t find it won’t suddenly start raining.
A few more Particle Systems attached to ledges and drainpipes for run-off, and it’s done! It’s amazing how something as simple as a spot of drizzle can completely change the tone of a level.