Determine the number of players on the server

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
Salaander
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Apr 05, 2019 10:40 am
Contact:

Determine the number of players on the server

Post by Salaander »

Hi,

I hope I create this topic in the right channel, if not move it please.
I created a server yesterday on DigitalOcean and also a small webpage so I would be able to send the server management to my friends I'm playing with.
So far we played from a local server but I want to move it to a 3rd party.

My plan is to have the VM shut down if there is no activity on the server for X minutes and then if somebody tries to connect to the server (over a domain and proxy I manage) I will auto start the server with the DO API. I wanted to ask what do you think would be the best and most supported way to determine the number of players on the server? I see JOINED and LEAVE are logged but I really would like to avoid log parsing. I thought I might be able to solve it with a LUA mod and write the player list to a file every few tick, but I'm not sure how a good idea it is and if this disables the achievements or not.

Would you share your suggestions and ideas with me please? Maybe it is solved already? If you are interested in the result I can share the setup too.

Best,
Salaander
ctalkep_
Burner Inserter
Burner Inserter
Posts: 16
Joined: Thu Feb 06, 2020 8:00 am
Contact:

Re: Determine the number of players on the server

Post by ctalkep_ »

posting in a 6 year old thread that was first on google
i tried parsing the log and subtracting the [leave]'s from [join]'s but that only works for so long - connecting halfway and then cancelling will only make a [join], adding a phantom player to the counter

think it would need a mod that logs online playercount every so often to do or maybe viewtopic.php?t=81455
Bilka
Factorio Staff
Factorio Staff
Posts: 3420
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Determine the number of players on the server

Post by Bilka »

If you have access to the server's stdin, you can use the /players command, so /players online count or /p o c for short.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Post Reply

Return to “Technical Help”