Opened 7 years ago
Last modified 7 years ago
#4443 new enhancement
Disconnect chat notification should distinguish between intentional quit and lost connection
Reported by: | elexis | Owned by: | |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Backlog |
Component: | Network | Keywords: | |
Cc: | Imarok | Patch: |
Description
Use case: If the host quits a game via the GUI, a disconnect reason will be sent to the clients and players will be informed that the game didn't crash but that the host exited it intentionally. This has been very useful as it answers the question whether the game is running / recoverable.
The same should be implemented for clients. It would help identifying whether there was a technical issue (so the players will wait few minutes for a rejoin) or whether it was an unannounced ragequit (where players might want to look for a player replacement for example).
Implementation: The enet disconnect reason is not guaranteed to be transfered before the connection is closed, but in practice it seems reliable.
The 'intentional disconnect reason' is sent by the client already by enet_peer_disconnect_now(m_Server, NDR_SERVER_SHUTDOWN);
in the destructor of CNetClientSession
.
Therefore it should be received already in CNetServerWorker::OnDisconnect
in the event.data
field.
At this point, a message of a new type NMT_CLIENT_DISCONNECTED
could be sent to the clients informing them of the disconnect (including the disconnect reason).
The NMT_KICKED
message is used in two situations
A) to inform the server that a moderating client (that might not be on the same computer as the server) wants another client disconnected.
B) to inform the other clients that one client was kicked.
This second case should then be replaced by the new message type.
(Have to test actually implementing this, but I hope this works as laid out):
First the NMT_CLIENT_DISCONNECTED
function must be sent, so that the client's player-assignment is still present, remembering the name of that client. Once the client receives the network packet, it pushes a GUI message picked up in g_NetMessageTypes
of messages.js
which should then call the existing onClientLeave
function in messages.js
. The occurance in handlePlayerAssignmentsMessage
can be removed.
After the server sent the disconnected message, it can proceed to send the new player assignments removing the playername (i.e. server.OnUserLeave(session);
-> RemovePlayer
-> SendPlayerAssignments()
).
Replying to elexis:
If B gets replaced,
NMT_KICKED
should be renamed toNMT_KICK