UnityLockstep
A WIP implementation of the Serverbeat-Protocol described here: https://www.reddit.com/r/Unity3D/comments/aewepu/rts_networking_simulate_on_serverbeat/
Getting started
- Open Engine/Lockstep.sln
- Run Server-project, enter “1” when asked for room-size
- Open SampleScene in Unity
- Hit play and wait until connection to server is established
- Holding right mouse button will continously spawn new agents, press ‘X’ to navigate all agents to your current mouse position
Getting Multiplayer
- Build and run the Unityproject
- Start the server. The roomsize will default to 2 after a few seconds of no input
- Hit play in Unity so you should now have two instances of the game running
- Wait until both players are connected to the server. The server will display a message when the simulation has started.
- For controls, same as above
Dependencies
- The ECS-Project currently targets .NET Framework 4.6.1 (#806)
- The server targets .NET Core Framework 2.2.103 (link to setup)
References
Inspired by LockstepFramework, in memory of SnpM: https://github.com/SnpM/LockstepFramework
Uses a fork of BEPUPhysics for deterministic physics: https://github.com/sam-vdp/bepuphysics1int
Uses FixedMath.Net for deterministic fp-calculations: https://github.com/asik/FixedMath.Net
Uses Entitas as ECS Framework: https://github.com/sschmid/Entitas-CSharp
The project includes an implementation example using LiteNetLib: https://github.com/RevenantX/LiteNetLib
Limitations
- Physics values are limited to 1000 so keep your world in these limitations or shift the world when your values become too large