Sync only once per tick, rather than once per tick and once per order.

This greatly improves performance by not syncing the world state for every single order processed as this becomes very expensive, at the cost of being unable to directly pinpoint the order that causes a desync. Instead the granularity of detecting desyncs is reduced to the tick level.
This commit is contained in:
RoosterDragon
2015-08-09 20:12:48 +01:00
parent d8ca66bec5
commit 709befda08
2 changed files with 5 additions and 44 deletions

View File

@@ -35,14 +35,13 @@ namespace OpenRA.Network
return ret;
}
public static byte[] SerializeSync(this List<int> sync)
public static byte[] SerializeSync(int sync)
{
var ms = new MemoryStream();
using (var writer = new BinaryWriter(ms))
{
writer.Write((byte)0x65);
foreach (var s in sync)
writer.Write(s);
writer.Write(sync);
}
return ms.ToArray();