All characters start disabled in the multiplayer mode, and are enabled when the client starts receiving position updates for the character, OR when the server starts receiving inputs from the client controlling the character, OR if the character is controlled locally. (-> no more floating, frozen characters at the start of a round)

+ the server disables AICharacters that are far away from all players
This commit is contained in:
Regalis
2017-03-25 18:24:09 +02:00
parent 827644b72c
commit aca85c2708
3 changed files with 38 additions and 10 deletions
@@ -212,6 +212,10 @@ namespace Barotrauma
memInput.RemoveRange(60, memInput.Count - 60);
}
}
else //this == Character.Controlled && GameMain.Client == null
{
AnimController.Frozen = false;
}
if (networkUpdateSent)
{
@@ -288,6 +292,8 @@ namespace Barotrauma
UInt16 networkUpdateID = msg.ReadUInt16();
byte inputCount = msg.ReadByte();
if (AllowInput) Enabled = true;
for (int i = 0; i < inputCount; i++)
{
InputNetFlags newInput = (InputNetFlags)msg.ReadRangedInteger(0, (int)InputNetFlags.MaxVal);
@@ -763,7 +769,7 @@ namespace Barotrauma
}
}
character.Enabled = enabled;
character.Enabled = Controlled == character || enabled;
return character;
}