i joined a team that want to create a “simple” rts Game, based on browsergame mechanics.
Means - you create buildings and units in real world time (means buildtime can me multiple days…etc), fight other players and such things…
now we are 4 guys, asking each other how the time system of a browsergame is working for MAAAANY players…
f.e. see Space Pioneers:
You hit a button to build/upgrade a building, and the timer starts. The time is realtime - on the screen, Solar-reactor takes 1 minute and 55 seconds to build. Each level of a building/unit takes longer.
I´m not really experienced in browesergames… soo…
how is such a time system working?
Is it updating the time each second? each time the menü is opened? how is the remaining time calculated? Is a heavy server needed for (let´s say) a few thousand players?
Server side calculations…How i would imagine is they store your starting time of upgrade/build in database then use your current time in pc and then calculate rest of time on your pc. Or calculate all on server wich cost much more server perfomance. It could be done in both ways.
yes, that was my friends first thought.
But - i think it´d be much easier to cheat when using PC time…
We can use the servertime, but worried about how slow the server will react with many players. So we thought of webplayer calculation (no standalone version).
We use an upgraded Virtual Server Windows XXL 4.0 from hosteurope right now - means 4GB Ram, 2 vCores, 500 GB space…
Webplayer can be also easy to hack, its still in pc memory. Hmm receiving server time is not that big opreration to cause problems i think. But that’s only my opinion, lets hear some more adequate person for this
I hope someone can help us out here
Cause the time is not the only thing that makes us headaches… The second great problem is: “How to make the server givinbg resources to the players - even if they are offline?”
You could do that with cron jobs that updates certain values in database, I believe most browser games do this in the backend (saw only few crappy PHP browser game engines, so it may work differently in case of e.g. FarmVille).