Code review comment for lp:~widelands-dev/widelands/net-relay

Revision history for this message
Notabilis (notabilis27) wrote :

No problem, I am in no hurry.

Seems I was a bit unclear in my previous post, sorry.
These IDs are only used between the relay and the game host. The ID is created when a new client connects to the relay and announced to the host. Later messages of the client are prepended with this ID and passed on to the host. This way, we have multiple virtual network connections multiplexed about a single connection between host and relay. In the GameHost class the host can map between this "connections" (can be real connections in LAN games) and the state of the clients. The IDs are only used to number these connections, inside the GameHost class other IDs are used to number the participants of the game. So I guess this works as you want.
For the clients this mapping does not exist since they don't have to care about other clients; the game state is always send by the game host. Due to this the IDs that can be send by the relay are useless.
Currently the ID is transmitted as a single byte but I can change this to a string if you insist. (When I think about it: using a byte means that the relay has to restrict the number of participants in a game to 250. I have to check this.)

There are (at least) two problems with the pings currently:

1) Internet gaming: The relay/host IDs are useless for the client. For possible solutions see post above.

2) LAN gaming: We have no network protocol here, so no pings. When communicating with the relay, the game data packets are prepended with information regarding the intended receiver. In LAN games this is not required so the packets are send "raw". This means that we can't simply add pings on the level of the NetHost/NetClient connection but have to add them to the GameHost/GameClient layer. So for internet gaming we get our ping results from the NetHostProxy (and that from the relay) while in LANs the (higher layer) GameHost has to send the pings. I don't like it (mixing the layer responsibilities). However, if we do it that way, I am in favor of variant b) in the post above, since then we have no problems with the IDs and (at least for GameClients) the same ping-code for internet and LAN games.

Apart from this RTT/ID problem, both branches are ready for review.

« Back to merge proposal