Right now i’m developing a farm game that have a global time (all user share same time)
As the game have seasons, etc, as the game go on, player can start their game in winter time when they first beginning, etc
Question: What is the best way to control time?
Right now, i plan to create a webserver on my dedicated to control the server
Code will run 24/7 and just sit there to wait for time request function from the app which will return the current time of the server
This will be use to return the request for stamina regen as well
The server will keep track of the last time the user regen their stamina, then when the request came for stamina regen, it will check the current time compare to the previous time, if it’s correct → change the stamina value in the database → return the current stamina value to user
Is this the best approach for this problem?
Need suggestion for people who have already doing this type of time sync
Updated my question : What solution should i use for this kind of game?
I know how to setup a basic rest server c# to handle request but will that able to handle 1000+ players that requesting info at the same time?
I research on google and saw that there are a lot of Network Asset like Ulink, Ugamedb, etc Anyone can recommend me which one is good for this type of game, and is scale-able if the player base grow?
Updated my question : What solution should i use for this kind of game?
I know how to setup a basic rest server c# to handle request but will that able to handle 1000+ players that requesting info at the same time?
I research on google and saw that there are a lot of Network Asset like Ulink, Ugamedb, etc Anyone can recommend me which one is good for this type of game, and is scale-able if the player base grow?
Sounds like my DarkRift (see sig) would be able to handle it but it really seems overkill for just broadcasting the time occasionally… I’m not sure I see why a good REST api wouldn’t be able to cope so long as you weren’t constantly requesting stuff though?
Look at GameSparks. They are a full backend server offering tons of features.
They have system and clock counters on their servers you can use to trigger events, send notifications etc.
You can store your own time variable in the database, and using their hourly or minute events, update the time in the database, and notify the clients, or let the clients request the time.
Store all time in UTC and do all calculations in UTC. Clients don’t need to ‘get’ the time from anywhere, let them use their own time. You just make sure all actions that change data use your server time as being authoritative. If you are dead set on syncing time with the client, then just record the offset between client and server in UTC when the client first loads, and occasionally resync to account for drift.
Clients pounding a server to update the time every second is completely not necessary, don’t do that.
Hi
Katie from GameSparks here.
It sounds like GameSparks could help with your game.
You can create events to trigger, collections to hold data, leader boards ,write cloud code and much more.
We have tutorials online and our customer service team would be happy to help with any questions you have.
Please email info@gamesparks.com for more information and we’ll see what we can do for you.
Cheers
Katie