- Home /
How to Synchronize Play Services Real-Time Multiplayer
Hello,
I have a cross platform real-time multiplayer project. I have synchronization problem between iOS and Android devices. There is no huge differences but, there is a little bit differences and this causes problems in the game. The game should proceed on both platform at the same time. How can i solve this synchronization problem? I searched it on the Internet and i couldn't find enough information.
Yes, they all connect to the same server which is server of Google Play Game Services. Game proceeds as this; for instance when the game is started, both characters(one of them is connected from android device and the other one is connected from iOS device) starts running automatically and it seems that the character which is on Android device, goes in front of the other character which runs in iOS device. Both of the characters speed is the same but their position is different in the game. They should go in the same line. I need to do something like; 3-2-1 and Go and both device should take the signal from the server(this is just an example of a way to solve this problem but i don't know how to do that) and starts running according to this signal.
About lag; actually there is no lag. Just a little bit difference of working of the game and i need to synchronize game to solve this.
Thank you so much!
Hi There,
I was wondering if you managed to find a solution to this issue.
I'm working on a similar setup (3-2-1-GO) and depending on network speeds the various players end up having various degrees of lag.
Any pointer?
Cheers Cre
Hi Rastacre,
I couldn't find any solution because i hold over that project after this issue. But if i find any solution to this, i will try to explain that in here.
Hey Bekiryanik,
thanks for your reply.
I started tinkering with this problem and I came up with an idea, but still didn't have a chance to implement it.
So the idea is:
when all the participants connect the one that initiate the game sends out a packet with the game settings for the current game
when the other players receive the packet they all send back a ready state packet telling the host they are ready to go.
On receive the host sends back its own ready packet and once everyone is on the ready state the game starts
All the packets must be sent as reliable here to make sure they arrive and they also arrive in sequence.
There is one issue with this: when the hosts sends the last ready packet, the hosts itself knows it is ready to go (and all the participants) but we don't know if and when the other participants will receive the ready packets themselves... so this might sync the participants but still have the host starting the game earlier.
Anyway I'll try to come up with something more concrete and I'll let you know if I find a solution.
Cheers
I found something:
http://www.raywenderlich.com/89724/creating-cross-platform-multiplayer-game-unity-part-4
this is part 4 of a whole tutorial based on the Google Play Games services. It's pretty good, loads of solutions to various problems.
Somewhere at toward the end there's a section called:
Synchronizing Game Start
Which has a much more complex, but better solution that the one I came up with... :)
Hope this helps.
Cheers
Your answer
![](https://koobas.hobune.stream/wayback/20220613184650im_/https://answers.unity.com/themes/thub/images/avi.jpg)