pterodactyl / panel

Pterodactyl® is a free, open-source game server management panel built with PHP, React, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to end users.
https://pterodactyl.io
Other
6.51k stars 1.61k forks source link

Regex-based player counting #1216

Closed tenten8401 closed 6 years ago

tenten8401 commented 6 years ago

Maybe we could have a configurable set of regex queries per egg, that when set could keep count of the online players on the server?

For example, I could set my Minecraft egg to match "(.*) joined the game.". It'd match that query and increment the player counter. image

I'd also have one for "(.*) left the game.", with the same concept as above. We wouldn't be able to pull the max player-count but that'd be alright for the most part.

It should be configurable per-egg, with the option to turn it off for things like Discord bots or games that don't properly log player join/leave events.

It should also be a full-line match rather than just matching partial text in a line, that way chat or other events can't interfere with the playercount.

List of games that I know log player activity:

Ark: Survival Evolved would be an example of a game that you'd have to disable it on, due to the lack of an RCON wrapper for it.

It should be fairly easy to implement, at least I would think. It'd be nice to see how this impacts CPU usage, but I don't think it'd be too much of a problem unless you're streaming several MB per second through the logs.

tenten8401 commented 6 years ago

An interesting alternative someone pointed out would also be the GameQ PHP library, which is also available as a composer package: https://github.com/Austinb/GameQ

Looks like it supports quite a few games and would definitely be a good option for a "real" query system, with regex being a fallback. It's quite a mature project too so it's not like we'd be adding something that wouldn't be super reliable.

Here's a list of supported servers for GameQ: https://github.com/Austinb/GameQ/wiki/Supported-servers-list-v3.

It includes all the games in my list, including Ark: Survival Evolved, except for Factorio.

stanjg commented 6 years ago

I think I was the one suggesting GameQ, however this regex-based system is actually pretty clever.

However what if the server is spitting out errors with speeds of hundreds of lines per second, to see if there's a match for every line would certainly take some computing power.

tenten8401 commented 6 years ago

Yeah, performance would definitely be an issue with high-output gameservers. GameQ would be the better option if it could be implemented.

DaneEveritt commented 6 years ago

I'm not doing a regex based system. Thats a nightmare to maintain and only going to lead to issues down the road, especially if a game changes the output, floods the logs, or doesn't log anything at all. If you want to suggest something like GameQ please open a different issue specifically targeting that feature.