Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fall back to parsing the log for the player count #14

Closed
1 task done
opello opened this issue Jan 29, 2024 · 6 comments · Fixed by #17
Closed
1 task done

Fall back to parsing the log for the player count #14

opello opened this issue Jan 29, 2024 · 6 comments · Fixed by #17
Labels
feature-request 🚀 New feature request

Comments

@opello
Copy link

opello commented Jan 29, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Feature description

A rust implementation of a tool created to track currently connected users was posted in the Enshrouded Discord:
https://github.com/jcjolley/enshrouded-player-count

It seems like either using this directly (if sufficient) or adopting the parsing logic put into it to track the player count locally instead of querying the Steam API might be nicer to avoid updating while players are connected.

As I was writing this up it occurred to me that it might be simpler to query the server directly (using the query port) but I haven't looked for an implementation of that yet.

@opello opello added the feature-request 🚀 New feature request label Jan 29, 2024
@cp-fabian-pittroff
Copy link
Member

Hey, thanks for the request. I could try to adopt it with my bash scripts. But I don't know how robust the logic is. It reads the service logs to count every join and exit of a user.

I hoped we get some kind of rcon, so I could get the information strait from that and also do server messaging, to alert users of an upcoming restart.

But I will try fiddling around with that and report back.

@opello
Copy link
Author

opello commented Jan 29, 2024

Thanks for the image, it's been working quite well for me.

Using python-a2s and a simple python -c 'import a2s; print(len(a2s.players(("ip",port))));' seems to work. I tried in a python container alongside the enshrouded-server container, but I expect the "ip" being "127.0.0.1" would work too, if not SERVER_IP.

@cp-fabian-pittroff
Copy link
Member

Thanks for the suggestion. I added the python-a2s script to check for connected players locally. I removed the STEAM_* env vars and added a UPDATE_CHECK_PLAYERS env to enable the check or not.

I'll test it a bit further and merge it afterwards.

@cp-fabian-pittroff
Copy link
Member

@opello If you want you can check this feature with the latest dev or dev-proton image.

@opello
Copy link
Author

opello commented Feb 5, 2024

Thanks! I updated and will do a better test later, but it seems to work:

# PYTHONPATH=/home/enshrouded/.local/lib/python3.10/site-packages python3 -c 'import a2s; print(len(a2s.players(("127.0.0.1",15637))));'
0

@cp-fabian-pittroff
Copy link
Member

Released with version 0.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request 🚀 New feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants