Gamedev Log: “The Escape” #9 (Unity/C#)

A daily log of how I program a basic Unity/C# game: “The Escape”!

This article is also available on Medium.

I’m nearing the end of my gamedev logs on a small Unity/C# game: The Escape!

I’ve prepared all the main features so far and, tomorrow, I’ll be finishing the first version of the game after ~8h of dev (+a few hours of prior work on the creation of resources that I re-used here).

Today, I wanted to add something crucial to the immersion: sounds & music! I also implemented a few quick-win effects like a camera shake or a crash explosion VFX so that the player feels more engaged with the action 😉

Project rules:

  1. I post a new gamedev log every day with a new demo video
  2. I work 1 hour max per day on this project
  3. I need to have a new visual feature by the end of this 1 hour (it can’t be just bug fix and refactors)

Day #9: Camera shake, sounds & music, crash VFX, scene transitions

Features & demo

For this last-but-one day, I’ve worked on a couple of unrelated things:

  • the sounds & music: sound design and ambient music are key to really having the players dive into your world! For this game, I created a few sounds by hand using synths & percussions from GarageBand and I took one of my retro ambient musics, Secretly, as a looping background soundtrack.

    By the way: if you want to get the full version of the song for your own projects, or other types of ambient musics, check out my collection of ambient musics on Gumroad!
  • the camera shake is pretty basic: whenever I hit an obstacle, I quickly move the camera around for something like 0.25s, then restore it to its original position
  • for the crash explosion VFX, because I didn’t have enough time to create my own particle system, I simply took the “ExplosionMobile” prefab from Unity’s official Standard Assets package!
  • finally, I added some scene transitions with a fade-to-black screen effect so that its smoother and more pleasing to the player

I also took a little bit of time to get a toggle on/off option for the sound – you can mute/unmute the game by clicking the button in the top-right corner, or by pressing the <M> key. This info is stored in the player data so that, the next time you load the game, it remembers whether you want it muted or not 🙂

Here’s what the game looks like at this point – almost done?…

To be honest, I feel like one extra hour won’t be enough to put all the ideas I had in this game. But I’m pretty sure adding a few different types of obstacles, and a bit of “storytelling” will already go a long way…

A few details, tips & tricks

Something really nice with the multi-scene workflow I put in place earlier this week is that it makes it easy to have a continuous audio source for the ambient music: I just had to put it in my “core” scene and I could have it stick forever in addition to the other scenes 🙂

An important trick though is to re-route all the audio source outputs to a Unity AudioMixer asset to be able to control the volume of the entire game all at once, and thus mute or unmute everything!

For the scene transitions, I used the exact same technique I detailed in this article on animating Unity UI via script: by using a few coroutines and placing a UI black overlay in my “core” scene, I can easily mask the entire screen briefly.

Conclusion

Even if I’m about to finish my first prototype of The Escape, I think it would be really cool to keep this project in the back of my mind and come back to add a few things if I ever get a very tempting idea… and, of course, I’d be really happy if you’d participate, too, so feel free to leave comments with cool features for The Escape, version 2!

I hope you’re liking this series of Gamedev Logs, and see you tomorrow for the last one 🙂

Leave a Reply

Your email address will not be published.