Page 1 of 1

Expose game time elapsed in seconds in the multiplayer list API

Posted: Sun Jan 26, 2020 6:40 am
by Hornwitser
I made a graph showing the player counts on the most popular servers on my stats dashboard. It would be cool if I could also get the UPS these servers are running at, this can easily be determined by calculating game time elapsed / real time elapsed * 60. But the game time elapsed that's exposed in the multiplayer API is in whole minutes, which is too low of a precision to be useful. It would be really cool to be able to graph UPS as well.

Re: Expose game time elapsed in seconds in the multiplayer list API

Posted: Sun Jan 26, 2020 7:53 am
by Optera
You can get in game time very precise by grabbing game.tick at two points.
elapsed game seconds will be (tick2 - tick1) / 60

Re: Expose game time elapsed in seconds in the multiplayer list API

Posted: Sun Jan 26, 2020 7:57 am
by Hornwitser
Optera wrote: Sun Jan 26, 2020 7:53 am You can get in game time very precise by grabbing game.tick at two points.
elapsed game seconds will be (tick2 - tick1) / 60
I'm well aware of that, but as you may or may not have noticed I'm monitoring the public server list, not my own servers. I cannot run lua code on these servers.

Re: Expose game time elapsed in seconds in the multiplayer list API

Posted: Sun Jan 26, 2020 4:40 pm
by Optera
How do you get game time elapsed?

Re: Expose game time elapsed in seconds in the multiplayer list API

Posted: Thu Jan 30, 2020 10:47 am
by Hornwitser
Optera wrote: Sun Jan 26, 2020 4:40 pm How do you get game time elapsed?
In the exact same way the game gets the time played that it shows in the multiplayer list; in the response from the multiplayer.factorio.com/get-games endpoint.