using System.Collections.Generic; using FlaxEngine; using FlaxEngine.Assertions; namespace Game; public static class NetworkWorld { private class WorldState { public ulong frame; public List actors; public Dictionary playerFrameHistory; public WorldState() { actors = new List(); playerFrameHistory = new Dictionary(); } } private struct PlayerLagCompState { public Float3 position; } private class PlayerLagCompStates { public ulong oldestFrame; private PlayerLagCompState[] states; public PlayerLagCompStates(int frames) { states = new PlayerLagCompState[frames]; } public PlayerLagCompState GetState(ulong frame) { Assert.IsTrue(frame >= oldestFrame); ulong index = frame % (ulong)states.Length; return states[index]; } public void SetState(PlayerLagCompState state, ulong frame) { ulong index = frame % (ulong)states.Length; states[index] = state; } } }