diff --git a/Engine/Client/Implementations/LocalDataReceiver.cs b/Engine/Client/Implementations/LocalDataReceiver.cs
index 0979d4e..44eba0c 100644
--- a/Engine/Client/Implementations/LocalDataReceiver.cs
+++ b/Engine/Client/Implementations/LocalDataReceiver.cs
@@ -14,7 +14,7 @@ public void Init()
InitReceived?.Invoke(this, EventArgs.Empty);
}
- public void AddFrame(Frame frame)
+ public void Receive(Frame frame)
{
FrameReceived?.Invoke(this, frame);
}
diff --git a/Engine/Client/Implementations/NetworkedDataReceiver.cs b/Engine/Client/Implementations/NetworkedDataReceiver.cs
index 323c272..eabca4b 100644
--- a/Engine/Client/Implementations/NetworkedDataReceiver.cs
+++ b/Engine/Client/Implementations/NetworkedDataReceiver.cs
@@ -7,7 +7,7 @@
using Lockstep.Network.Utils;
namespace Lockstep.Client.Implementations
-{
+{
public class NetworkedDataReceiver : IDataReceiver
{
private readonly INetwork _network;
diff --git a/Engine/Client/Simulation.cs b/Engine/Client/Simulation.cs
index 29b78fa..a4b56bc 100644
--- a/Engine/Client/Simulation.cs
+++ b/Engine/Client/Simulation.cs
@@ -5,10 +5,6 @@
namespace Lockstep.Client
{
- ///
- /// This simulation listens for received data from the client and reacts accordingly. 'Executed' commands are first sent to the server.
- /// The final execution is done when the corresponding frame-packet arrives - this adds minimum 1 RTT delay to commands.
- ///
public class Simulation
{
public event EventHandler Started;
diff --git a/Engine/Core/Core.csproj b/Engine/Core/Core.csproj
index bd29235..6efb347 100644
--- a/Engine/Core/Core.csproj
+++ b/Engine/Core/Core.csproj
@@ -128,6 +128,7 @@
+
diff --git a/Engine/Core/Features/InputFeature.cs b/Engine/Core/Features/InputFeature.cs
index 13e6e87..a1527ba 100644
--- a/Engine/Core/Features/InputFeature.cs
+++ b/Engine/Core/Features/InputFeature.cs
@@ -11,7 +11,9 @@ public InputFeature(Contexts contexts, ServiceContainer serviceContainer)
//TODO: Add InputValidationSystem by matching input with playerId
Add(new EmitInput(contexts));
- Add(new OnSpawnInputDoLoadEntityIntoGame(contexts, serviceContainer.Get()));
+ Add(new OnSpawnInputDoLoadEntityIntoGame(contexts, serviceContainer.Get()));
+
+ Add(new CleanupInput(contexts));
}
}
}
diff --git a/Engine/Core/LockstepSystems.cs b/Engine/Core/LockstepSystems.cs
index ed6975b..a4c2770 100644
--- a/Engine/Core/LockstepSystems.cs
+++ b/Engine/Core/LockstepSystems.cs
@@ -5,16 +5,11 @@
namespace Lockstep.Core
{
public sealed class LockstepSystems : Entitas.Systems, ISystems
- {
- private IFrameBuffer _frameBuffer;
- private readonly Contexts _contexts;
-
+ {
public long HashCode => _contexts.gameState.hashCode.value;
- public void SetFrameBuffer(IFrameBuffer frameBuffer)
- {
- _frameBuffer = frameBuffer;
- }
+ private IFrameBuffer _frameBuffer;
+ private readonly Contexts _contexts;
public LockstepSystems(Contexts contexts, params IService[] additionalServices)
{
@@ -36,6 +31,10 @@ public LockstepSystems(Contexts contexts, params IService[] additionalServices)
Add(new HashCodeFeature(contexts, serviceContainer));
}
+ public void SetFrameBuffer(IFrameBuffer frameBuffer)
+ {
+ _frameBuffer = frameBuffer;
+ }
public void Tick()
{
diff --git a/Engine/Core/Systems/Input/CleanupInput.cs b/Engine/Core/Systems/Input/CleanupInput.cs
new file mode 100644
index 0000000..8d36c9b
--- /dev/null
+++ b/Engine/Core/Systems/Input/CleanupInput.cs
@@ -0,0 +1,19 @@
+using Entitas;
+
+namespace Lockstep.Core.Systems.Input
+{
+ public class CleanupInput : ICleanupSystem
+ {
+ private readonly InputContext _inputContext;
+
+ public CleanupInput(Contexts contexts)
+ {
+ _inputContext = contexts.input;
+ }
+
+ public void Cleanup()
+ {
+ _inputContext.DestroyAllEntities();
+ }
+ }
+}
diff --git a/Engine/Server/Room.cs b/Engine/Server/Room.cs
index b89dfa3..39164b0 100644
--- a/Engine/Server/Room.cs
+++ b/Engine/Server/Room.cs
@@ -9,7 +9,7 @@ namespace Server
{
public class Room
{
- private const int TargetFps = 20;
+ private const int TargetFps = 50;
private byte _nextPlayerId;
private readonly int _size;
diff --git a/Engine/Test/InputTests.cs b/Engine/Test/InputTests.cs
index 5207c4a..6dee638 100644
--- a/Engine/Test/InputTests.cs
+++ b/Engine/Test/InputTests.cs
@@ -39,7 +39,7 @@ public void TestGameEntityHasUniqueId()
[Fact]
public void TestCommandIsExecuted()
{
- var command = new Mock();
+ var command = new Mock();
new Simulation(new LockstepSystems(new Contexts()), new LocalDataReceiver()).Execute(command.Object);
diff --git a/Unity/Assets/Integration/Lockstep.Client.dll b/Unity/Assets/Integration/Lockstep.Client.dll
index 20da6c3..296ce08 100644
Binary files a/Unity/Assets/Integration/Lockstep.Client.dll and b/Unity/Assets/Integration/Lockstep.Client.dll differ
diff --git a/Unity/Assets/Integration/Lockstep.Client.pdb b/Unity/Assets/Integration/Lockstep.Client.pdb
index d15ab4b..9fc8a5d 100644
Binary files a/Unity/Assets/Integration/Lockstep.Client.pdb and b/Unity/Assets/Integration/Lockstep.Client.pdb differ
diff --git a/Unity/Assets/Integration/Lockstep.Core.dll b/Unity/Assets/Integration/Lockstep.Core.dll
index ada26e6..19e2fdf 100644
Binary files a/Unity/Assets/Integration/Lockstep.Core.dll and b/Unity/Assets/Integration/Lockstep.Core.dll differ
diff --git a/Unity/Assets/Integration/Lockstep.Core.dll.mdb b/Unity/Assets/Integration/Lockstep.Core.dll.mdb
index db1775c..2db2c55 100644
Binary files a/Unity/Assets/Integration/Lockstep.Core.dll.mdb and b/Unity/Assets/Integration/Lockstep.Core.dll.mdb differ
diff --git a/Unity/Assets/Integration/Lockstep.Core.pdb b/Unity/Assets/Integration/Lockstep.Core.pdb
index 535cf36..4580f64 100644
Binary files a/Unity/Assets/Integration/Lockstep.Core.pdb and b/Unity/Assets/Integration/Lockstep.Core.pdb differ
diff --git a/Unity/Assets/Scenes/SampleScene.unity b/Unity/Assets/Scenes/SampleScene.unity
index d18e728..b6b7126 100644
--- a/Unity/Assets/Scenes/SampleScene.unity
+++ b/Unity/Assets/Scenes/SampleScene.unity
@@ -145,7 +145,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 28ef8c68bade09b41aca258d42a632f2, type: 3}
m_Name:
m_EditorClassIdentifier:
- lastTab: 2
+ lastTab: 0
movementSettingsFoldout: 0
zoomingSettingsFoldout: 0
rotationSettingsFoldout: 0
@@ -155,7 +155,7 @@ MonoBehaviour:
inputSettingsFoldout: 0
useFixedUpdate: 0
keyboardMovementSpeed: 30
- screenEdgeMovementSpeed: 3
+ screenEdgeMovementSpeed: 9
followingSpeed: 5
rotationSped: 3
panningSpeed: 10
@@ -186,7 +186,7 @@ MonoBehaviour:
zoomOutKey: 113
useScrollwheelZooming: 1
zoomingAxis: Mouse ScrollWheel
- useKeyboardRotation: 1
+ useKeyboardRotation: 0
rotateRightKey: 120
rotateLeftKey: 122
useMouseRotation: 0
@@ -557,7 +557,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
EntityDatabase: {fileID: 11400000, guid: a0d4789ca6cc5ab42a1264102206ac3f, type: 2}
- IP: 127.0.0.1
+ ServerIp: 127.0.0.1
+ ServerPort: 9050
--- !u!114 &1524441392
MonoBehaviour:
m_ObjectHideFlags: 0
diff --git a/Unity/Assets/Scripts/Camera/Source.txt b/Unity/Assets/Scripts/Camera/Source.txt
new file mode 100644
index 0000000..9b8ff54
--- /dev/null
+++ b/Unity/Assets/Scripts/Camera/Source.txt
@@ -0,0 +1 @@
+https://github.com/densylkin/RTS_Camera
\ No newline at end of file
diff --git a/Unity/Assets/Scripts/Camera/Source.txt.meta b/Unity/Assets/Scripts/Camera/Source.txt.meta
new file mode 100644
index 0000000..9608b4c
--- /dev/null
+++ b/Unity/Assets/Scripts/Camera/Source.txt.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 60d006fdcc1f36d46932bbe52d25c141
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Unity/Assets/Scripts/RTSNetworkedSimulation.cs b/Unity/Assets/Scripts/RTSNetworkedSimulation.cs
index 098b6d4..66b8628 100644
--- a/Unity/Assets/Scripts/RTSNetworkedSimulation.cs
+++ b/Unity/Assets/Scripts/RTSNetworkedSimulation.cs
@@ -24,12 +24,12 @@ public class RTSNetworkedSimulation : MonoBehaviour
private bool _simulationStarted;
private LockstepSystems _systems;
- private NetworkedDataSource _dataSource;
+ private NetworkedDataReceiver _dataReceiver;
private void Awake()
{
Instance = this;
- _dataSource = new NetworkedDataSource(_client)
+ _dataReceiver = new NetworkedDataReceiver(_client)
.RegisterCommand(() => new SpawnCommand())
.RegisterCommand(() => new NavigateCommand());
@@ -37,13 +37,13 @@ private void Awake()
new UnityLogger());
_simulation =
- new Simulation(_systems, _dataSource);
+ new Simulation(_systems, _dataReceiver);
_simulation.Started += (sender, args) => _simulationStarted = true;
- _simulation.Ticked += (id, frame) =>
+ _simulation.Ticked += id =>
{
- _dataSource.Receive(MessageTag.HashCode, new HashCode {FrameNumber = id, Value = Contexts.sharedInstance.gameState.hashCode.value});
+ _dataReceiver.Receive(MessageTag.HashCode, new HashCode {FrameNumber = id, Value = _systems.HashCode});
};
}