Forum Multiplayer Timer Time

Discussion and help relating to the PlayerIO Multiplayer API.

Timer Time

Postby Col » October 25th, 2017, 10:20 pm

Hello Guys,

I am developing an 1 vs 1 Game with a changing turn system: After Player1 it is Player2's turn.

Now I have a Timer which is a Countdown from 15 seconds.
Now I want to send all Players the current Countdown Time (for example: if 9 seconds are left all player should know about that)
How can I get the current Timer time from the serverside code?

Sorry for my bad english :D

Best Regards
Col ^^
Col
 
Posts: 4
Joined: October 1st, 2017, 1:11 pm

Re: Timer Time

Postby Henrik » October 25th, 2017, 10:32 pm

The easiest solution is to count down the time in each game client. It's going to be as accurate as sending a timer message every second anyway.

Remember that you need to allow for the network roundtrip time between the server and the clients. When a game starts on the server, and you send a "game started" message to your clients, it will take some time for that message to reach them, so they won't know the game started at the same time it actually started. So if you stop the game after 15 seconds server time, each client might only have had 14.5 seconds of game time, or something.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm


Return to Multiplayer



cron