public AbstractLockstep(float deltaTime, ICommunicator communicator, IPhysicsManagerBase physicsManager, int syncWindow, int panicWindow, int rollbackWindow, TrueSyncEventCallback OnGameStarted, TrueSyncEventCallback OnGamePaused, TrueSyncEventCallback OnGameUnPaused, TrueSyncEventCallback OnGameEnded, TrueSyncPlayerDisconnectionCallback OnPlayerDisconnection, TrueSyncUpdateCallback OnStepUpdate, TrueSyncInputDataProvider InputDataProvider) { AbstractLockstep.instance = this; this.deltaTime = deltaTime; this.syncWindow = syncWindow; this.panicWindow = panicWindow; this.rollbackWindow = rollbackWindow; this.totalWindow = syncWindow + rollbackWindow; this.StepUpdate = OnStepUpdate; this.OnGameStarted = OnGameStarted; this.OnGamePaused = OnGamePaused; this.OnGameUnPaused = OnGameUnPaused; this.OnGameEnded = OnGameEnded; this.OnPlayerDisconnection = OnPlayerDisconnection; this.InputDataProvider = InputDataProvider; this.ticks = 0; this.players = new Dictionary <byte, TSPlayer>(4); this.activePlayers = new List <TSPlayer>(4); this.auxPlayersSyncedData = new List <SyncedData>(4); this.auxPlayersInputData = new List <InputDataBase>(4); this.communicator = communicator; this.physicsManager = physicsManager; this.compoundStats = new CompoundStats(); this.bufferSyncedInfo = new GenericBufferWindow <SyncedInfo>(3); this.checksumOk = true; this.simulationState = AbstractLockstep.SimulationState.NOT_STARTED; this.bodiesToDestroy = new Dictionary <int, List <IBody> >(); this.playersDisconnect = new Dictionary <int, List <byte> >(); this.ReplayMode = ReplayRecord.replayMode; }
public AbstractLockstep(FP deltaTime, ICommunicator communicator, IPhysicsManager physicsManager, int syncWindow, int panicWindow, int rollbackWindow, TrueSyncEventCallback OnGameStarted, TrueSyncEventCallback OnGamePaused, TrueSyncEventCallback OnGameUnPaused, TrueSyncEventCallback OnGameEnded, TrueSyncPlayerDisconnectionCallback OnPlayerDisconnection, TrueSyncUpdateCallback OnStepUpdate, TrueSyncInputCallback GetLocalData) { this.deltaTime = deltaTime; this.syncWindow = syncWindow; this.panicWindow = panicWindow; this.rollbackWindow = rollbackWindow; this.totalWindow = syncWindow + rollbackWindow; this.StepUpdate = OnStepUpdate; this.OnGameStarted = OnGameStarted; this.OnGamePaused = OnGamePaused; this.OnGameUnPaused = OnGameUnPaused; this.OnGameEnded = OnGameEnded; this.OnPlayerDisconnection = OnPlayerDisconnection; this.GetLocalData = GetLocalData; this.ticks = 0; this.players = new SortedDictionary <byte, TSPlayer>(); this.communicator = communicator; bool flag = communicator != null; if (flag) { this.communicator.AddEventListener(new OnEventReceived(this.OnEventDataReceived)); } this.physicsManager = physicsManager; this.compoundStats = new CompoundStats(); this.bufferSyncedInfo = new GenericBufferWindow <SyncedInfo>(3); this.checksumOk = true; this.simulationState = AbstractLockstep.SimulationState.NOT_STARTED; this.bodiesToDestroy = new Dictionary <int, List <IBody> >(); this.delegatesToExecute = new Dictionary <int, List <Delegate> >(); this.ReplayRecord = ReplayRecord.replayToLoad; this.ReplayMode = ReplayRecord.replayMode; this.time = FP.Zero; StateTracker.AddTracking(this, "time"); }
public DefaultLockstep(float deltaTime, ICommunicator communicator, IPhysicsManagerBase physicsManager, int syncWindow, int panicTime, int rollbackWindow, TrueSyncEventCallback OnGameStarted, TrueSyncEventCallback OnGamePaused, TrueSyncEventCallback OnGameUnPaused, TrueSyncEventCallback OnGameEnded, TrueSyncPlayerDisconnectionCallback OnPlayerDisconnection, TrueSyncUpdateCallback OnStepUpdate, TrueSyncInputDataProvider InputDataProvider) : base(deltaTime, communicator, physicsManager, syncWindow, panicTime, rollbackWindow, OnGameStarted, OnGamePaused, OnGameUnPaused, OnGameEnded, OnPlayerDisconnection, OnStepUpdate, InputDataProvider) { }
public RollbackLockstep(float deltaTime, ICommunicator communicator, IPhysicsManagerBase physicsManager, int syncWindow, int panicTime, int rollbackWindow, TrueSyncEventCallback OnGameStarted, TrueSyncEventCallback OnGamePaused, TrueSyncEventCallback OnGameUnPaused, TrueSyncEventCallback OnGameEnded, TrueSyncPlayerDisconnectionCallback OnPlayerDisconnection, TrueSyncUpdateCallback OnStepUpdate, TrueSyncInputCallback GetLocalData, TrueSyncInputDataProvider InputDataProvider) : base(deltaTime, communicator, physicsManager, syncWindow, panicTime, rollbackWindow, OnGameStarted, OnGamePaused, OnGameUnPaused, OnGameEnded, OnPlayerDisconnection, OnStepUpdate, GetLocalData, InputDataProvider) { this.bufferWorldClone = new GenericBufferWindow <IWorldClone>(rollbackWindow, new GenericBufferWindow <IWorldClone> .NewInstance(physicsManager.GetWorldClone)); this.rollbackIndex = rollbackWindow; }
public static AbstractLockstep NewInstance(float deltaTime, ICommunicator communicator, IPhysicsManagerBase physicsManager, int syncWindow, int panicWindow, int rollbackWindow, TrueSyncEventCallback OnGameStarted, TrueSyncEventCallback OnGamePaused, TrueSyncEventCallback OnGameUnPaused, TrueSyncEventCallback OnGameEnded, TrueSyncPlayerDisconnectionCallback OnPlayerDisconnection, TrueSyncUpdateCallback OnStepUpdate, TrueSyncInputCallback GetLocalData, TrueSyncInputDataProvider InputDataProvider) { bool flag = rollbackWindow <= 0 || communicator == null; AbstractLockstep result; if (flag) { result = new DefaultLockstep(deltaTime, communicator, physicsManager, syncWindow, panicWindow, rollbackWindow, OnGameStarted, OnGamePaused, OnGameUnPaused, OnGameEnded, OnPlayerDisconnection, OnStepUpdate, GetLocalData, InputDataProvider); } else { result = new RollbackLockstep(deltaTime, communicator, physicsManager, syncWindow, panicWindow, rollbackWindow, OnGameStarted, OnGamePaused, OnGameUnPaused, OnGameEnded, OnPlayerDisconnection, OnStepUpdate, GetLocalData, InputDataProvider); } return(result); }