question

ddiez avatar image
ddiez asked

Server Time Problem

Hello!

I'm developing a realtime battle game and managing the current time in the server is a very important feature for me for cheating prevention.

I've read this topic talking about the clock drift problems in the server due to the scalable online system architecture, as every CloduScriptCall isn't assured to be run in a single machine obviously: https://community.playfab.com/questions/560/207633158-Server-time-problem-.html

I understand the problem but I think that time drifts of around 30 secs aren't feasible for me... I've thought if there is any possibility to know which server instance is running at any time, so I can send the "Server ID" in the response so the client can map every tiem response to every server and separate the outcomes...

Is this possible? Is there another solution for this?

Thank you very much!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Good news! As of our latest update, we've managed to get the clock drift down considerably. In fact, we're down to max of 1 second of drift between servers, so depending on your scenario, you should be able to tighten up the times you use in your logic checks. I'll also promote this to be the top answer, so that folks finding this thread for the first time have the latest info.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Unfortunately, as discussed in the other post, this is common with large-scale distributed servers (again, the reason why XBL and PSN only force-update the client to the server time if they're more than a couple of minutes off from each other). Reviewing our current running servers, they're really only a few seconds off from each other, max. However, it's best to plan for up to 30 seconds of drift, as it's a potential worst-case.

To determine the best way to approach this though, can we start with your actual design goals, and work from there? That would give us the info needed to fully scope the issue and determine all the options. For example, you're saying this is for a "realtime battle game". If it's realtime, you must be using either a system like Photon Cloud, or a dedicated server to manage the battles, so why is that server not able to manage the time effectively? What's the context in which two different servers with differing times could impact your game?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ddiez avatar image
ddiez answered

Thank you for your answer!

That's right, I'll be using Photon Realtime for the battle system, maybe I explained it wrong. My problem is not with the gameplay but with the locked item system I'm developing. I posted this topic a few weeks ago: https://community.playfab.com/questions/878/210301328-Time-Locked-Items.html#answer-3030

When I grant the player that "locked item", I store the opening time in the custom data of the item so I can check it in the client and then call a server function. Of course, that's the point where I need anti cheating checks regarding the time...

So, the only option would be to consider a max 30 secs deviation? I've been desting the time drifts and they are ~24 seconds in some cases...

Thank you very much!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Correct - right now, the drift can be up to 30 seconds across the servers (so, 15 seconds for a single server, but that could mean a max of 30 seconds between two). We are looking at the possibility of a future update to make that less, but that's what I would plan for right now. It sounds like the only real cause for concern is that a hacked client could cheat the system by getting their items to unlock a little bit sooner (given that the drift could be 30 seconds the other direction, trying to cheat by counting on the server being queried being "ahead" of another one wouldn't always work). Are you lock times really so short that this is going to be disruptive to your game?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ddiez avatar image
ddiez answered

Hi Brendan, thank you for your answer. It's ok for my game, since the lock times are >1 hour...

Thank you!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.