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

Commit

Permalink
New dumps, testing some stuff to get synced framerate...
Browse files Browse the repository at this point in the history
  • Loading branch information
proepkes committed Feb 13, 2019
1 parent b0ad5b2 commit e892db7
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 16 deletions.
6 changes: 5 additions & 1 deletion Engine/Network.Server/Room.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public class Room
/// </summary>
private readonly Dictionary<ulong, long> _hashCodes = new Dictionary<ulong, long>();

private uint inputMessageCounter = 0;

public Room(IServer server, int size)
{
_server = server;
Expand Down Expand Up @@ -73,9 +75,11 @@ private void OnDataReceived(int clientId, byte[] data)
switch (messageTag)
{
case MessageTag.Input:
++inputMessageCounter;

var clientTick = reader.GetUInt();
var commandsCount = reader.GetInt();
if (commandsCount > 0)
if (commandsCount > 0 || inputMessageCounter % 8 == 0)
{
_server.Distribute(clientId, data);
}
Expand Down
4 changes: 2 additions & 2 deletions Engine/Test/DumpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public void TestDump()
[Fact]
public void TestDumpRVO()
{
TestFileDump(@"RVO\342696725855");
//TestFileDump(@"RVO\93654088888");
TestFileDump(@"RVO\445401195417");
TestFileDump(@"RVO\526795398181");
}

/// <summary>
Expand Down
Binary file removed Engine/Test/Dumps/RVO/342696785265.bin
Binary file not shown.
Binary file not shown.
Binary file added Engine/Test/Dumps/RVO/526795398181.bin
Binary file not shown.
6 changes: 3 additions & 3 deletions Engine/Test/Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@
<None Update="Dumps\58013408818.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Dumps\RVO\342696725855.bin">
<None Update="Dumps\RVO\445401195417.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Dumps\RVO\342696785265.bin">
<None Update="Dumps\RVO\4949504550.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Dumps\RVO\4949504550.bin">
<None Update="Dumps\RVO\526795398181.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
Expand Down
Binary file modified Server.LiteNetLib/Integration/Lockstep.Network.Server.dll
Binary file not shown.
Binary file modified Unity/Assets/Integration/Lockstep.Game.dll
Binary file not shown.
15 changes: 5 additions & 10 deletions Unity/Assets/Scripts/RTSNetworkedSimulation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ private void Awake()

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

_commandQueue = new NetworkCommandQueue(_client);
_commandQueue = new NetworkCommandQueue(_client)
{
LagCompensation = 3
};
_commandQueue.InitReceived += (sender, init) =>
{
AllActorIds = init.AllActors;
Expand All @@ -46,15 +49,7 @@ private void Awake()

public void DumpGameLog()
{
Stream stream = new FileStream(@"C:\Log\" + Math.Abs(Contexts.sharedInstance.gameState.hashCode.value) + ".bin", FileMode.Create, FileAccess.Write);
var serializer = new Serializer();
serializer.Put(Contexts.sharedInstance.gameState.hashCode.value);
serializer.Put(Contexts.sharedInstance.gameState.tick.value);
stream.Write(serializer.Data, 0, serializer.Length);

Simulation.GameLog.WriteTo(stream);

stream.Close();
Simulation.DumpGameLog(new FileStream(@"C:\Log\" + Math.Abs(Contexts.sharedInstance.gameState.hashCode.value) + ".bin", FileMode.Create, FileAccess.Write));
}

public void Execute(ICommand command)
Expand Down

0 comments on commit e892db7

Please sign in to comment.