Opened 11 years ago

Closed 9 years ago

Last modified 8 years ago

#1949 closed enhancement (fixed)

[PATCH] "PlayerX has joined the game" message appears before a player rejoins the game

Reported by: alpha123 Owned by: leper
Priority: Should Have Milestone: Alpha 19
Component: Network Keywords:
Cc: Patch:

Description

If a client gets disconnected from the host in multiplayer and tries to rejoin, the other players get a "SomePlayer has joined the game" message after SomePlayer downloads the serialization state but before the map is reloaded and everything is synchronized.

Attachments (4)

rejoined_message_wip_v1.patch (1.8 KB ) - added by elexis 9 years ago.
This patch implements that a message is automatically sent as soon as the client finished the loading screen on rejoin. TODO: (1) change the "(player)s has joined the game" message (translation files) and (2) probably implement a custom network message command, if the regular chat function shouldn't be used.
rejoined_message_wip_v2.patch (10.0 KB ) - added by elexis 9 years ago.
rejoined_message_v3.patch (32.6 KB ) - added by elexis 9 years ago.
Removed braces in loading.js, moved c++ functions to more logical place. Tested with r16528.
rejoined_message_v4.patch (12.7 KB ) - added by elexis 9 years ago.
Cleaned 1 or 2 unnecessary whitespace changes in the previous patch. Fixes a whitespace change in r15006 in NetMessage.cpp. Still dont know how you want those functions grouped. Tested with r16533.

Download all attachments as: .zip

Change History (13)

comment:1 by Jia Henry, 10 years ago

I could change it to Player X is trying to join the game

comment:2 by Jia Henry, 10 years ago

The only real use of this change would be to tell whether a player has crashed on joining.

This bug is fixed at revision 15402

comment:3 by elexis, 9 years ago

It happens frequently that a player crashes or reconnects otherwise in the middle of the battle and rejoins.

(1) In this situation fair enemies and losing teammates pause the game until he reconnected. The problem here is that people think that the "player has joined" message means that the player has control over his army again and continue the game then, while in fact he is loading the game, which can take up to a minute sometimes (Enough time to lose multiple CCs, fortresses and the whole army).

(2) Also players start to talk to the reconnected client, assuming that he can read the chat already, which frequently causes communication issues.

I propose to change the original message to something like "player starts to rejoin" and add another message "player has successfully rejoined" when the game actually started for him/her. Im currently trying to do the patch.

by elexis, 9 years ago

This patch implements that a message is automatically sent as soon as the client finished the loading screen on rejoin. TODO: (1) change the "(player)s has joined the game" message (translation files) and (2) probably implement a custom network message command, if the regular chat function shouldn't be used.

by elexis, 9 years ago

comment:4 by elexis, 9 years ago

The patch above implements the feature as desired.

As indicated by binaries/data/mods/public/gui/session/messages.js, the "%player has joined the game" message was replaced with "player is connecting..." and another message type was added to implement the new "%(player)s has rejoined the game." message.

How it works: When a client rejoins and finishes the loading screen, the GUI / javascript function reallyStartGame() will be called. The rejoined client then sends the RejoinedMessage to the server, which will broadcast the message to all clients, which then display the actual text.

As already done in the first version of the patch, the c++ reallyStartGame() function is changed, so that g_NetClient->LoadFinished() will be called before the RejoinedMessage is sent in the reallyStartGame() part of the GUI/JS. This is required, otherwise an error will appear.

TODO: The translation files need to be updated

comment:5 by elexis, 9 years ago

Keywords: review added
Milestone: BacklogAlpha 19
Summary: "PlayerX has joined the game" message appears before a player rejoins the game[PATCH] "PlayerX has joined the game" message appears before a player rejoins the game
Type: defectenhancement

by elexis, 9 years ago

Attachment: rejoined_message_v3.patch added

Removed braces in loading.js, moved c++ functions to more logical place. Tested with r16528.

by elexis, 9 years ago

Attachment: rejoined_message_v4.patch added

Cleaned 1 or 2 unnecessary whitespace changes in the previous patch. Fixes a whitespace change in r15006 in NetMessage.cpp. Still dont know how you want those functions grouped. Tested with r16533.

comment:6 by leper, 9 years ago

Owner: set to leper
Resolution: fixed
Status: newclosed

In 16614:

Improve rejoin messages. Patch by elexis. Fixes #1949.

comment:7 by leper, 9 years ago

Keywords: review removed

Thanks for the patch.

comment:8 by elexis, 8 years ago

In 18203:

Network cleanup.

Send the "client has rejoined" message after the synchronization finished instead of right after the loading screen.
Patch by echotangoecho, refs #1949, #1950.

comment:9 by elexis, 8 years ago

Component: Core engineNetwork

(set component to network)

Note: See TracTickets for help on using tickets.