i'm looking into the coding to enable hosting by a proxy server via the lobby.
It looks like it shoudln't take much code;
Doing one side is quite easy: when the server receives notice ofa new game hosted by proxy, instead of putting the hoster's address into the gamedescription object, it puts in the address of the proxy server; using a rotating set of a bunch of ports or so shoudl ensure there's always one available to keep all the games separate.
So now i'm figuring out how to have the host's proxy system setup. I'm having truoble finding the place in the code where you normally connect to the lobby, so i can make a variant of that to connect to the proxy server. (bung said he'd host the proxy-server).
i have a couple things on my wish list for networking:
1) it would also be nice to be able to manually tell triplea what your ip address is (in case you have multiple connections and wish to use a specific one for triplea)
2) less disconnecting from games. this isn't a first person shooter, we shouldn't need amazing connections to play. i made a patch for this, but all i did in it was change the give up time from 10 to 15 seconds, inside the ClientMessenger class of ClientMessenger.java (is there anything else that must be changed?)
while i've got the architecture i plan to use mostly settled; it's gonna be a little imperfect since i'm trying to avoid having to change existing code mcuh, or at all.
and because it's really hard to find where the points for some things are.
I don't think modifying the GameDescription class to add a boolean for proxyhosted will affect anything distant;
i'd like to talk to someone about the proxy code, to make sure i get it right; or someone else could do it :P
And I need to determine the best way for the secnodary proxy that runs on your local computer to read the message that it's time to stop. (that proxy exists because its' too deep in the code to figure out where the messages are bieng sent frmo your copy of triplea, let alone if it's frmo multiple places in the code, so it's easier for me to just code a bypass for that, though not ideal)
well, I haven't been able to contact sgb or anyone, so I'm gonna have to go ahead with my basic plans; it's a bit off from a software design standpoint; also not sure it will work properly; oh well
so here's the plan:
adjust lobbygamepanel - addJbutton for hosting a proxy game; done,
the code for that button duplicates the code for hostingagame with additions/adjustments as needed.
I can't easily adjust the code to include a direct signal that it's a proxy game, so i'm gonna piggyback off the existing gamedescription code.
I'll use some number/numbers set by a constant to designate what port number will be used as a signal that the game is a proxy game.
I also need to setup a localproxy here that will intermediate between your machine and the lobbyproxy (this is necessary because finding where/how to modify the code to have the game connect directly is too hard on me own). This will be given an order to start by the hostproxygame button; the shutdown signal for it will be sent by the lobbyproxy. It also needs a delay at startup, as it may be several seconds or more before the lobbyproxy is up.
most changes (maybe all) will be made to the LobbyGameController
basically; when it receives the signal to use the postGame routine; it will look to see if the port is the signal for proxy game. If it is, it will call a proxycontroller which will assign a port on the lobby server for the lobby proxy, and it will setup that lobby proxy. Then when the game is posted to the lobby, the gamedescription will be modified to list the address for the proxyserver instead of teh game; there will also be map maintained connecting gameids (Guid) to the ports on the proxy server.
when updategame is called, in order to maintain the server/port info for the proxy server in the gamedescription, it will call up the mapping by the GuiD, and reset the server/port in the gamedescription to the values fro the proxy server (otherwise it would go back to the ones from the actual computer that can't host)
when removegame is called, it will also tell the lobbyproxy to shutdown (which will in turn tell the localproxy to shutdown)
some additional measures may be put in to make sure connections get closed down, not really sure what'd work or be needed there, probably just a very long time-out system.
So that's the plan, if i'm not forgetting anything (which is possible);
i'm not entirely sure how do to the network code itself for the proxies, though msot of the rest of the code changes are fairly straightforward to make.
Very interesting Zlefin, hope someone that knows about this stuff lets you know how it sounds. I'm curious myself about what sort of stuff is going to run on the server? Just some linux proxy package, or something custom?