Skip to content
This repository was archived by the owner on Oct 22, 2023. It is now read-only.

Commit e892db7

Browse files
committed
New dumps, testing some stuff to get synced framerate...
1 parent b0ad5b2 commit e892db7

9 files changed

Lines changed: 15 additions & 16 deletions

File tree

Engine/Network.Server/Room.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public class Room
3535
/// </summary>
3636
private readonly Dictionary<ulong, long> _hashCodes = new Dictionary<ulong, long>();
3737

38+
private uint inputMessageCounter = 0;
39+
3840
public Room(IServer server, int size)
3941
{
4042
_server = server;
@@ -73,9 +75,11 @@ private void OnDataReceived(int clientId, byte[] data)
7375
switch (messageTag)
7476
{
7577
case MessageTag.Input:
78+
++inputMessageCounter;
79+
7680
var clientTick = reader.GetUInt();
7781
var commandsCount = reader.GetInt();
78-
if (commandsCount > 0)
82+
if (commandsCount > 0 || inputMessageCounter % 8 == 0)
7983
{
8084
_server.Distribute(clientId, data);
8185
}

Engine/Test/DumpTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public void TestDump()
3434
[Fact]
3535
public void TestDumpRVO()
3636
{
37-
TestFileDump(@"RVO\342696725855");
38-
//TestFileDump(@"RVO\93654088888");
37+
TestFileDump(@"RVO\445401195417");
38+
TestFileDump(@"RVO\526795398181");
3939
}
4040

4141
/// <summary>
-2.52 MB
Binary file not shown.
4.26 MB
Binary file not shown.

Engine/Test/Test.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@
4646
<None Update="Dumps\58013408818.bin">
4747
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4848
</None>
49-
<None Update="Dumps\RVO\342696725855.bin">
49+
<None Update="Dumps\RVO\445401195417.bin">
5050
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
5151
</None>
52-
<None Update="Dumps\RVO\342696785265.bin">
52+
<None Update="Dumps\RVO\4949504550.bin">
5353
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
5454
</None>
55-
<None Update="Dumps\RVO\4949504550.bin">
55+
<None Update="Dumps\RVO\526795398181.bin">
5656
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
5757
</None>
5858
</ItemGroup>
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

Unity/Assets/Scripts/RTSNetworkedSimulation.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ private void Awake()
3232

3333
Log.OnMessage += (sender, args) => Debug.Log(args.Message);
3434

35-
_commandQueue = new NetworkCommandQueue(_client);
35+
_commandQueue = new NetworkCommandQueue(_client)
36+
{
37+
LagCompensation = 3
38+
};
3639
_commandQueue.InitReceived += (sender, init) =>
3740
{
3841
AllActorIds = init.AllActors;
@@ -46,15 +49,7 @@ private void Awake()
4649

4750
public void DumpGameLog()
4851
{
49-
Stream stream = new FileStream(@"C:\Log\" + Math.Abs(Contexts.sharedInstance.gameState.hashCode.value) + ".bin", FileMode.Create, FileAccess.Write);
50-
var serializer = new Serializer();
51-
serializer.Put(Contexts.sharedInstance.gameState.hashCode.value);
52-
serializer.Put(Contexts.sharedInstance.gameState.tick.value);
53-
stream.Write(serializer.Data, 0, serializer.Length);
54-
55-
Simulation.GameLog.WriteTo(stream);
56-
57-
stream.Close();
52+
Simulation.DumpGameLog(new FileStream(@"C:\Log\" + Math.Abs(Contexts.sharedInstance.gameState.hashCode.value) + ".bin", FileMode.Create, FileAccess.Write));
5853
}
5954

6055
public void Execute(ICommand command)

0 commit comments

Comments
 (0)