Pages: [1]   Go Down
  Print  
Author Topic: Round Start Event  (Read 528 times) Bookmark and Share
Beta Testers
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 80
Offline Offline
« on: September 11, 2011, 09:28:50 PM »

I was wondering if there is any way to speed up the calling of EVT_GAME_ROUND_START for UrT. It is called a solid 3-4 seconds after the InitRound appears in the server console (in the TS game type).

Here is the code from iourt41:

Code: python
# Start Round
   def OnInitround(self, action, data, match=None):
       self.debug('EVENT: OnInitround')
       options = re.findall(r'\\([^\\]+)\\([^\\]+)', data)

       # capturelimit / fraglimit / timelimit
       for o in options:
           if o[0] == 'mapname':
               self.game.mapName = o[1]
           elif o[0] == 'g_gametype':
               self.game.gameType = self.defineGameType(o[1])
           elif o[0] == 'fs_game':
               self.game.modName = o[1]
           elif o[0] == 'capturelimit':
               self.game.captureLimit = o[1]
           elif o[0] == 'fraglimit':
               self.game.fragLimit = o[1]
           elif o[0] == 'timelimit':
               self.game.timeLimit = o[1]
           else:
               setattr(self.game, o[0], o[1])

       self.verbose('...self.console.game.gameType: %s' % self.game.gameType)
       self.game.startRound()

       self.debug('Synchronizing client info')
       self.clients.sync()

       self.debug('Joining Players')
       self.joinPlayers()

       return b3.events.Event(b3.events.EVT_GAME_ROUND_START, self.game)

Thanks,
Leito
Logged

Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #1 on: September 11, 2011, 10:27:40 PM »

could you provide a b3.log showing what B3 is doing between the time it reads the InitRound line from the game server log and the time it fires the EVT_GAME_ROUND_START event ?

What takes time is either self.clients.sync()  or self.joinPlayers() or both, but we have to make sure moving those actions elsewhere won't cause more trouble
Logged

Beta Testers
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 80
Offline Offline
« Reply #2 on: September 12, 2011, 07:42:49 AM »

I looked at the log and moved some things around so my code is executed first upon that event, but it's still doing a lot of extra stuff before it gets around to my code. Here is part of b3.log where that event is cued. Also, the EVT_CLIENT_JOIN event is getting called every time the TS round begins; is this normal? Its also causing quite a big of delay.

Code:
110912 08:32:15 CONSOLE '1170:43------------------------------------------------------------'
110912 08:32:15 CONSOLE '1170:43InitRound: \\sv_allowdownload\\0-....blah blah blah all my server info here'
110912 08:32:15 DEBUG 'EVENT: OnInitround'
110912 08:32:15 VERBOSE '...self.console.game.gameType: ts'
110912 08:32:15 DEBUG 'Synchronizing client info'
110912 08:32:15 VERBOSE "RCON sending (173.236.38.244:27961) 'status'"
110912 08:32:16 DEBUG 'in-sync 93.104.167.40 == 93.104.167.40'
110912 08:32:16 DEBUG 'in-sync 96.32.81.107 == 96.32.81.107'
110912 08:32:16 DEBUG 'Joining Players'
110912 08:32:16 DEBUG 'Joining {Z9}VanilleOfDead'
110912 08:32:16 VERBOSE 'Queueing event Client Join Team None'
110912 08:32:16 DEBUG 'Joining {C9}Leito{Z9}'
110912 08:32:16 VERBOSE 'Queueing event Client Join Team None'
110912 08:32:16 VERBOSE 'Parsing Event: Client Join Team: LeitoPlugin'
110912 08:32:16 VERBOSE 'Queueing event Game Round Start <b3.game.Game object at 0x2483f10>'
110912 08:32:16 VERBOSE 'Parsing Event: Client Join Team: LeitoPlugin'
110912 08:32:16 DEBUG 'LeitoPlugin: Client gear : GeIOXAA'
110912 08:32:16 DEBUG "LeitoPlugin: Bad gear: ['e', 'O']"
110912 08:32:16 VERBOSE 'Parsing Event: Game Round Start: LeitoPlugin'
110912 08:32:16 VERBOSE "RCON sending (173.236.38.244:27961) 'give 0 gift'"
110912 08:32:16 VERBOSE 'Parsing Event: Game Round Start: PoweradminurtPlugin'
110912 08:32:16 VERBOSE 'Parsing Event: Game Round Start: RewardsPlugin'

The line I care about is the RCON line which is the 3rd from last.

I'm really looking for speed here because my function involves giving gifts to clients at the beginning of each round. Here is my code:

Code: python
elif event.type == b3.events.EVT_GAME_ROUND_START:
       for c in self.console.clients.getList():
           self.distributeGifts(c)

and then:

Code: python
def distributeGifts(self, client):
   if client.isvar(self, 'hasgifts'):
     client.giveGifts(client.var(self, 'hasgifts').value)

Is this the fastest way of distributing the gifts to the clients when the round begins?

Thanks,
Leito
« Last Edit: September 12, 2011, 08:02:41 AM by Leito » Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #3 on: September 12, 2011, 12:28:42 PM »

ok, could you try with this file instead ? iourt41.py and see how it goes ?

changes
Logged

Beta Testers
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 80
Offline Offline
« Reply #4 on: September 13, 2011, 06:06:28 PM »

That works great! Thank you so much for your help.


-Leito
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #5 on: September 13, 2011, 10:18:34 PM »

what's your server ip:port ? I'd like to give it a try Smiley
Logged

Beta Testers
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 80
Offline Offline
« Reply #6 on: September 17, 2011, 01:50:38 PM »

I'd love to show you my server! The one thats running this code is a private development server. Just let me know a time when you want to check it out and I'll be there.

Also, do you have any idea as to why this big of code is not working? It is self._special is a list of player B3 ID's that are pulled from an external .txt file. The code simply sets a client variable if their B3 ID is in the list. But it never works and neither does my command that manually adds clients to the list.

Code executed on EVT_CLIENT_AUTH:
Code: python
def specialCheck(self, client):
   """\
   This checks to see if the client's ID is in our specials.txt
   """
   if str(client.id) in self._special:
     client.setvar(self, 'special')
     self.debug('Client: %s is special. ID: %s' % (client.name, str(client.id)))


Thanks,
Leito
Logged
Senior Dev.
*
OS: Linux
Type: Home user
Posts: 3484
Offline Offline
WWW
Support Specialty: B3-Core, UrT/SmG/BFBC2 parsers, Plugin development
« Reply #7 on: September 17, 2011, 02:54:55 PM »

my advice : test your code snippets using Dream Pie
Logged

Tags:
Pages: [1]   Go Up
  Print  
 
Jump to:  


Rate this page +1 at Google Search


SimplePortal 2.3.1 © 2008-2009, SimplePortal