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

Commit 29562ae

Browse files
committed
Cleanup all input entities
1 parent 75b5273 commit 29562ae

File tree

15 files changed

+39
-12
lines changed

15 files changed

+39
-12
lines changed

Engine/Client/Implementations/NetworkedDataReceiver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using Lockstep.Network.Utils;
88

99
namespace Lockstep.Client.Implementations
10-
{
10+
{
1111
public class NetworkedDataReceiver : IDataReceiver
1212
{
1313
private readonly INetwork _network;

Engine/Client/Simulation.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55

66
namespace Lockstep.Client
77
{
8-
/// <summary>
9-
/// This simulation listens for received data from the client and reacts accordingly. 'Executed' commands are first sent to the server.
10-
/// The final execution is done when the corresponding frame-packet arrives - this adds minimum 1 RTT delay to commands.
11-
/// </summary>
128
public class Simulation
139
{
1410
public event EventHandler Started;

Engine/Core/Core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
<Compile Include="Properties\AssemblyInfo.cs" />
129129
<Compile Include="ServiceContainer.cs" />
130130
<Compile Include="Systems\CalculateHashCode.cs" />
131+
<Compile Include="Systems\Input\CleanupInput.cs" />
131132
<Compile Include="Systems\Input\EmitInput.cs" />
132133
<Compile Include="Systems\Input\OnSpawnInputDoLoadEntityIntoGame.cs" />
133134
<Compile Include="Systems\Navigation\NavigationTick.cs" />

Engine/Core/Features/InputFeature.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ public InputFeature(Contexts contexts, ServiceContainer serviceContainer)
1111
//TODO: Add InputValidationSystem by matching input with playerId
1212
Add(new EmitInput(contexts));
1313

14-
Add(new OnSpawnInputDoLoadEntityIntoGame(contexts, serviceContainer.Get<IGameService>()));
14+
Add(new OnSpawnInputDoLoadEntityIntoGame(contexts, serviceContainer.Get<IGameService>()));
15+
16+
Add(new CleanupInput(contexts));
1517
}
1618
}
1719
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Entitas;
2+
3+
namespace Lockstep.Core.Systems.Input
4+
{
5+
public class CleanupInput : ICleanupSystem
6+
{
7+
private readonly InputContext _inputContext;
8+
9+
public CleanupInput(Contexts contexts)
10+
{
11+
_inputContext = contexts.input;
12+
}
13+
14+
public void Cleanup()
15+
{
16+
_inputContext.DestroyAllEntities();
17+
}
18+
}
19+
}

Engine/Server/Room.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Server
99
{
1010
public class Room
1111
{
12-
private const int TargetFps = 20;
12+
private const int TargetFps = 50;
1313

1414
private byte _nextPlayerId;
1515
private readonly int _size;

Engine/Test/InputTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void TestGameEntityHasUniqueId()
3939
[Fact]
4040
public void TestCommandIsExecuted()
4141
{
42-
var command = new Mock<ICommand>();
42+
var command = new Mock<ICommand>();
4343

4444
new Simulation(new LockstepSystems(new Contexts()), new LocalDataReceiver()).Execute(command.Object);
4545

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
512 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)