i have client side game in js that have stage which count down the time in minutes
now i save few steps of the game in server side also .
but i know that sometimes that browser is slow and less responsive so the 4 minutes i count in the server side are not 4 minutes in the client .
how can i make this consist?
so its can't be cheated ?
preguntado el 23 de abril de 13 a las 13:04
Build a keep-alive system. Every 30 seconds or so, send in a time-dependent variable (timestamp or encrypted variation thereof), and get it received by the server. Server calculates the difference, sends back the difference to the client. This way, you know every 30s what the difference is, which allows you to adjust accordingly.
This does not cover for lag - instead, it allows you to adapt. This also does not take into account the time it takes for the request to fire, so take the difference with a pinch of salt.