Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+3)

Hi, I'm one of the creator the game. 

There is indeed an algorithm for the sounds when you select pieces, it's awesome that you noticed it 😄

Our goal was to give a satisfying feeling when players select several pieces. I got inspired by the Zelda games where there is scale when you chain attacks on enemies. It is well explained in this video : 

So first our awesome sound designer exported keys based on the main music's scale. I made a small code piece to play those keys one after the other when shapes are selected.

Then there was a second step: we realized that it sounded bad when several shapes where selected at the same time or very fast. To fix it I added a code that puts sounds in a queue, then the queue release queue every fraction of seconds to make it sound more harmonious. 

I hope I answered all your questions, feel free to ask if you want more details 🙂

(+2)

Indeed i already saw that video, music really is a vital piece for videogames. Thanks for the explanation, however (as my intentions are to implement a algorythm in a future that can detect when, for example, the fourth bar of the song is ending), i still have one doubt: how did you make the queue to wait for the song compass? It's there a counter in parallel to detect them in seconds along the song? Or actually there ain't any of this and my brain is just playin'?  lol

Hi again, if you want to check our code, everything is in this Github depot, feel free to use any piece of code there: https://github.com/leolefebvre/GMTK-2019 (the code is a bit dirty-but-it-works because of Game Jam).

The specific piece of code that handles the sound and the queue is here : https://github.com/leolefebvre/GMTK-2019/blob/master/GTMK-2019-UnityProject/Assets/Script/Managers/SoundManager.cs

To answer your questions: the queue doesn't wait for the song compass. it just wait 0.05 seconds before launching the next sound in the queue and your brain is just playing :)

I was planning on doing something that waits for the song compass, but because it was a game jam I decided to go for the easy solution and it was enough to do the trick ^^

More detail on the implementation:

  1. When a sound arrives, the manager checks if the sound source is open (I just used a Boolean as a gate).
  2. If the sound source is open, it plays the sound right away, closes the game (Boolean set to false), and launch a coroutine that will handle the next sound source opening (more on that later). If the sound source is closed, the sound is added to the queue.
  3. The coroutine waits for a fixed time (here it's 0.05 seconds), then there is a piece of code that check if there is something in the queue. If there is, it plays the first sound in the queue, then remove it and launch the coroutine again. If the queue is empty it opens the gate.

Finally after testing we added some details:

  • There is a maximum count in the queue (if a sound arrives and the queue is full, it is ignored). before you could stack a lot of sounds in the queue if you just kept selecting and de-selecting super fast. Problems were that sounds could go on for a long time (that was weird but still funny), and I was afraid that someone could overload the memory with it since the queue was getting bigger and bigger
  • The keys to play were stored in a list. The manager chooses the key to play based on the number of pieces selected (at the time a piece is selected). When the number of key is higher than the number of key in the list, I added a piece of code to repeat the last two keys.

A trivia about the last one: The first version was just repeating everything from the start (it was just a modulo that you can still see commented ^^). It did not sound good so I added the code explain before.

This code actually allows to repeat the next x key (but only ascending, I didn't took the time to write an equation so that it makes "waves", as in up and down). So we played with it a little bit (what if we play the last 3 keys? only the last 1 key?) and then settled on the last 2 keys.

It was quite fascinating to try those different effects and see what would work best, and it can take quite a while to make it make it right (we had to choose fast because Game Jam).

I hope I answered all your questions, and I am sure you can find resources online to help you find what you need!

(+1)

Thank you very much for the reply! Yes, i'm all set now. I'll look for that code! Really wanna expand my knowledge on programming, more if it's about musical stuff because as a musician it's cool to know how to do those musical details that make the difference. Sadly i just gave up on C# because looks like my brain can't even go 50%, and started with LOVE2D's Lua, not sure if it's the right path but i can always go back. Logic seems the same on most of languages though, so i'll see wich i can fit more into.

Thank you again, and congrats on going live in the GMTK video ! You guys really deserve it. Even a port to mobile i would say can cause quite a success.