Set up the whole architecture/skeleton from the start!
I am adding music and sound effects to Mathemando. And want to share my learning regarding that.
Set up the whole architecture/skeleton from the start!
That's it, thanks for your attention.
Now seriously.
My initial naive approach
I first created the game mechanics: buttons, menus, UX in general. That was fun till I realised that I also want to add vibration. Luckily for me, the game was still small. So I added a couple of vibration functions like those below.
VibrationManager.VibrateSoft() VibrationManager.VibrateLight() VibrationManager.VibrateMedium()
Tested the app, all was fine. The app originally only went to TestFlight and I focused on the web version and additional mechanics. I wanted to release and get feedback as soon as possible and neglected further enhancements. That led me to some problems later.
Some days ago
I realised that I want to push the game on the AppStore. Releasing is always a pain – not only because of all the things around it like making screenshots and descriptions and licences, but because I cannot just release something, it should be well done. I decided to add sound. Immediately, there was one issue. How do I add sound effect in all the places? It is now at least four scenes, multiple buttons, different interactions. I could search for each and then add the effect, then test, search and fix again and again – that would work for such a project. But that was highly ineffective.
Could you guess a better solution?
1...
2...
3...
I could just search for places where I invoked `VibrationManager`. Easy. Apart from two problems
- Manually adding similar lines in like 50 places
- Noticing that I had different vibrations all over the place :screaming_squirrel: Some buttons were vibrating lightly, some softly, some in a medium fashion
While it is doable there is a better approach that could have saved me some time.
The better approach
It consists of three steps
- Define the UX events from the start as soon as you are developing them
- Have some central place for UX effects. Invoke it already when developing the new elements like buttons
- Populate the events
In other words, that would mean:
// Step 1
public static class UXFeedbackManager // Define the event in one central place
{
public static void PlayButtonTapFeedback() // Method can be empty
}
// Step 2
// Some class with buttons
public void MakeMoreRelaxing()
{
UXFeedbackManager.PlayButtonTapFeedback(); // Call it. Yes, my game can make things more relaxing
// other logic
}
// Step 3
public static void PlayButtonTapFeedback()
{
VibrationManager.VibrateLight(); // Have some real implementation
SoundManager.shared.DidTapButton(); // In general, those methods are a Facade pattern
}
What benefits does it bring?
- If I want to change something, I change it at one place
- As it is one place, all the buttons will play the same effects
- I won't forget about calling the UX effect in some place because I do it right from the start when implementing things
Mathemando
Solve math puzzle by discovering the right formula!
| Status | Released |
| Author | Dyrkabes |
| Genre | Puzzle, Educational |
| Tags | 2D, Brain Training, Casual, Math, Minimalist, Non violent, Short, Singleplayer, Unity |
| Languages | German, English, Russian |
| Accessibility | Color-blind friendly, High-contrast |
More posts
- Mathemando updateMay 20, 2025
- Mess up fixedApr 20, 2025
- I messed upApr 20, 2025
Leave a comment
Log in with itch.io to leave a comment.