rewrite 6x6D bug comment

This commit is contained in:
Martin Michelsen
2023-11-21 11:51:06 -08:00
parent 35aa6fba01
commit 67ed70082c
+20 -15
View File
@@ -4555,21 +4555,26 @@ struct G_SyncObjectState_6x6C_Entry_Decompressed {
// Compressed format is the same as 6x6B. // Compressed format is the same as 6x6B.
// There is a bug in the client that can cause desync between players' item IDs // There is a bug in the client that can cause desync between players' item IDs
// if the 6x6D command is sent too quickly. 6x6D is the first command sent by // if the 6x6D command is sent too quickly. Under normal operation, the client
// the leader when a player joins a game, so the joining player often receives // keeps track of the next item ID to be assigned for items it creates, and uses
// it immediately after the 64 command. One of the first steps of the game join // that to assign item IDs to its inventory items when it's done loading (just
// process is to reset the next item ID variables for each player in the game, // before it sends the 6F command). The loading process triggered by the 64
// which under normal operation, the 6x6D command overwrites with the values in // (game join) command resets these next item ID variables to their default
// the next_item_id_per_player array. However, the loading process doesn't // values, and the 6x6D command sent by the leader resets them again to match
// actually start until the next frame after the 64 command is received, so if // the corresponding variables in the leader's item state. However, the loading
// the 6x6D command is received on the same frame as the 64 command, it will // process doesn't actually start until the next frame after the 64 command is
// set the next item ID variables correctly and the loading process will then // received, so if the 6x6D command is received on the same frame as the 64
// clear all of them on the next frame. The client will then assign its own // command, it will set the next item ID variables correctly, and the loading
// inventory item IDs based on the default base item ID, which will result in // process will then clear all of them on the next frame. The client will then
// incorrect IDs if another player had previously been in the game in the same // assign its own inventory item IDs based on the default base item ID, which
// slot. To prevent this bug, we delay the 6x6D command and everything that // will result in incorrect IDs if another player had previously been in the
// depends on it until the client responds to a ping command (sent along with // game in the same slot (since the leader's next item ID for the joining player
// the 64 command). // will not match the default value). Fortunately, the game processes commands
// in two phases: first, it receives as much data as possible, then it processes
// as many commands as possible. So, to prevent this bug, we delay all commands
// after a 64 is sent until the client responds to a ping command (sent
// immediately after the 64 command), which ensures that the 64 and 6x6D
// commands cannot be processed on the same frame.
struct G_SyncItemState_6x6D_Decompressed { struct G_SyncItemState_6x6D_Decompressed {
// TODO: Verify this format on DC and PC. It appears correct for GC and BB. // TODO: Verify this format on DC and PC. It appears correct for GC and BB.