Introduction
Undertale is a well-known game because of its unique mechanics, storytelling, and its
UNIQUE MUSIC
But, how does music even affect a game, and how do I implement it into mine?
That's what we are going to answer today.
What is the need for sound in game development??
It makes the world feel alive
In real life, every single action we do has a sound tied to it – footsteps, rustling clothes, cars passing by, birds chirping. Now imagine the same world, no sound.
Feels… empty. Like something’s missing.
Similarly, if you want the best out of your user’s experience, you must give your game an audible soul. Even subtle background sounds (wind blowing, rain tapping on windows) can make your game world feel real and immersive instead of flat and lifeless.
It’s feedback to the player
Games are interactive. Sound is the language your game uses to talk back to the player.
- Pick up a coin? Ding!
- Unlock a door? Click-clack.
- Hit an enemy? Thwack!
It sets the mood and emotion
Undertale nailed this. Remember how “Megalovania” instantly makes you sweat? Or how “Home” gives you cozy, safe vibes? That’s because music drives emotions hard.
(Megalovania and Home are name of Soundtracks in undertale)
Music helps:
- Build tension in horror games
- Intensify the boss fights
- Calm the player in peaceful zones
It's like controlling players' emotions.
How can you implement sound in YOUR game?
For today, we are choosing Mini Micro as an engine, but this tutorial series will continue with Godot, Love2D, and whatever you wish
In Mini Micro, we have a function --> file.loadImage(x)
which loads an image on path x
and returns the image as a map.
This Map returned by file.loadImage()
has following values:
Key | Value |
---|---|
__isa |
Image |
_handle |
ImageHandle |
width |
64 |
height |
64 |
path |
"/sys/pics/Balloon.png" |
name |
"Balloon.png" |
{"__isa": Image, "_handle": ImageHandle, "width": 64, "height": 64,
"path": "/sys/pics/Balloon.png", "name": "Balloon.png"}
THIS EXAMPLE IS WHEN THE file.loadImage
IS USED WITH PATH "/sys/pics/Balloon.png"
AND VARIABLE x
Similarly, there is also a function like file.loadImage
, which is file.loadSound()
. This also returns a map with the following value.
Key | Value |
---|---|
__isa |
Sound |
_handle |
blam.wav (AudioClip) |
duration |
0.55 |
{"__isa": Sound, "_handle": blam.wav (AudioClip), "duration": 0.55}
THIS EXAMPLE IS WHEN THE file.loadSound
IS USED WITH PATH "/sys/sounds/blam.wav"
AND VARIABLE x
We can use this function to store with a sound, like here I store variable x
with the returned map by file.loadSound
Now we can just use the function .play
to play the sounds, for example:
x.play
here would play the sound
But I suppose in some cases you might need your sound to be looped, In such cases:
x.loop = true
It can be used to make the sound effect loop.
While testing, I also felt the need to stop the looping sound, for that I can use
x.stop
There are some other methods like:
x.isPlaying
Which returns true if sound is playing.
x.duration
Which returns "TOTAL" length of the audio stored in the file returned by file.loadSound
OUTRO
These were the most commonly used methods/functions while handling sounds, but sometimes you might find the need for more things for such situations. I do highly recommend the official Sound page on the miniscript wiki
-> SOUND
So drop down your doubts in the comment section, Till then stay awesome and Bye
Top comments (0)