Hello! First time on the forums, hope I’m doing this right. If there’s anything I should add to this please let me know ;o;
I’m currently working on a rhythm game: Notes move from the top of the screen towards the bottom, and you hit certain keys depending on the note’s placement/column/“lane” at the right moment. What I need is the notes spawning at the correct time, at the correct speed.
This actually works that way in my game! …Just in the previews you access from GDevelop’s editor, though. If I were to stream the preview in Discord, the game runs smoothly in every scene except the one where the gameplay happens (The title screen and character select screen specifically, they both run very well, just like in the editor’s preview). A friend suggested me exporting a build of the game instead, to see if the problem persisted. It did.
When streaming/on an exported build, the game (only in the gameplay scene):
- Has somewhat laggy/slow animations (For context: There’s some looping animations on the sides of where the keys spawn. They’re short and not too big though)
- Visual effects from the buttons/keys lag too
- When notes spawn, they spawn much later than expected. They spawn in the same order and distance between them that they should though.
- Sound is fine however, and runs like when previewing from the editor (AKA doesn’t lag at all)
Here’s a snippet from the chart section of my events, which is basically the same for every time a note is spawned (just changing the song’s offset that sets the moment the note(s) should spawn):
What the code does is:
1.- Spawn two notes on two different lanes at the same time (just in this case, hence why you see a “Note” object and also a “Note9” object, as it’s the note type that should spawn on the ninth lane/column)
2.- Set their Z-order so they’re visible
3.- Add a permanent force to both notes that moves them downwards based on the song’s BPM and “songspeed” (which is an additional variable I have there to tweak the notes’ speed)
I would put the builds (plural because I did this twice today, one with changes and one as it was before I noticed the lag) here in case anyone wants to test to see if they get this same problem with the game but the chart has a placeholder song that wouldn’t let me put them here as per the forums’ rules. I was thinking of maybe exporting it muted song-wise (AKA replacing the song with an audio file that’s just silence but the same length as the original song), but I don’t know if that could help noticing the desync of the notes (as it’s just silence).
Do note I tried fixing this adding a “* TimeDelta()” next to when SongSpeed is mentioned but it just made things messier (notes wouldn’t even spawn in the correct order with this).
If there’s anything else I should show or tell about the scene’s events/game please let me know. Any help would be very appreciated ;_; Thanks in advance