Create or click objects in the beat of a music

it is possible to configure GD5 to create objects in the beat of a music?
Or even hit objects in the beat of a music like Guitar Hero, Beat Saber, etc

If so, how this could be done?


Achieving consistent synchronicity in a video game is a very challenging design problem, and there’s not a lot of documentation out there. You should really think about the design principals first, and then whether GDevelop is really sufficient to help you implement that design.

Here’s an good article about designing a game like this:


Great article. It elucidates a lot to me.

I think if there is a way to know the time elapsed of a song here in gdevelop i can make my game here. I don’t know if this exists. There is?

Yes, I recommend you use a dedicated channel. And there is a method you can call named “SoundChannelPlayingOffset” which takes a channel argument and returns the current offset as a rational number of seconds. I use it to resume tracks when switching scenes and it works well.
It will take some testing on your part to determine if it is good enough to use for beat calculations. I’m not sure there is a way to use a callback in GDevelop, so you’ll have to rely on calculations between frames. (I’m not sure this was in the article above but I also read somewhere that callbacks are better to checking precise input times)

1 Like

I will have a look at this. I’m not familiar with these beat calculations, it will be my first rhythm game. A small one. If is too complicated for me i think to do something like Dance Dance Revolution instead that don’t have these beat calculations.

As you said before. I can’t find many documentations about this type of game.

If you know about a guide or sometinhg i would be very glad to know.

Thx for your support.

That guide I found is the only one I’ve ever read. I actually really want to make a rhythm based game some day, but the problem is that I would probably spend months trying to code something highly efficient and portable and then never do the game design necessary to leverage the tech.
That’s personally why I use GDevelop because it forces me to not try to write optimal code and instead just focus on the logical design.

I’m honestly not sure GDev is a good fit for a rhythm game or not. But if it was me I would prototype it in this manner:

  1. Find a song with a known BPM
  2. Play the song in the scene
  3. Try to write a system that make a circle change from black to white with the BPM
  4. Add input logic that detects a key press and tells you how far away the input was from the last BPM
  5. Determine if the system is good enough the move forward with and adapt for dynamic music/BPMs/graphical events in the scene.

Good luck, and please share your progress!

Now you really cleared my sky. I’ll do the way you told me now.

Like i said i’m making a small rhythm game. I already have the desgin that i want for the game with some scenes coded (but without sound kkk).

I was struggling to know how to sync a music to my scene. Never did this before. All i need is to create/click objects in rhythm. I think with your help above it will be possible.

I’ll be glad to share my progress when i achieve something.

Thx a lot again.

I got something, the result is below, didn’t made the input logic yet.

The number is the time elapsed of the song - offset
The music has a beat of 142bpm



I have some doubts:

I followed the guide from Ludum Dare, and there the bpm is fixed, the crotchet variable too, so the expression he used is fixed too.

With this i have the result of the circle changing the animation every x seconds fixed.

It did not work “in the beat” of the song. I don’t know how i will get to this.

any ideas?

thx in advance.

Is it consistently off? Or is it completely out of sync?

It is synced with the bpm. It was more a musical doubt.

With the BPM the circle change its color every 0.5s fixed. But if i want to chenge its color in a moment of 0.25s for example i have to do another function especifically to this beat.

I saw on the internet that midi files can create events for each instrument, but i don’t think gdevelop has support for that. I’ll have to do this manually instead.

I trying now to carry song position to another scene and continue the music from that.

I think I see what you are saying now. I guess I would imagine you would have to map the instrument tracks individually for each song manually.
Howler.js that GDevelop uses doesn’t support midi, but I think GDevelop is planning on adding “mod” support, which has similiar attribute with midi files in that you can access the different tracks:


I just had this crazy idea, but you could create a track designer in Gdevelop first that basically plays the song but allows you to jump to any point in time using a makeshift slide bar. And then you would populate a GlobalVariable structure with children for each instrument each of which are a structure with keys that are increasing from 0 to the number of beats in the song. Then the player would allow you the designer to press a button associated with different instruments for each beat on a timeline. So like “Drum” “Horn” “Guitar”.
So as you play the song, you press the buttons for each instrument as you listen to them, and your code will populate the structure for that instrument based on the closest beat.
You could even slow the song down a bit to help, but it would automatically snap to the closest beat to help.
Then you can save that global structure as a JSON blob to file and be able to load that JSON blob to play back in game mode.
And in game mode you could display the appropriate sprite or graphical flourish for each instrument at each beat as you play the song and look up the current beat for each instrument in the global structure you loaded for that song.
Sorry, that’s a lot of ideas, but maybe it will help spark your own.