main menu
cozy
pretty
cool
A dumb mini-game I made over my 1-week spring break. Randomly got the idea after a rare, prolonged rain season in Irvine. Sort of inspired by SCP-548-JP that I read a while ago.
Mainly wanted to mess around with Unity's 2D Lights.
Surprisingly, this was the first time I did some audio programming that's more than just calling Play() or PlayOneShot().
I implemented volume control for background music and sound effects. I allowed audio to fade out before loading a new scene.
This was way more fun than I expected it to be. Also realized that even just having good audio integration can really juice up your game.
I wanted to make it so that the sequence of sound effects from consecutive rain drop hits would form a song. Using ScriptableObjects, I defined a Song object, and allowed the user to specify an array of notes to play in order to constitute a song.
I didn't implement half tones. Reason being 1) I was defining notes with an enum, and 2) I wanted to implement 2 octaves, so if I added half tones on top of whole tones, the drop down list would become a gigantic mess.
Then I associated each note to a pitch, and used each note element in the song array to generate a numerical pitch for AudioSource to use.
For God's sake I don't even know why I did object pooling for this small, dumb game.
Looking at the Profiler, it seemed like 2D Lights and URP were eating away at performance, so I was frantically trying to find ways to improve it (without removing 2D Lights, of course). I noticed the occasional Instantiate() calls were creating spikes, so I thought I'd tackle that.
Originally, I had a prefab for every type of raindrop, and from a list of prefabs would instantiate one of them. Clearly that wouldn't work if I wasn't instantiating a new raindrop for every "spawn" anymore.
I was already using ScriptableObjects to define my different types of raindrops. So for my object pool, whenever I needed to "spawn" a raindrop, I assigned a random ScriptableObject Raindrop type, and read its fields to specify things like its sprite, VFX, and SFX.
Was it worth it? Probably not for this game. Was it pretty? Yes.
For this game, it was probably better to just have lights drawn into the background sprite. But still, it was way more lightweight than I expected.
I mentioned that 2D Lights and URP seemed to be killing performance and burning my poor Macbook, just by running a minute of gameplay. That was only in the Editor though - on a PC build it worked perfectly fine.