You're right, I didn't make it. Don't even well understand why I lost interest.
And it looks like no disater is happenening.

- Care to explain the plan?
- Sure. The idea was to host a server on only one machine (a dedicated one or one of players' computer - does not really matter) and make the other one behave as client - that is request the information it is allowed to know, receive requests from server when a player associated with that connection gets priority or is expected to make another choice. Other connected people may also request public information but take no decision since they control no player (this is how they were supposed to spectate)
All of the players' actions were intended to be transmitted over the network. Imagine a new PlayerController descendant (i.e. RemotePlayerController) whose methods contain instead of
return GuiDialog.chooseOne(all_our_parameters) some code that asks the same question a remote player
- Code: Select all
connectedSocket.send(new ChooseOneEntityRequest(all_our_parameters));
ChooseOneEntityResponse result = connectedSocket.waitFor<ChooseOneEntityResponse>();
return result.chosenObject;
The part of code that is really missing in Forge is to transfer the read-only game state (without information the opponent is not supposed to know) to a remote player.
The presentation layer has now direct references to game object and can synchronously read any information to draw player panels, battlefield, etc.
Instead the game state could be converted into some different and more lightweight objects to be sent over network (serving as a reflection of the current game state) that for obvious reason don't have any methods to change their state (they will be deserialized on client, so that changes on client side will change nothing on server. Because to change the game state the client may only take decisions when asked by PlayerController to do so)
To start with, we could have the GUI client rely on those reflection objects while drawing battlefield (and cut its direct access to the actual game state): choose which fields are needed for each type of entity, set up an updates pipeline, write one way conversion (from game state to reflections)
After the local client starts using such objects, it should not be too hard to send those to a remote host, that could draw the game events on its display...
Phase 3 is about turning such spectator into a player - by linking an instance of PlayerController to the network connection, asking for action and waiting for their decision. Meanwhile (while thinking on a next move) the player's client should be able to request actual game state (the latest reflection, limited by the information the client is allowed to know).
That's quite complicated and requires a lot of efforts, but looks like a path to real multiplayer with a potential to host fair tournaments (or handicap matches where cheating is allowed by settings) and allow people to spectate the matches.