Average lobby time

Talk all you want about Island Defense here.
Lynx
Donator
Posts: 1224
Joined: Thu Oct 31, 2013 11:49 am
Has thanked: 51 times
Been thanked: 46 times

Average lobby time

Postby Lynx » Mon Oct 26, 2015 6:42 pm

What's the average lobby time of id lobbies? The median value would also be interesting to know.

User avatar
aRt)Y
Protector of Nature
Posts: 13142
Joined: Fri May 03, 2013 9:15 pm
Has thanked: 10 times
Been thanked: 174 times
Contact:

Re: Average lobby time

Postby aRt)Y » Mon Oct 26, 2015 7:49 pm

Can pull dat data tomorrow night or by the weekend.
    Information, Rules, Guides and everything else you need to know about ENT is on the ENT Wiki.
      Ignorantia juris non excusat • Quis custodiet ipsos custodes? • Fallacy of composition

Lynx
Donator
Posts: 1224
Joined: Thu Oct 31, 2013 11:49 am
Has thanked: 51 times
Been thanked: 46 times

Re: Average lobby time

Postby Lynx » Mon Oct 26, 2015 7:56 pm

Thanks

User avatar
aRt)Y
Protector of Nature
Posts: 13142
Joined: Fri May 03, 2013 9:15 pm
Has thanked: 10 times
Been thanked: 174 times
Contact:

Re: Average lobby time

Postby aRt)Y » Tue Oct 27, 2015 5:18 pm

Actually, such data is not logged.
    Information, Rules, Guides and everything else you need to know about ENT is on the ENT Wiki.
      Ignorantia juris non excusat • Quis custodiet ipsos custodes? • Fallacy of composition

Lynx
Donator
Posts: 1224
Joined: Thu Oct 31, 2013 11:49 am
Has thanked: 51 times
Been thanked: 46 times

Re: Average lobby time

Postby Lynx » Tue Oct 27, 2015 6:08 pm

GG.

User avatar
FollowingPath
Forest Walker
Posts: 224
Joined: Fri Aug 01, 2014 12:24 pm
Has thanked: 17 times
Been thanked: 38 times

Re: Average lobby time

Postby FollowingPath » Tue Oct 27, 2015 7:22 pm

It doesn't log the amount of games created each day?
Image
Image
Image
Image

User avatar
aRt)Y
Protector of Nature
Posts: 13142
Joined: Fri May 03, 2013 9:15 pm
Has thanked: 10 times
Been thanked: 174 times
Contact:

Re: Average lobby time

Postby aRt)Y » Tue Oct 27, 2015 7:25 pm

That data can be pulled. Though, you can't tell the avg. wating time as games can fill fast at a certain time and just one game waiting in limbo later on.
    Information, Rules, Guides and everything else you need to know about ENT is on the ENT Wiki.
      Ignorantia juris non excusat • Quis custodiet ipsos custodes? • Fallacy of composition

Lynx
Donator
Posts: 1224
Joined: Thu Oct 31, 2013 11:49 am
Has thanked: 51 times
Been thanked: 46 times

Re: Average lobby time

Postby Lynx » Tue Oct 27, 2015 8:11 pm

You can tell the average lobby from that info, but not the median. Which might be more interesting.

Stealer
Protector of Nature
Posts: 3160
Joined: Thu Sep 26, 2013 9:37 pm
Has thanked: 18 times
Been thanked: 47 times

Re: Average lobby time

Postby Stealer » Tue Oct 27, 2015 11:27 pm

@art)y Can't you just compute it?

You know when the game ended, the length of the game => Start of game
The end of the last game - the start of the next gives you the lobby time.

You'll have to do some logic so that it compares the start of ID#65 to the end of ID#64 since games don't always end in order.

--
@art)y Can't you just compute it?

Each lobby has periodic messages for the number of players ("[System]: Waiting for 9 more players before the game will automatically start. (http://www.entgaming.net)"). Count the number of times that shows up and you should get the length of the lobby +/- like 15 seconds.


Sample lobby:: http://storage.entgaming.net/replay/download.php?f=6698771.txt&fc=6698771.txt

User avatar
aRt)Y
Protector of Nature
Posts: 13142
Joined: Fri May 03, 2013 9:15 pm
Has thanked: 10 times
Been thanked: 174 times
Contact:

Re: Average lobby time

Postby aRt)Y » Wed Oct 28, 2015 6:37 am

Stealer wrote:Each lobby has periodic messages for the number of players ("[System]: Waiting for 9 more players before the game will automatically start. (http://www.entgaming.net)"). Count the number of times that shows up and you should get the length of the lobby +/- like 15 seconds.
That info is stored in files and the logs (of which the latter one gets erased/overwritten after x days). So nop, I cant do that.

You know when the game ended, the length of the game => Start of game
The end of the last game - the start of the next gives you the lobby time.
Gotta check if that data is available.
    Information, Rules, Guides and everything else you need to know about ENT is on the ENT Wiki.
      Ignorantia juris non excusat • Quis custodiet ipsos custodes? • Fallacy of composition

Stealer
Protector of Nature
Posts: 3160
Joined: Thu Sep 26, 2013 9:37 pm
Has thanked: 18 times
Been thanked: 47 times

Re: Average lobby time

Postby Stealer » Fri Oct 30, 2015 9:37 pm

Code: Select all

from bs4 import BeautifulSoup #pip3 install beautifulsoup4
from enum import Enum
import re
from datetime import datetime
from datetime import timedelta

from urllib3 import PoolManager
import certifi

class web_adapter():
   
    def __init__(self):
        self.http = PoolManager(headers={'User Agent': "art/0"}
                                , cert_reqs='CERT_REQUIRED' # Force certificate check.
                                , ca_certs=certifi.where()  # Path to the Certifi bundle.)
                            )
       
    def get(self,url,data=None,headers={}):
        r = self.http.request(method='GET', url=url, fields=data, headers=headers)
        return r.data.decode("utf-8")
       
    def post(self,url,data,headers={}):
        r = self.http.request(method='POST', url=url, fields=data, headers=headers)
        return r.data.decode("utf-8")

class STATS_GAME_TYPE(Enum):
    islandDefense = 1
   
    @classmethod
    def get_url(self, game_type):
        if game_type == STATS_GAME_TYPE.islandDefense:
            return "https://entgaming.net/customstats/islanddefense/games/"


class stats_adapter():
    def __init__(self):
        self.web = web_adapter()
   
    # https://entgaming.net/customstats/islanddefense/games/
    # https://entgaming.net/customstats/islanddefense/games/2/
   
    def _get_games(self,url):
        games = []
       
        raw_html = self.web.get(url)
        soup = BeautifulSoup(raw_html, "html.parser")
        table = soup.find_all('table')
        trs = table[0].find_all('tr')
       
        for i in range(1,len(trs)-1):
            tds = trs[i].find_all('td')
           
            try:
                game_id = re.findall('.*/([0-9]+)/',tds[0].find('a')['href'])[0]
                game_no = re.findall('#([0-9]+)', tds[0].text)[0]
                type =  tds[1].text
                regexexp = re.findall('[0-9]+',tds[2].text)
                duration = 0
                for i in range(0, len(regexexp)):
                    duration += (60 ** (len(regexexp) - i - 1))*(int(regexexp[i]))
                date = datetime.strptime(tds[3].text,'%d/%m/%Y, %H:%M')
               
                games.append(  { 'game_id' : game_id
                               , 'game_no': game_no
                               , 'type' : type
                               , 'duration' : duration
                               , 'end_date' : date
                               , 'start_date': date - timedelta(seconds=duration)
                               , 'creator' : tds[4].text
                               })
            except:
                pass
           
        return games
   
    def get_games(self,game_type,max_pages=50):
        games = []
        page = 1
        while page <= max_pages:
            while len(games) > 0:
                yield games.pop()
            url = STATS_GAME_TYPE.get_url(game_type)+str(page)+"/"
            games = self._get_games(url)
            page = page + 1


games = []
lobby_times = []
for x in stats_adapter().get_games(game_type=STATS_GAME_TYPE.islandDefense, max_pages=20):
    games.append(x)

games.sort(key=lambda g: g['start_date'], reverse=True)
for i in range(0, len(games)-1):
    lobby_times.append((games[i]['start_date'] - games[i+1]['start_date']).total_seconds()) # seconds is the resolution

print(len(games))
print((sum(lobby_times)/len(lobby_times))) # seconds / lobby


@art)y the date provided on the stats page is end of game and the stats page also provides duration of the game.
Subtract end date by duration and you get the start time (with resolution in seconds).

Just take the above script and modify max pages to be whatever you want.

At 20 you get that each lobby is roughly 1/2 hour.
@lynx you'd need Python3 and to install beautifulsoup4 but the lobby_times global is a list of numbers so you can do w.e stats you want.


Return to “Island Defense”

Who is online

Users browsing this forum: No registered users and 7 guests