Add Tick scale plumbing

This commit is contained in:
teinarss
2021-10-09 19:02:10 +02:00
committed by abcdefg30
parent 7f3130c7a6
commit 1a56cee9a1
8 changed files with 62 additions and 11 deletions

View File

@@ -42,6 +42,8 @@ namespace OpenRA.Server
// - 0x20: Ping
// - Int64 containing the server timestamp when the ping was generated
// - [client -> server only] byte containing the number of frames ready to simulate
// - 0x76: TickScale
// - Float containing the scale.
//
// A connection handshake begins when a client opens a connection to the server:
// - Server sends:
@@ -75,6 +77,6 @@ namespace OpenRA.Server
// The protocol for server and world orders
// This applies after the handshake has completed, and is provided to support
// alternative server implementations that wish to support multiple versions in parallel
public const int Orders = 17;
public const int Orders = 18;
}
}

View File

@@ -638,6 +638,17 @@ namespace OpenRA.Server
return ms.GetBuffer();
}
byte[] CreateTickScaleFrame(float scale)
{
var ms = new MemoryStream(17);
ms.WriteArray(BitConverter.GetBytes(9));
ms.WriteArray(BitConverter.GetBytes(0));
ms.WriteArray(BitConverter.GetBytes(0));
ms.WriteByte((byte)OrderType.TickScale);
ms.Write(scale);
return ms.GetBuffer();
}
void DispatchOrdersToClient(Connection c, int client, int frame, byte[] data)
{
DispatchFrameToClient(c, client, CreateFrame(client, frame, data));