Gamedev Log: “Slash’n’crack” #8 (Unity/C#)

A step-by-step log of how I made a basic Unity/C# game: “Slash’n’crack”!

This article is also available on Medium.

Today, it’s the last of my gamedev logs on my latest basic Unity/C# mobile game: Slash’n’crack!

For this dev challenge, I had 8 hours to make the entire game, from start to finish! The seven first hours brought life to all my core ideas and I now have a viable first prototype of a game:

The last thing I need to do is add some sounds and music to better immerse the player into the game and give some additional feedback 🙂

Hour #8: Sounds & music

Features & demo

All in all, my audio system will be pretty basic. I will use two audio sources:

  • one for the background music, with a low priority and a medium volume that autoplays a given .mp3 file and loops indefinitely
  • one for the sounds, with a high priority and a high volume that doesn’t have any default audio clip loaded but is referenced by my brand new AudioManager C# script

These two audio sources allow me to overlay the background track with some short contextual sounds that play when I slash an asteroid or loose a life.

Just like in The Escape, I’ll also use store some settings for the player about whether or not the game is muted; this way, when you re-start the game, it will remember if your turned off the audio last time and will automatically mute the audio upon start.

This mute setting will be toggled with a little UI button in the top-left corner.

With all that said, here is a final demo of Slash’n’crack after these 8 hours of dev:

This first version could obviously be improved in many ways! For example, I could use object pooling for the asteroids to make the auto-spawn more efficient, or I could devise a better algorithm for the random positioning of the obstacles. But this is a viable prototype, and it was completed within my constrained 8 hours timeframe! 😉

A few details, tips & tricks

The background music was made in GarageBand with various built-in synths and loops. The contextual sounds are various clips I made with voice recordings and pitch shifters.

In Unity, I’ve configured my two audio sources to be routed through a basic Audio Mixer asset. This way, I can easily expose and tune the overall volume of these sources and directly mute or unmute the entire audio of my game.

Also, something nice is that, thanks to my multi-scene workflow, I automatically get a smooth audio transition from one scene to the other: just by setting up my audio sources in the “Core” scene, I make sure that these aren’t destroyed when I switch from the main menu to the game scene and that the background music doesn’t get cut off.

Finally, to remember whether the player wants the game to be muted or not, I used Unity’s PlayerPrefs feature that allows me to quickly store basic values in a key-value store somewhere on the client’s device (the exact location depends on the type of platform).

Bonus: how to build and share your Unity Android projects… automatically!

This part is a bit outside the gamedev log itself, but it was however a pretty interesting final phase for my Slash’n’crack project.

As I said before, it had been a while since I had made an Android app in Unity, and one of the things I always find tricky with mobile games is building and sharing them. Sure, thanks to Unity, creating a .apk Android package from your codebase is quite straight-forward; but actually sending this package to other fellow developers or kind beta testers isn’t always easy, and it’s always a long process.

This being said, for a few weeks now, I’ve started to explore and use an online CI/CD tool called Codemagic. The company now offers a service to automate the build and distribution of your Unity apps, which is really cool and can help significantly reduce the iteration time of your projects!

So, for Slash’n’crack, I thought I’d mix this cool tool with another really interesting product, this time by Google, called Firebase. Roughly put, Firebase is a service that lets you automate the build and the distribution of your iOS, Android, Web or even Unity apps but also has a whole palette of things to monitor and share them.

In particular, their App Distribution feature allows you to set up tester groups or create invitation links and directly send newsletters whenever your release a new version of your app so that you can get a continuous automated feedback loop, and up-to-date QA on your project.

So if you’d like to try it out and become a beta tester, you can follow this invite link to the Firebase auto-distributed app! 🔮

https://appdistribution.firebase.dev/i/76ac6fcd50a085e7

If you want more details on how I configured this entire build and distribution automation workflow thanks to Codemagic and Firebase, check out the article I published on Codemagic’s blog on the topic! 🙂

And if you want to take a look at the project itself, the code is available for free on my Github 🚀

Conclusion

I’ve now finished the first version of Slash’n’crack. The game contains most of what I’d designed originally even if, of course, I could add a lot more… also, don’t forget I’m always open to comments with cool features for a v2!

Remember that, thanks to the automated build and distribution pipeline I prepared, you can easily become a beta tester and get up-to-date releases of the app – just subscribe to this invitation link 🔮

https://appdistribution.firebase.dev/i/76ac6fcd50a085e7

I really hope you enjoyed this series of Gamedev Logs — feel free to react in the comments and tell me if you’d like more 😉

Leave a Reply

Your email address will not be published.