Average lobby time
- 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
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
- 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
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
- FollowingPath
- Forest Walker
- Posts: 224
- Joined: Fri Aug 01, 2014 12:24 pm
- Has thanked: 17 times
- Been thanked: 38 times
- 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
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
-
- 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
@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
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
- 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
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.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.
Gotta check if that data is available.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.
- 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
-
- 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
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.
Who is online
Users browsing this forum: No registered users and 7 guests