Dominion Strategy Forum

Please login or register.

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

Author Topic: Automatch development thread  (Read 10979 times)

0 Members and 1 Guest are viewing this topic.

ragingduckd

  • Board Moderator
  • *
  • Offline Offline
  • Posts: 1059
  • Respect: +3527
    • View Profile
Automatch development thread
« on: July 02, 2013, 12:42:48 pm »
+49

I've been investigating Goko's JavaScript framework a bit. It's neither elegant nor intuitive, but it's plenty powerful enough for the feature requests that we've been making. The fact that Goko has never gotten around to stuff like auto-kick or displaying pro rating is really damning. Neither of these requires more than a dozen lines of code.

This is clear evidence that either Goko's developers are really unqualified, or Goko isn't giving even the slightest priority to feature requests from its dedicated users. Browser extension is clearly the only way that we're ever going to get a decent online Dominion experience.

I'm therefore starting a collaborative quest for the holy grail of missing Goko features: Automatch.

Anyone is welcome to contribute to the github project. The code on it doesn't quite work yet, but it demonstrates the design I have in mind. It's in the 'automatch' directory of https://github.com/aiannacc/goko-dominion-tools

Please use this thread for design proposals or to describe how you would like automatch to work. Working with Goko imposes certain restrictions that weren't present on isotropic, so let's start from scratch. What automatch options do you want? How do you want to interact with the UI?

Edit: As usual, I'll be auto-upvoting all reasonable feature requests and design suggestions.
« Last Edit: July 13, 2013, 05:33:15 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!

ragingduckd

  • Board Moderator
  • *
  • Offline Offline
  • Posts: 1059
  • Respect: +3527
    • View Profile
Re: Automatch development thread
« Reply #1 on: July 02, 2013, 12:47:09 pm »
+21

Here's my first pass at the architecture for automatch. See github code for details.

- JS browser extension adds an automatch button/UI to the Goko lobby
  - User specifies their match criteria: minimum rating, desired sets, etc
  - User submits form to begin an Automatch search
  - Browser extension looks up player's own details: name, id, sets owned, etc

- Browser extension submits request to third-party automatch server
  - HTTP request remains open until a match is found

- Automatch server receives HTTP request
  - Tries to match new player with a currently waiting player
  - If no immediate match, join list of waiting players
  - Responds to request with proposed match

- Broswer extension receives match info via HTTP response
  - Asks user whether proposed match is acceptable
  - Resubmits modified match request if match declined
  - Sends player to Outpost if accepted
     - creates table if player is host
     - joins table if player is guest

The automatch python code can run on any third party server. The current version is on port 8080 of gokologs.drunkensailor.org right now. Edit: No longer. I broke it. :P

The current JS script works as a Greasemonkey script in Firefox. It should eventually be incorporated into the extension that nutki and michaeljb are maintaining. Having two independent extension to modifying the same code can cause collisions.
« Last Edit: July 16, 2013, 01:14:19 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!

Watno

  • Margrave
  • *****
  • Offline Offline
  • Posts: 2745
  • Shuffle iT Username: Watno
  • Respect: +2982
    • View Profile
Re: Automatch development thread
« Reply #2 on: July 02, 2013, 12:49:29 pm »
+5

I'm gonna need more accounts for upvoting this.
Logged

theory

  • Administrator
  • *****
  • Offline Offline
  • Posts: 3603
  • Respect: +6121
    • View Profile
    • Dominion Strategy
Re: Automatch development thread
« Reply #3 on: July 02, 2013, 12:50:33 pm »
+5

A good person to ask about this might be dougz.  For example, you need a timeout provision and should automatically kick out of the automatch queue anyone who times out.
Logged

Davio

  • 2012 Dutch Champion
  • *
  • Offline Offline
  • Posts: 4787
  • Respect: +3412
    • View Profile
Re: Automatch development thread
« Reply #4 on: July 02, 2013, 01:04:03 pm »
+4

Is there also a leech mode?

I don't have any expansions (baby budget doesn't allow any such expenses at the moment), so I just wait for games to show up.
Logged

BSG: Cagprezimal Adama
Mage Knight: Arythea

ragingduckd

  • Board Moderator
  • *
  • Offline Offline
  • Posts: 1059
  • Respect: +3527
    • View Profile
Re: Automatch development thread
« Reply #5 on: July 02, 2013, 01:21:37 pm »
+5

Is there also a leech mode?

I don't have any expansions (baby budget doesn't allow any such expenses at the moment), so I just wait for games to show up.

Yes, my plan is for automatch requests to include which sets the player owns as well as which sets he wants to play. So as a non-owner who wants to play all cards, you would only be able to match with other players who own all the cards. Alternatively, you could match with anybody if you specify that you're willing to play base.

I expect that we'll end up with a queue of non-owners looking for all cards games, while card-owners will mostly get matched right away. Still, that's better than the Goko model, where non-owners move between lobbies waiting for an all-cards game to appear and then race to be the first to click join.
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!

shark_bait

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1103
  • Shuffle iT Username: shark_bait
  • Luckyfin and Land of Hinter for iso aliases
  • Respect: +1868
    • View Profile
Re: Automatch development thread
« Reply #6 on: July 02, 2013, 01:24:52 pm »
+3

I know nothing about programming so I can't do this, but perhaps one thing to implement would be to prioritize pairing players with all the sets with those who don't.  In that way, the games are maximized for full randomness and we get the most use out of those who already have all the sets.  This would also eliminate the biggest annoyance for those without the sets;  being a lobby vulture and waiting for an open game.
Logged
Hello.  Name's Bruce.  It's all right.  I understand.  Why trust a shark, right?

Is quite curious - Who is the mystical "Celestial Chameleon"?

DG

  • Governor
  • *****
  • Offline Offline
  • Posts: 4074
  • Respect: +2624
    • View Profile
Re: Automatch development thread
« Reply #7 on: July 02, 2013, 01:47:52 pm »
+9

How easy would it be to put a rematch button somewhere after a game is completed?
Logged

ragingduckd

  • Board Moderator
  • *
  • Offline Offline
  • Posts: 1059
  • Respect: +3527
    • View Profile
Re: Automatch development thread
« Reply #8 on: July 02, 2013, 02:04:40 pm »
+9

I know nothing about programming so I can't do this, but perhaps one thing to implement would be to prioritize pairing players with all the sets with those who don't.  In that way, the games are maximized for full randomness and we get the most use out of those who already have all the sets.  This would also eliminate the biggest annoyance for those without the sets;  being a lobby vulture and waiting for an open game.

I have couple of qualms about this. First, I don't want to add stuff that Goko will have a financial reason to object to. The only thing worse than Goko lacking useful features would be Goko sabotaging feature extensions. Second, I wouldn't want to make two all-cards owners wait to be matched with non-owners rather than immediately playing each other.

That said, I expect that this is going to happen by accident anyway. Most of the people waiting for games will be non-owners, so when an owner arrives he'll immediately match with one of them, rather than with another owner.

How easy would it be to put a rematch button somewhere after a game is completed?

Trivial. Excellent suggestion. I'd almost forgotten that real game servers do that.
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!

eHalcyon

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 8689
  • Respect: +9187
    • View Profile
Re: Automatch development thread
« Reply #9 on: July 02, 2013, 02:09:05 pm »
+5

I know nothing about programming so I can't do this, but perhaps one thing to implement would be to prioritize pairing players with all the sets with those who don't.  In that way, the games are maximized for full randomness and we get the most use out of those who already have all the sets.  This would also eliminate the biggest annoyance for those without the sets;  being a lobby vulture and waiting for an open game.

But if this is implemented, then it skews the automatch such that two players with all cards will be much less likely to see each other.  This is already an issue with Goko created by the host/guest system (people who tend to have all cards tend to host and thus never play each other) and is something that would be good to address with this third party automatch extension.



On a related note, also consider that if the extension actively works to make it easier for non-paying users to find all-cards games, that reduces incentive to actually pay Goko.  This has the potential to impact Goko's bottom line, which means that it may influence Goko to act against the extension in whatever capacity they are able.  Allowing base-only players to use the auto-match extension to search for only all-cards games is already pushing it a bit.  If there is a long queue for "guest" players and no such queue for all-cards hosts, it leaves in place the incentive to buy the cards.

Don't get me wrong, it's kind of sad that we need third party developers to create features that should have been available from the start.  But still, Goko is a business, and it is probably not a great thing if an extension is created that can actually hurt Goko's financial situation.

PPE: ninja'd!
Logged

ftl

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2056
  • Shuffle iT Username: ftl
  • Respect: +1345
    • View Profile
Re: Automatch development thread
« Reply #10 on: July 02, 2013, 02:12:33 pm »
+3

An ideal automatch, for me, would be a little more involved than "list a rating constraint and find the first person who matches". I'm in the situation where usually, I would be fine with playing anybody - I'm fine with playing really good players and with playing newbies! But I would prefer to play people close to my level, most of the time. So an ideal use case, for me, would be to push a button and have it match me with someone within 500 rating points if possible, or within 1000 points if possible, or within 1500 points, etc. Of course, it's not that much effort to do that manually and just raise the limit if you don't find anyone, so it's not a big deal. Still, could be nice.

I'm probably not gonna contribute any code, sort of busy at the moment with job search stuff.
Logged

dondon151

  • 2012 US Champion
  • *
  • Offline Offline
  • Posts: 2522
  • Respect: +1856
    • View Profile
Re: Automatch development thread
« Reply #11 on: July 02, 2013, 02:15:10 pm »
+1

How much are you guys willing to bet that Goko is going to take credit for nurturing a community that has the initiative to improve on their product?

On a related note, also consider that if the extension actively works to make it easier for non-paying users to find all-cards games, that reduces incentive to actually pay Goko.

Wouldn't this be partially true regardless of whether the automatch matches non-paying players with paying players? They end up playing more games anyway, some fraction of which are all-cards games, thus making it "easier" to find all-cards games.
« Last Edit: July 02, 2013, 02:18:37 pm by dondon151 »
Logged

philosophyguy

  • Minion
  • *****
  • Offline Offline
  • Posts: 575
  • Respect: +299
    • View Profile
Re: Automatch development thread
« Reply #12 on: July 02, 2013, 02:18:36 pm »
+1

Upvoting the idea for a rating range relative to you as well as a rating floor. Because of the variability of Goko ratings, though, I think that range will have to be kind of broad.

How would ranking and kingdom selection work? I'd suggest defaulting to a pro game, but it might be nice to include options for an unranked or casual game. I'm okay with not allowing a preset kingdom in automatch (I promise I learned something from the Paralyzed experience!).
Logged

philosophyguy

  • Minion
  • *****
  • Offline Offline
  • Posts: 575
  • Respect: +299
    • View Profile
Re: Automatch development thread
« Reply #13 on: July 02, 2013, 02:27:14 pm »
+3

How much effort would it be to create the ability to have a personal blacklist of automatch partners?

Also, iso had the issue where someone would sign up for automatch but then would time out on accepting the game, and it took 3 or 4 timeouts before you were paired with someone else. If someone doesn't respond to an automatch request (so not clicking "no," but actually timing out), they should be removed from the queue.
Logged

Slyfox

  • Coppersmith
  • ****
  • Offline Offline
  • Posts: 47
  • Respect: +78
    • View Profile
Re: Automatch development thread
« Reply #14 on: July 02, 2013, 02:29:19 pm »
+2

I really like the idea and the initiative.

The current design calls for a third-party server to run the matching, which sounds like a reasonable but somewhat brittle way to organize the system.

What about further piggybacking solely on embedding metadata into the "title" of the game? 

The current script implements auto-kick below a certainly level, which is *almost* adequate for automatch.  Can that be extended further?   Perhaps the script pulls up a dialog box, you set the parameters, and it starts a game that encodes the right metadata information in the title.  While the game is "open" the script will be scanning the list of games for offer, looking for a compatible game using its game title.  If it finds it, it auto-joins the game (or asks you if you want to join that game).  To avoid both games joining each other (race condition) you would just implement some sort of fair tiebreaker as to whom joins whose game.

This would be limited to a single room, but the script could automatically switch from room to room after an interval with a failed match.

The above could likely be implemented as an extension to the current logging/point tracker script, which would also be preferable to have two different scripts to install.
« Last Edit: July 02, 2013, 02:30:22 pm by Slyfox »
Logged

eHalcyon

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 8689
  • Respect: +9187
    • View Profile
Re: Automatch development thread
« Reply #15 on: July 02, 2013, 02:31:48 pm »
+3

On a related note, also consider that if the extension actively works to make it easier for non-paying users to find all-cards games, that reduces incentive to actually pay Goko.

Wouldn't this be partially true regardless of whether the automatch matches non-paying players with paying players? They end up playing more games anyway, some fraction of which are all-cards games, thus making it "easier" to find all-cards games.

Yes, and I tried to imply that in my post.  If auto-match allows a free player to specify "only all-cards games", then there is less incentive for that player to go and buy all the cards.  However, the suggestion for maximizing all-cards games by specifically trying to match up all-cards hosts with the free players would further reduce incentive if it actually does reduce wait time for the free players. 

Andrew pointed out that it might happen accidentally anyway -- since there are far more free players, chances are that a host will be instantly matched up with a free player rather than another host.  Maybe the auto-match server should actually prioritize matching up two hosts if they happen to be searching for a game at the same time?




A nice feature might be a "friends list" option.  The list would ideally show which of your friends are online.  Auto-match could specify "friends only" and would then automatically wait until a friend finished their game.  That would be a nice alternative to that "f.ds in Outpost" thread.
Logged

philosophyguy

  • Minion
  • *****
  • Offline Offline
  • Posts: 575
  • Respect: +299
    • View Profile
Re: Automatch development thread
« Reply #16 on: July 02, 2013, 03:14:58 pm »
+2

What about further piggybacking solely on embedding metadata into the "title" of the game?

This would be limited to a single room, but the script could automatically switch from room to room after an interval with a failed match.

I think the room switching limitation is a bigger issue than it seems at first. Not only do you have to wait until you AND a match are in the same room, but you have the problem of potential automatch partners (who are also running the script) moving through rooms while you are as well, which makes ending up in the same room at the same time even less likely.

But, from a bigger picture perspective, there's not a good reason to limit automatch to a single room. We're having to be creative because of Goko's awful lobby system, but an outside server is a relatively easy way to overcome that limitation. We're already doing that with the script prettifier, with councilroom, with the custom avatars. I think automatch is significant enough of a feature to warrant the external server—certainly more than custom avatars.
Logged

PitrPicko

  • Baron
  • ****
  • Offline Offline
  • Posts: 51
  • Respect: +25
    • View Profile
Re: Automatch development thread
« Reply #17 on: July 02, 2013, 03:17:12 pm »
+1

Oh I'm so excited about automatch option! Really! If this will work it will be best feature of Goko... :D


Just a minor feature.

While selecting kingdom feature, it would be nice to have option to specify number of sets and/or sets directly. I hate playing base, but difference between all sets and 3 sets is small. So that for minimum sets.
But many could be fine with 3+ sets or for example prosperity (as their favorite). So that for specific set.
Logged

dougz

  • Isotropic Designer
  • *****
  • Offline Offline
  • Posts: 88
  • Respect: +440
    • View Profile
    • Online Dominion
Re: Automatch development thread
« Reply #18 on: July 02, 2013, 03:18:27 pm »
+21

(ragingduckd asked, I figured I might as well reply publicly.)  Here's the automatch algorithm used for isotropic:

every 30 seconds or so:
  for N in (4, 3, 2):
    let S be the set of all players interested in an N-player match.
    while |S| >= N:
      randomly choose a player X, remove from S.
      try 5 times:
        randomly choose N-1 other players from S (but don't remove them from S).
        see if {X + the N-1 other players} is a feasible game (no conflicting requirements).
        if it is, remove the N-1 other players from S and propose the game.

This algorithm is simple enough that I don't think the code will be useful; it's tied in to the rest of the lobby code anyway.  It is guaranteed to terminate and "fair" in the sense that players with a lot of constraints don't get "first pick" of the available opponents; imposing constraints means you're less likely to get a game.
Logged

Slyfox

  • Coppersmith
  • ****
  • Offline Offline
  • Posts: 47
  • Respect: +78
    • View Profile
Re: Automatch development thread
« Reply #19 on: July 02, 2013, 03:48:30 pm »
+2

I think the room switching limitation is a bigger issue than it seems at first. Not only do you have to wait until you AND a match are in the same room, but you have the problem of potential automatch partners (who are also running the script) moving through rooms while you are as well, which makes ending up in the same room at the same time even less likely.

I wonder if there is a way to query which games are available in the other rooms without actually "switching" rooms...  If there is, the script could scan all rooms looking for automatches, even without randomly switching rooms.  The script would still likely need to actually switch rooms before joining the match, which could be especially complicated if the room is at the 50 player limit.  If the limit is enforced on the client side (totally possible) then the script could perhaps bend that rule, which would simply handling such edge cases.

But, from a bigger picture perspective, there's not a good reason to limit automatch to a single room. We're having to be creative because of Goko's awful lobby system, but an outside server is a relatively easy way to overcome that limitation. We're already doing that with the script prettifier, with councilroom, with the custom avatars. I think automatch is significant enough of a feature to warrant the external server—certainly more than custom avatars.

The external server is a reasonable approach, but I'm worried about the "I'm not so into dominion anymore" effect that caused Councilroom to be down for a while (which is totally understandable, of course!).  Granted, the automatch server sounds much lighter weight than the significant disk space required for Councilroom, but it still gives me pause.  There were also a few times that Councilroom would be down for a day or two, which is no big deal, but would be more annoying if an automatch sever went down.  It may be necessary to have an external server in the end, but if an adequate automatch can be designed without needing it, all the better.  It is easy to underestimate the cost of relying on an external service.
Logged

ragingduckd

  • Board Moderator
  • *
  • Offline Offline
  • Posts: 1059
  • Respect: +3527
    • View Profile
Re: Automatch development thread
« Reply #20 on: July 02, 2013, 05:57:45 pm »
+3

I wonder if there is a way to query which games are available in the other rooms without actually "switching" rooms...  If there is, the script could scan all rooms looking for automatches, even without randomly switching rooms.

The FunSockets framework appears to expose the ability to look at tables from other rooms, but on closer inspection, those tables haven't actually been populated with data. The whole architecture is a little incoherent, and it smacks of design compromises made for the sake of performance and short-term developer convenience.

But even if such a method is available somewhere in the framework, a decentralized automatch will have other weaknesses. With no central queue, matches will tend go to whichever client has the lowest latency. Automatch abuse may also be possible, as everything will be visible to all clients. A non-owner can't host, so getting him into a game will require a series of back-and-forth table messages between him and the person he matches with. And it will all confuse non-extension users, who will run around asking why they just got kicked and what "AM3728+-1500ACNO" means.

The external server is a reasonable approach, but I'm worried about the "I'm not so into dominion anymore" effect that caused Councilroom to be down for a while (which is totally understandable, of course!).  Granted, the automatch server sounds much lighter weight than the significant disk space required for Councilroom, but it still gives me pause.  There were also a few times that Councilroom would be down for a day or two, which is no big deal, but would be more annoying if an automatch sever went down.  It may be necessary to have an external server in the end, but if an adequate automatch can be designed without needing it, all the better.  It is easy to underestimate the cost of relying on an external service.

This is a really good point. I can't realistically promise to maintain an automatch server for the rest of my life -- the rest of Goko's life might be realistic, but let's not get into that.

One possibility would be a system that uses a third-party server by default, but falls back on a Goko-only table-based method of communication when the server isn't available. It sounds kinda awful to me, but maybe there are good ways to work around the limitations... and maybe someone else is willing to code it up. :P
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!

ftl

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2056
  • Shuffle iT Username: ftl
  • Respect: +1345
    • View Profile
Re: Automatch development thread
« Reply #21 on: July 02, 2013, 06:09:12 pm »
+7

I think it's better to have graceful failure instead - if the server isn't up, you somehow get notified that "automatch isn't working right now" when you try to automatch, and so you can just go on to make a game as normal. Just make sure that if the server is down, people don't get sent to random rooms with random table names, and don't sit there waiting for something to happen without knowing whether anything will.
Logged

Warfreak2

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1149
  • KC->KC->[Scavenger, Scavenger, Lookout]
  • Respect: +1324
    • View Profile
    • Music what I do
Re: Automatch development thread
« Reply #22 on: July 03, 2013, 07:28:40 am »
+1

could be especially complicated if the room is at the 50 player limit

Just have both players join an empty room near the bottom of the list.
Logged
If the only engine on the board is Procession->Conspirator, I will play it.

michaeljb

  • Board Moderator
  • *
  • Offline Offline
  • Posts: 1422
  • Shuffle iT Username: michaeljb
  • Respect: +2113
    • View Profile
Re: Automatch development thread
« Reply #23 on: July 06, 2013, 09:49:38 pm »
+8

Made a bit of progress on this today. Took care of this bit:

Code: [Select]
// TODO: Fix the error here. Server is generating the XML properly,
//       but client sees match.XML as null.

I changed the XML response to a JSON response (the client code was already using JSON.parse, plus I like to look at JSON more than XML :P), and made a couple small formatting/style changes.

I rearranged the order of the declaration of callback functions within FS.MeetingRoom.prototype.automatch; Chrome was encountering reference errors, so stuff had to be declared in a different order.

Changing FS.MeetingRoomTemplates to include the Automatch button wasn't working in the main extension, so I changed how that was done and added a wrapper function around the whole automatch script (the same way the main extension has a wrapper function).


So now, when two players are matched they are both sent to Outpost, but nothing more happens.

Should I just send a pull request on github or is there another way you'd like to handle contributions?
« Last Edit: July 06, 2013, 09:53:45 pm by michaeljb »
Logged
🚂 Give 18xx games a chance 🚂

ragingduckd

  • Board Moderator
  • *
  • Offline Offline
  • Posts: 1059
  • Respect: +3527
    • View Profile
Re: Automatch development thread
« Reply #24 on: July 07, 2013, 01:18:46 am »
+4

Made a bit of progress on this today. Took care of this bit:

Code: [Select]
// TODO: Fix the error here. Server is generating the XML properly,
//       but client sees match.XML as null.

I changed the XML response to a JSON response (the client code was already using JSON.parse, plus I like to look at JSON more than XML :P), and made a couple small formatting/style changes.

I rearranged the order of the declaration of callback functions within FS.MeetingRoom.prototype.automatch; Chrome was encountering reference errors, so stuff had to be declared in a different order.

Changing FS.MeetingRoomTemplates to include the Automatch button wasn't working in the main extension, so I changed how that was done and added a wrapper function around the whole automatch script (the same way the main extension has a wrapper function).


So now, when two players are matched they are both sent to Outpost, but nothing more happens.

Should I just send a pull request on github or is there another way you'd like to handle contributions?

All of these sound great. A Github pull request sounds fine, though I'm open to alternatives if there's a better way. This is my first github project.

I've learned a little more about this sort of server-client communication, and it seems like Websockets may be more elegant solution than asynchronous delayed HTTP responses. Thoughts?
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 0.103 seconds with 21 queries.