server communication and time management

0 favourites
  • 1 posts
From the Asset Store
Manage time and money, plan the best strategy to make all the customers happy in your restaurant, a hotel, cafe, or any
  • Status:

    I have a game that communicates with server from time to time via ajax.

    I need the game to know all in every tick, what is the server time.

    What I tried:

    1) I tried sending server time to game, set a global variable "now" to this value, and in every tick add dt to "now" with no luck, because when game goes out of focus, this will break (c2 pauses)

    2) I tried messing with wallclocktime, sent server time to game, set a global variable "server_time" to this value minus current wallclocktime on receive and every tick set a "now" global variable to "server_time" + wallclocktime. My logic tells me this _should_ work, but it doesnt, every time I get new current time from server, "now" goes back around 10 - 20 seconds. why?

    any ideas would be greatly appreciated.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)