[Solved] Lag issues when previewing the game

I’m creating a music Rhythm game called Rhythm Retro and it involves matching notes up to the music and I do it in parts then combine them when I’ve finished each part of a song but regardless of how many notes on screen when I run a test window it always LAGS the first time and nothing matches up and I have to close it and try again. and the second time it loads it works fine with no lag. Why is this happening? It’s pretty annoying to have to test it twice every time I want to see a change.


You shouldn’t bet on real time for keeping in sync with the music. I recommend you use the seek to see at which point the music is currently playing at instead.
If you do not care about my advice, you can also wait for this to be done: Refactor audio (pre)loading by arthuro555 · Pull Request #2006 · 4ian/GDevelop · GitHub
It should allow preloading the music to instantly play it later.
Though, ngl, a few very problematic issues have emerged with those changes, and I don’t think there will be an easy way to fix those, so I don’t think this will be done anytime soon.

You don’t get it. It runs fine on phones and devices when I export the apk file. My syncing is great. This only happens when I’m testing my game in Gdevelop and only every second time.

Well, if it cannot adapt when there is some lag, while it may work on your device it will probably get out of sync on lower end devices. I’d still recommend using the seek, that way you shouldn’t be able to experience desync due to lag.

I’ve tested it on a phone as old as a Samsung Galaxy J8. It’s ancient and it works fine. And I fixed the problem with my application. Turns out I had SAVE PROJECT ON PREVIEW selected. It makes sense because the first time I preview the game it’s lagging but the second time it isn’t. I believe it was because the first time I previewed it it was saving changes I made at the same time. Anyways I turned that check box off and now it previews at realtime. And if my game runs smooth on a phone that old then I’m not going to bother changing how I built it because if people have any phones older than that they should upgrade anyways. Thanks for trying to help though.