When we move the player between tiles, it takes 0.12 seconds. We want to play a sound when you start moving, but it seems like the sound buffer is too big. We’re getting considerable lag, which seems to be around 0.1 seconds.
This means that the user can see the animation, almost from start to end, before the sound actually starts.
Is there any way for us to reduce the sound buffer size?
Looks like it’s even worse on device, tried it on Dell Venue 8.
This time the animation has time to finish completely before the very first sound is heard
I’m guessing the audio delay is around 0.14 on device and 0.1 on the PC
Replace the character move sound with the sound used on the start screen GUI (stone_large).
Commented out play() in the main GUI and tested the responsiveness of sound on the start screen only.
Put back play(), started the game and tested the responsiveness of sound when the character moves.
There is a clear difference in when the sound plays in these two cases. There is even a difference in responsiveness when moving the character and pressing the “back to menu” GUI element at the top of the screen.
Is it possible that you have some logic running that causes this character move sound lag?
(EDIT: I should also add that we have indeed seen sound lag issues present on certain Android devices. This seems to be a problem with the OS on those devices)
Ok. I compared with other apps on my mac and did not notice any lag at all on the start screen. In game, however, there’s noticable lag, but only on the board - not on the GUI elements. Check that you don’t have some state that is changing over a frame or two.
Recorded using an external mic with my headphones at the mouse on Windows 8, looked at the final waveform to measure delays, rounded to nearest 100:th of a second:
Lag between mouse release and character movement sound:
0.23s
0.21s
0.20s
0.18s
Lag in menu between mouse release and click sound:
0.15s
0.20s
0.19s
0.21s
Not sure if it’s useful, but, there’s some stats in case you need it
Again, not having this issue on my Macbook, this is only on Android and Windows.
I’ll look into some performance fixes to see if it helps, but it looks pretty consistent to me
Just for the record, I just recently started testing my game on a Galaxy S7, and have bad lag on the audio as well; when testing within the Defold editor, sounds occur exactly when they should (e.g., a spaceship runs into an enemy ship and the explosion sound occurs immediately). On the device, there is about a half-second delay. I went back and looked at games I’ve built with other game frameworks, and there seems to be a tiny bit of a delay on the device, but it is virtually unnoticeable…
Hmm, interesting. Would it be possible to isolate this behaviour to a small Defold project and share it with us so we can take a look? I haven’t heard of any complaints from the game teams here at King about audio delays.
I discussed this with @ChristianM last Thursday. The problem is noticeable on BBS canvas as well. “Fixing” sound is quite a big issue, but making the buffer size customizable and separating buffers for music and transient sound should improve the experience for developers quite a bit. There’s currently no decision to actually do this, and no issue in JIRA, but something that is worth mentioning.