Dominion Strategy Forum

Please login or register.

Login with username, password and session length
Pages: 1 [2]  All

Author Topic: 50 people rooms should help us find games  (Read 13222 times)

0 Members and 1 Guest are viewing this topic.

LastFootnote

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7495
  • Shuffle iT Username: LastFootnote
  • Respect: +10722
    • View Profile
Re: 50 people rooms should help us find games
« Reply #25 on: July 27, 2013, 01:20:06 pm »
+1

I may be misremembering, but it was my understanding that the room system was built to deal with server load issues.

I have no idea why that would help, though, unless different rooms run on different servers.
Logged

jonts26

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2746
  • Shuffle iT Username: jonts
  • Respect: +3671
    • View Profile
Re: 50 people rooms should help us find games
« Reply #26 on: July 27, 2013, 01:28:20 pm »
+7

I may be misremembering, but it was my understanding that the room system was built to deal with server load issues.

I have no idea why that would help, though, unless different rooms run on different servers.

It's a pretty crappy server if it can only handle 50 people.
Logged

Kirian

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7096
  • Shuffle iT Username: Kirian
  • An Unbalanced Equation
  • Respect: +9413
    • View Profile
Re: 50 people rooms should help us find games
« Reply #27 on: July 27, 2013, 01:51:16 pm »
0

I may be misremembering, but it was my understanding that the room system was built to deal with server load issues.

I have no idea why that would help, though, unless different rooms run on different servers.

It's a pretty crappy server if it can only handle 50 people.

Back when I played WOW, there were routinely several thousand people on the server.  Now sure that's a different sort of game, and Blizzard was running ultra high end servers.  But 50?
Logged
Kirian's Law of f.DS jokes:  Any sufficiently unexplained joke is indistinguishable from serious conversation.

dondon151

  • 2012 US Champion
  • *
  • Offline Offline
  • Posts: 2522
  • Respect: +1856
    • View Profile
Re: 50 people rooms should help us find games
« Reply #28 on: July 28, 2013, 08:10:36 pm »
+10



Am I doing this right?
Logged

michaeljb

  • Board Moderator
  • *
  • Offline Offline
  • Posts: 1422
  • Shuffle iT Username: michaeljb
  • Respect: +2115
    • View Profile
Re: 50 people rooms should help us find games
« Reply #29 on: July 28, 2013, 08:37:52 pm »
+2

So, seeing this thread reminded me of something nutki said in one of the last messages I received from him...

(btw, because of this line goko code is already n^2)

> open Chrome
> go to playdominion.com
> open up the developer tools
> click on the sources tab
> open lib/FS.MeetingRoom.Dominion.js
> line 6018 is the start of a function, onPlayerListChange; this is called every time a player enters the lobby (and maybe leaves too?)
> line 6061: "var currentRomPlayers = $('.fs-player-list li').length,"
> this means the number of players in the current lobby is counted every time a player is added
> that counting is O(N), where N is the number of players
> simply displaying the the player list turns out to be O(N^2)

Perhaps this is the real issue?

Logged
🚂 Give 18xx games a chance 🚂

StrongRhino

  • Witch
  • *****
  • Offline Offline
  • Posts: 468
  • Shuffle iT Username: StrongRhino
  • Respect: +247
    • View Profile
Re: 50 people rooms should help us find games
« Reply #30 on: July 28, 2013, 08:46:40 pm »
+2



Am I doing this right?
It'd probably work better with no "We" and no second part, like the first Advisor meme. Like the Advisor is telling the king- "Psst, make rooms cap at 50"

I know you didn't really want advice, but whatever.
Logged

ragingduckd

  • Board Moderator
  • *
  • Offline Offline
  • Posts: 1059
  • Respect: +3527
    • View Profile
Re: 50 people rooms should help us find games
« Reply #31 on: July 28, 2013, 10:15:45 pm »
0

So, seeing this thread reminded me of something nutki said in one of the last messages I received from him...

(btw, because of this line goko code is already n^2)

> open Chrome
> go to playdominion.com
> open up the developer tools
> click on the sources tab
> open lib/FS.MeetingRoom.Dominion.js
> line 6018 is the start of a function, onPlayerListChange; this is called every time a player enters the lobby (and maybe leaves too?)
> line 6061: "var currentRomPlayers = $('.fs-player-list li').length,"
> this means the number of players in the current lobby is counted every time a player is added
> that counting is O(N), where N is the number of players
> simply displaying the the player list turns out to be O(N^2)

Perhaps this is the real issue?

I don't think N is really very large here. Anybody who is actually playing neither generates nor receives lobby updates.
« Last Edit: July 28, 2013, 10:17:18 pm by ragingduckd »
Logged
Salvager Extension | Isotropish Leaderboard | Game Data | Log Search & other toys | Salvager Bug Reports

Salvager not working for me at all today. ... Please help! I can't go back to playing without it like an animal!

Kirian

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7096
  • Shuffle iT Username: Kirian
  • An Unbalanced Equation
  • Respect: +9413
    • View Profile
Re: 50 people rooms should help us find games
« Reply #32 on: July 28, 2013, 11:21:30 pm »
0

But in a 200 player lobby, a function that runs in O(N^2) starts to get unwieldy.  There are ways around this, the most common of which is not to write functions that take that long to run.  Which could have been done here I'm sure.
Logged
Kirian's Law of f.DS jokes:  Any sufficiently unexplained joke is indistinguishable from serious conversation.

SCSN

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2227
  • Respect: +7140
    • View Profile
Re: 50 people rooms should help us find games
« Reply #33 on: July 29, 2013, 06:23:01 am »
+17



So Goko did in fact do a pretty remarkable job ;)
Logged

Tombolo

  • Tactician
  • *****
  • Offline Offline
  • Posts: 439
  • Respect: +450
    • View Profile
Re: 50 people rooms should help us find games
« Reply #34 on: July 29, 2013, 09:43:10 am »
0

I just play bots!
Logged
We’ve had a hard day at work, we’ve been looking forward to our Dominion, how can you expect us to play anything else, you ogre.

LastFootnote

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7495
  • Shuffle iT Username: LastFootnote
  • Respect: +10722
    • View Profile
Re: 50 people rooms should help us find games
« Reply #35 on: July 29, 2013, 10:03:40 am »
+2



Sorry, but n^2 is not 2^n. Not even close.
Logged

SCSN

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2227
  • Respect: +7140
    • View Profile
Re: 50 people rooms should help us find games
« Reply #36 on: July 29, 2013, 10:36:41 am »
0



Sorry, but n^2 is not 2^n. Not even close.

It might help to not edit out the part where I implied that.
Logged

Kirian

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7096
  • Shuffle iT Username: Kirian
  • An Unbalanced Equation
  • Respect: +9413
    • View Profile
Re: 50 people rooms should help us find games
« Reply #37 on: July 29, 2013, 10:58:08 am »
+4



Sorry, but n^2 is not 2^n. Not even close.

Remember, Advisor doesn't actually give good advice...
Logged
Kirian's Law of f.DS jokes:  Any sufficiently unexplained joke is indistinguishable from serious conversation.

LastFootnote

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7495
  • Shuffle iT Username: LastFootnote
  • Respect: +10722
    • View Profile
Re: 50 people rooms should help us find games
« Reply #38 on: July 29, 2013, 11:06:27 am »
0



Sorry, but n^2 is not 2^n. Not even close.

Remember, Advisor doesn't actually give good advice...

Right, fair enough. I guess I just don't consider "Displaying the player-list is NP-Hard" to be advice. He's not telling the guy to do something. He's just lying.
Logged

markusin

  • Cartographer
  • *****
  • Offline Offline
  • Posts: 3846
  • Shuffle iT Username: markusin
  • I also switched from Starcraft
  • Respect: +2437
    • View Profile
Re: 50 people rooms should help us find games
« Reply #39 on: July 29, 2013, 07:41:23 pm »
0

So, seeing this thread reminded me of something nutki said in one of the last messages I received from him...

(btw, because of this line goko code is already n^2)

> open Chrome
> go to playdominion.com
> open up the developer tools
> click on the sources tab
> open lib/FS.MeetingRoom.Dominion.js
> line 6018 is the start of a function, onPlayerListChange; this is called every time a player enters the lobby (and maybe leaves too?)
> line 6061: "var currentRomPlayers = $('.fs-player-list li').length,"
> this means the number of players in the current lobby is counted every time a player is added
> that counting is O(N), where N is the number of players
> simply displaying the the player list turns out to be O(N^2)

Perhaps this is the real issue?
Hold the phone! Can someone help me clear this up? Is $('.fs-player-list li') a Javascript array? It seems to me like that recalculating runs in O(N) time, since it apparently has to find the largest index key to determine the length.

My real question is, if it is an array, doesn't the O(N) updating of the length property get calculated whenever the size increases anyway, thereby resulting in O(N^2) time no no matter what you do? The post I quoted seems to suggest that not asking for the length property prevents this counting from happening. That doesn't sound right.
Logged

michaeljb

  • Board Moderator
  • *
  • Offline Offline
  • Posts: 1422
  • Shuffle iT Username: michaeljb
  • Respect: +2115
    • View Profile
Re: 50 people rooms should help us find games
« Reply #40 on: July 29, 2013, 07:46:42 pm »
0

Hold the phone! Can someone help me clear this up? Is $('.fs-player-list li') a Javascript array? It seems to me like that recalculating runs in O(N) time, since it apparently has to find the largest index key to determine the length.

My real question is, if it is an array, doesn't the O(N) updating of the length property get calculated whenever the size increases anyway, thereby resulting in O(N^2) time no no matter what you do? The post I quoted seems to suggest that not asking for the length property prevents this counting from happening. That doesn't sound right.

$('.fs-player-list li') traverses the DOM and returns an array containing all the elements matching the selector (ie, list items in the player list).

I'm pretty sure simply storing the count and incrementing/decrementing by 1 when someone enters/leaves would work, and would definitely be faster than recounting every time.
Logged
🚂 Give 18xx games a chance 🚂

LastFootnote

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 7495
  • Shuffle iT Username: LastFootnote
  • Respect: +10722
    • View Profile
Re: 50 people rooms should help us find games
« Reply #41 on: July 29, 2013, 07:52:31 pm »
0

Hold the phone! Can someone help me clear this up? Is $('.fs-player-list li') a Javascript array? It seems to me like that recalculating runs in O(N) time, since it apparently has to find the largest index key to determine the length.

My real question is, if it is an array, doesn't the O(N) updating of the length property get calculated whenever the size increases anyway, thereby resulting in O(N^2) time no no matter what you do? The post I quoted seems to suggest that not asking for the length property prevents this counting from happening. That doesn't sound right.

$('.fs-player-list li') traverses the DOM and returns an array containing all the elements matching the selector (ie, list items in the player list).

I'm pretty sure simply storing the count and incrementing/decrementing by 1 when someone enters/leaves would work, and would definitely be faster than recounting every time.

I'm not much of a networking guy, but how would you tell when somebody leaves if they don't actually click the little home button? If they just kill their browser, it shouldn't kick off any events, right?
Logged

michaeljb

  • Board Moderator
  • *
  • Offline Offline
  • Posts: 1422
  • Shuffle iT Username: michaeljb
  • Respect: +2115
    • View Profile
Re: 50 people rooms should help us find games
« Reply #42 on: July 29, 2013, 07:58:21 pm »
0

Looks like it doesn't, and I don't know off the top of my head how you'd tell, and Goko definitely hasn't figured it out (just did a test with Chrome and Firefox, after closing Firefox the account that had been logged in there was still visible in the lobby player list on Chrome).

Looks like there's an onunload event.

http://www.w3schools.com/jsref/event_onunload.asp
http://stackoverflow.com/questions/1631959/browser-window-close-event
« Last Edit: July 29, 2013, 08:02:49 pm by michaeljb »
Logged
🚂 Give 18xx games a chance 🚂

markusin

  • Cartographer
  • *****
  • Offline Offline
  • Posts: 3846
  • Shuffle iT Username: markusin
  • I also switched from Starcraft
  • Respect: +2437
    • View Profile
Re: 50 people rooms should help us find games
« Reply #43 on: July 29, 2013, 08:07:54 pm »
0

Hold the phone! Can someone help me clear this up? Is $('.fs-player-list li') a Javascript array? It seems to me like that recalculating runs in O(N) time, since it apparently has to find the largest index key to determine the length.

My real question is, if it is an array, doesn't the O(N) updating of the length property get calculated whenever the size increases anyway, thereby resulting in O(N^2) time no no matter what you do? The post I quoted seems to suggest that not asking for the length property prevents this counting from happening. That doesn't sound right.

$('.fs-player-list li') traverses the DOM and returns an array containing all the elements matching the selector (ie, list items in the player list).

I'm pretty sure simply storing the count and incrementing/decrementing by 1 when someone enters/leaves would work, and would definitely be faster than recounting every time.
Ah, That makes sense. I suppose it would be possible to store some count variable, since the size should only increase/decrease by 1 each time. That could lead to a whole bunch of tracking issues though. At any rate, it shouldn't matter much for room sizes of 50, but then is that the reason why the max size is 50 in the first place.

What I really want to see is some indicator for whose currently playing a game and who isn't.
Logged

Polk5440

  • Torturer
  • *****
  • Offline Offline
  • Posts: 1708
  • Respect: +1788
    • View Profile
Re: 50 people rooms should help us find games
« Reply #44 on: July 29, 2013, 09:10:58 pm »
+4

Why is a discussion about counting people in a lobby going over my head? :o
Logged

mail-mi

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1298
  • Shuffle iT Username: mail-mi
  • Come play some Forum Mafia with us!
  • Respect: +1364
    • View Profile
Re: 50 people rooms should help us find games
« Reply #45 on: July 29, 2013, 09:12:20 pm »
0

Why is a discussion about counting people in a lobby going over my head? :o
You and me both.
Logged
I currently imagine mail-mi wearing a dark trenchcoat and a bowler hat, hunched over a bit, toothpick in his mouth, holding a gun in his pocket.  One bead of sweat trickling down his nose.

'And what is it that ye shall hope for? Behold I say unto you that ye shall have hope through the atonement of Christ and the power of his resurrection, to be raised unto life eternal, and this because of your faith in him according to the promise." - Moroni 7:41, the Book of Mormon

ragingduckd

  • Board Moderator
  • *
  • Offline Offline
  • Posts: 1059
  • Respect: +3527
    • View Profile
Re: 50 people rooms should help us find games
« Reply #46 on: July 29, 2013, 10:44:08 pm »
+5

> this means the number of players in the current lobby is counted every time a player is added
> that counting is O(N), where N is the number of players
> simply displaying the the player list turns out to be O(N^2)

Perhaps this is the real issue?

Not a chance.

Complexity theory matters when you're dealing with large N. These are tiny N, miniscule even. At this scale, the time for one operation is way more important than how quickly the number of operations grows with N. Some operations take a single processor flop while others take quadrillions. Are we talking about N^2 integer comparisons or N^2 renders for a 3D movie? And is that N^2 operations per hour or per millisecond?

Goko needs to send information every time a player logs on or off, starts/finishes a game, or joins/creates/changes a table. I probably create a table once every 20-ish minutes, then I auto-kick a couple joiners, then I get an opp and I start a game. So I'm generating about 15 events an hour. Sometimes I chat in the lobby or change rooms too, and maybe I'm underestimating... let's call it 60 events per hour, so each of N clients is receiving 60N messages per hour, which is a total of N2/60 per second that the server has to send. If that seems off, you can test it with the attached GM script, which listens to the Goko server and outputs every message they send you to the JS console.

But wait! I'm not actually receiving lobby events most of the time I'm logged in. When I'm playing a game, I don't care what's happening in the lobby and Goko isn't telling me. When I come back, they send me one "big" message that gives me the whole current state of the room. That one big message doesn't cost much more than any of the small ones do. So if I'm in games 90% of the time I'm connected, then Goko really only has 1/10th the obligation we calculated before. You can check that estimate by counting the number of running games vs connected players in the lobby at any given moment.

So now we're down to N2/600 messages per second. If there are N=200 people in a lobby, then Goko will need to send about 2002/600 = 67 messages per second. Is that realistic?

Why not try it out? Ask my server to send you some websocket messages and see how long it takes. If it can send 67 in less than a second, then my $500 computer is ready to handle a unified Goko lobby.

Ok, ok... Sending 67 messages per second is so easy it's not even worth testing. Let's try a bigger N.... leverage that O(N^2) running time. Maybe Goko grows by a factor of 10 so that N=2,000. Is my server capable of sending (2,000^2)/600 = 6,667 websocket messages in less than a second?

This was my result:

Server sent 6667 messages.
Server clock time elapsed: 0.1139 sec


Edit: Ok, looking back at the original conversation, I see that I missed the point. We're not talking about the time to send messages but the time to read an array. Same argument applies though, rather more so in fact.
« Last Edit: August 02, 2013, 09:37:09 am by ragingduckd »
Logged
Salvager Extension | Isotropish Leaderboard | Game Data | Log Search & other toys | Salvager Bug Reports

Salvager not working for me at all today. ... Please help! I can't go back to playing without it like an animal!
Pages: 1 [2]  All
 

Page created in 2.254 seconds with 21 queries.