wat
New Member
Posts: 32
|
Post by wat on Jan 6, 2015 6:08:43 GMT -8
It is still possible to reverse client/server roles without long-lived connections using pooling instead of push, but the lag in message transmission is higher.
|
|
|
Post by Sam Schreiber on Jan 6, 2015 8:47:02 GMT -8
One of the main reasons that Tiltyard exists is so developers can get everything working (including router configurations) at their leisure, before they're involved in a time-sensitive environment like a competition.
I agree this is a source of difficulty though. I'll look into adding better documentation and error messages to help developers whose players aren't showing up on Tiltyard due to not being accessible over the network.
|
|
Claus
New Member
Posts: 18
|
Post by Claus on Jan 13, 2015 11:14:20 GMT -8
I see a lack of deep interest, let alone agreement, on enhancements to the GGP protocol. By this I mean both the content of the messages and the client/server role between the game manager and the players. In another thread, I proposed minimal enhancements (http://ggp.boards.net/thread/74/proposal-enhanced-ggp-communication-messages ) and the most vocal response was that the changes were not worth doing unless also accompanied by reversing the existing client/server relationship. This thread was an attempt to explore what it would mean to the protocol to reverse the client/server relationship. Sam Schrieber, to whom the GGP community owes many thanks for implementing much of the server infrastructure that we have today, does not find the need to reverse the client/server roles compelling. I tend to agree than anyone with the skills to develop a GGP program has sufficient technical skills to configure a router appropriately, although in there are cases where the person may not be authorized to make the necessary changes and the variation between routers in how to do this means there is no easy cookbook to share with people getting started with GGP.
The most interesting finding on this thread is the "BOSH" protocol. This can be thought of as a low level wrapper around HTTP request/response to change it into a true peer to peer protocol in a way that enables programs configured as clients (only make HTTP requests) to act as peers. By layering the BOSH protocol under the GGP protocol, it would be possible to reverse the client/server relationship without changing the GGP protocol at all.
Unfortunately, while the BOSH protocol was created specifically by the XMPP community to address exactly the firewall issues that we have with GGP (programs running behind restrictive firewalls), to the best of my knowledge the protocol has not gone beyond that community and the only available implementations are specific to XMPP. It is also not clear to me that the BOSH protocol, as it currently exists, overcomes concerns about long lived connections, specifically relative to program or communiciation failure recovery.
That said, I am abandoning discussions on enhancing the GGP protocol. I am going to try some experiments with BOSH-like protocols and will report back, if anything comes of that. Due to other commitments, that will be several months from now.
|
|
|
Post by alandau on May 13, 2015 14:47:50 GMT -8
I just did a quick experiment to see if I could write an intermediary server to solve this problem. The idea is that the server would sit somewhere easily accessible with a fixed IP address and would accept incoming client connections from both the players and server. Players would connect into the server (with some username/password scheme) and be informed of their assigned port number; the server would then connect to that port number, using the existing protocol. The intermediary would pass messages between the server and client, with the client using long polling to wait for incoming messages. (The API is designed to avoid skipped messages due to untimely dropped connections.)
Actually, the only connection that needs to be held open for a long time is the one between the server and the intermediary server (waiting for a response), suggesting this might be a working approach for the server to implement.
Currently I'm blocked on the fact that Dropwizard (which I'm using as a learning exercise) doesn't expect applications to use more than one port. An alternative would be to host players at different addresses on the server (something like playerhost.ggp.org/player?name=Alloy). Unfortunately, both the GGP-Base and Dresden servers expect players to be at the "/" location, i.e. there can't be anything after the "/" in the URL. I might be able to get this working with something that uses raw Socket or URL connections instead of a server framework, but for now I thought I'd share the approach I'm using for the client-side communication:
1) The client sends a register command to the server with a username and password. This is accepted unless the username has been used before with a different password. Response (if no error): <address the player is available at, next message ID> 2) The client sends a receive command to the server with the next message ID it's expecting. This is a "long polling" request, i.e. the server tries to wait until an answer is available before responding. However, it can also time out at any time with an error; in this case, the client simply repeats the request with the same message ID. After a successful request, the client can immediately start polling for the next message. Response (if no error): <current message ID (for sanity checking), next message ID, message contents> 3) The client sends a respond command when it is ready to send a response to a message. Response (if no error): <current message ID, next message ID> (both for sanity checking)
Message IDs are base 64-encoded strings generated by a secure random number generator, i.e. they won't collide (with high probability) and would be sufficiently long that they're basically impossible to guess. The server would store messages for some reasonable length of time.
Note that long polling is more or less necessary when reversing the connection to keep latency low, which is essential because of how turn deadlines are communicated.
I wouldn't expect this design to pose any real problems for a distributed player; it would have an entry point for messages (or several), some mechanisms for computing responses, and then an exit point for sending a response (which includes a way of specifying which message it's for, so it wouldn't hurt if the response wound up getting sent twice). The remaining robustness problems have to do with the inability to replace a previously sent move, which is a higher-level limitation of the current protocol.
|
|
|
Post by Steve Draper on May 14, 2015 4:36:49 GMT -8
Sounds plausible, and useful even if not 'officially' adopted since it can be fairly lightweight, so if necessary a player's owner could just run it up on a free-tier instance in one of the clouds, though obviously if it were not near either the player or the game manager the extra latency penalty would be a handicap
|
|