Q. [Rhythm Game] Timing is different when testing in Editor

Hi! I’m currently developing Rhythm action game using Unity 3.1.

I usually test my game in PC, and then I do the final test in my Android Device.

But it seems that the background music starts few seconds slower than when testing in PC.

So temporarily I have delayed the time when note starts to appear to make it work as I intended.

But this is only temporary solution so I would like to know how I should resolve this problem.

Since this game is rhythm action game, timings of when music starts and notes appears are VERY important.

I suspect that this problem is caused because of difference in specification between android device and PC.

So I’m worried that this BGM and notes timing problem might occur depends on devices. (such as other android devices, iPhone or other PCs with different spec.)

Is there any good idea to make it work as I intended, no matter what devices am I running my game on?

I wonder whether I have explained it well :S

Thanks in advance.

This might be a bad approach but you could do things in FixedUpdate instead of Update?

I’m doing a rhytm action game too :).
I use the time of the music AudioSource.timeSamples or AudioSource.time instead of Game time.
If the music is delayed, the game event is delayed too.
But I haven’t tested this solution in depth.

As mentioned by Hercule, you’ll need to do your synchronization manually to avoid differences in devices. You can key off the sound, or adjust your methods, audio, etc, off something like framerate. While frame rates change by device, on a specific device they should be consistent. There are some examples in the Unify script wiki under iPhone optomization:

http://www.unifycommunity.com/wiki/index.php?title=IPhone_Optimization_Tips

Hope that helps,

Galen

Thanks earl and Hercule! actually I managed to use the methods that both of you suggested! use AudioSource.time on FixedUpdate! XD

and surprise surprise! it works very well. There’s very minor timing difference, but it’s not as big so that might influence the gameplay! Thanks again. :slight_smile:

Hi, guys! :slight_smile: unitygirl, I just want to know if you use instantiation for the notes or manually plotted them? We tried to build a game like that before by manually plotting the notes and let them move downwards. I want to know a different method aside from plotting the notes. Thanks! :smile:

Or, anyone, who knows, please explain it to me. :slight_smile: