-
Notifications
You must be signed in to change notification settings - Fork 143
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
Feature getPlayerPing #58
Comments
Although send a rcon request to the Frostbite(2) engine for each player is not a traffic issue, this rcon spaming can be with Q3 game engine which usually support only 2 queries per second.
It is a good idea IMHO as adding an optional parameter would make this change backward compatible. Current signature is def getPlayerPings(self):
"""\
returns a dict having players' id for keys and players' ping for values
"""
# TODO implementation I would then see : def getPlayerPings(self, filter_client_id=None):
"""\
returns a dict having players' id for keys and players' ping for values.
If filter_client_id is an iterable, only return values for the given client ids.
"""
# TODO implementation Any pull request for such a change is welcome :)
This change would break backward compatibility and break 3rd party plugins.
This would make the ping info closer to the client but I'm afraid that if more and more code from both the B3 core and plugins start to use the If a game parser needs to address this issue for a particular game, it would have to monkey patch the Do you see what I mean with that point ? |
Thanks for your remarks. def getPlayerPings(self, client_ids=None):
"""Ask the server for a given client's pings
:param clients_id: list of client ids
"""
pings = {}
if not client_ids:
client_ids = [client.cid for client in self.clients.getList()]
for cid in client_ids:
try:
words = self.write(("player.ping", cid))
pings[cid] = int(words[0])
except ValueError:
pass
except Exception, err:
self.error("could not get ping info for player %s: %s" % (cid, err), exc_info=err)
return pings |
That's for BF3 isn't it ? |
You know my games ;) I make the update and pull request soon. |
I made some thoughts about the player pings.
Currently, B3 get all pings with ´´´console.getPlayerPings´´´.
This causes a lot of traffic which we not always need.
Most parsers fire for each player a single command to the server.
I wanted
getPlayerPings()
to expand the parametersclient_ids = None
so that we can pass a list of client id's. This should be done for all parser and would also make it a lot broken. So rather a bad idea.Therefore I would suggest that parsers implement
getPlayerPing(player_id)
or even better, the client get an attribute with the name 'ping' (which would still include a getPlayerPing).What is your opinion on this?
The text was updated successfully, but these errors were encountered: