Expose game time elapsed in seconds in the multiplayer list API

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
Hornwitser
Fast Inserter
Fast Inserter
Posts: 205
Joined: Fri Oct 05, 2018 4:34 pm
Contact:

Expose game time elapsed in seconds in the multiplayer list API

Post 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.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

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

Post 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

Hornwitser
Fast Inserter
Fast Inserter
Posts: 205
Joined: Fri Oct 05, 2018 4:34 pm
Contact:

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

Post 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.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

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

Post by Optera »

How do you get game time elapsed?

Hornwitser
Fast Inserter
Fast Inserter
Posts: 205
Joined: Fri Oct 05, 2018 4:34 pm
Contact:

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

Post 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.

Post Reply

Return to “Ideas and Suggestions”