8a2a718...633e54b

commit 633e54b2ffb4e5ec13c1fa5ce8170f5e726f8e10
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Tue Mar 19 18:02:21 2019 +0200

    Include level equality check value in round start messages, so clients immediately know if the level generated at their end doesn't match the one generated by the server (which will cause ID mismatches and more hard-to-diagnose desync kicks during the rounds). Related to #848

commit 68e410705115ece2fcc4ca9c7d9856cc1dd5c1f8
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Tue Mar 19 18:01:01 2019 +0200

    Readded client error handling from ef9afed. Not sure how it got removed, probably a messed up merge somewhere down the line when working on the client-server-separation branch or when merging the Steam version work from dev to master. In any case this should help diagnose desync kicks such as #1293.
This commit is contained in:
Joonas Rikkonen
2019-03-19 18:03:43 +02:00
parent cb6dcd469e
commit 6a12058148
3 changed files with 66 additions and 6 deletions
@@ -1029,9 +1029,10 @@ namespace Barotrauma.Networking
EndVoteTickBox.Selected = false;
int seed = inc.ReadInt32();
string levelSeed = inc.ReadString();
float levelDifficulty = inc.ReadFloat();
int seed = inc.ReadInt32();
string levelSeed = inc.ReadString();
int levelEqualityCheckVal = inc.ReadInt32();
float levelDifficulty = inc.ReadFloat();
byte losMode = inc.ReadByte();
@@ -1100,6 +1101,14 @@ namespace Barotrauma.Networking
mirrorLevel: campaign.Map.CurrentLocation != campaign.Map.SelectedConnection.Locations[0]);
}
if (Level.Loaded.EqualityCheckVal != levelEqualityCheckVal)
{
string errorMsg = " Level equality check failed. The level generated at your end doesn't match the level generated by the server (seed " + Level.Loaded.Seed + ").";
DebugConsole.ThrowError(errorMsg, createMessageBox: true);
CoroutineManager.StartCoroutine(EndGame(""));
yield return CoroutineStatus.Failure;
}
if (respawnAllowed) respawnManager = new RespawnManager(this, GameMain.NetLobbyScreen.UsingShuttle ? GameMain.NetLobbyScreen.SelectedShuttle : null);
gameStarted = true;
@@ -1414,7 +1423,7 @@ namespace Barotrauma.Networking
break;
case ServerNetObject.ENTITY_EVENT:
case ServerNetObject.ENTITY_EVENT_INITIAL:
entityEventManager.Read(objHeader, inc, sendingTime, entities);
if (!entityEventManager.Read(objHeader, inc, sendingTime, entities)) { break; }
break;
case ServerNetObject.CHAT_MESSAGE:
ChatMessage.ClientRead(inc);