Comments (4)
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.
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.
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 :)
Therefore I would suggest that parsers implement
getPlayerPing(player_id)
This change would break backward compatibility and break 3rd party plugins.
or even better, the client get an attribute with the name 'ping' (which would still include a getPlayerPing).
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 Client.ping
this will force one rcon query per client, but for some game this can be a lot more expensive than making one rcon call which returns all player pings at once.
If a game parser needs to address this issue for a particular game, it would have to monkey patch the Client.ping
attribute getter implementation ; while if we keep the ping info access only from the getPlayerPing
parser method, we let game specific implementation tuning where it belongs : the game parser.
Do you see what I mean with that point ?
from big-brother-bot.
Thanks for your remarks.
Currently, I have implemented the following for test:
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
from big-brother-bot.
That's for BF3 isn't it ?
Would you mind renaming client_ids
to filter_client_ids
in your pull requests and also update the B3 core parser.py file with the new signature ?
from big-brother-bot.
That's for BF3 isn't it ?
You know my games ;)
I make the update and pull request soon.
from big-brother-bot.
Related Issues (20)
- redirect stdout crash with KeyError: \'admin\'\\n"' HOT 1
- DB conntion ERROR HOT 10
- Error: Could not parse line no such group HOT 13
- Changing colors HOT 4
- XLRStats Webfront V3 tab-content not loading HOT 1
- Not parsing dark blue (the ";" color code) in MW3
- DB connecting failed HOT 19
- ERROR 'Query failed [SELECT clients.time_edit, MAX(xlr_playerstats.skill) HOT 2
- No error but not working HOT 2
- XLRStats Webfront v3 issue HOT 2
- banlist_v2.dat HOT 1
- B3 on rented gameserver HOT 4
- b3.distribution.ini is the name of config file but b3 expects b3.ini by default HOT 3
- [WOP] Could not parse line no such group
- plugins not working for cod4x HOT 1
- b3 not working
- 'STDERR "ValueError: invalid literal for int() with base 10: \'senioradmin\'\\n"' HOT 1
- B3 Sending multiple messages HOT 4
- B3 Config Generator Web Files - Latest Hosted Somewhere?
- Connecting to DB : FAILED! HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from big-brother-bot.