public UserCmdParallelExecuteManagerSystem(IGameModule gameModule,
                                                   IUserCmdExecuteSystemHandler handler,
                                                   IGameStateProcessorFactory gameStateProcessorFactory,
                                                   int threadCount)
        {
            _systems   = new List <IUserCmdExecuteSystem>();
            _taskInfos = new List <TaskInfo>();
            _systems.Add(new UserCmdPreExecuteSystem(gameStateProcessorFactory));
            _systems.AddRange(gameModule.UserCmdExecuteSystems);
            _systems.Add(new UserCmdPostExecuteSystem());

            _handler = handler;
            int count = _systems.Count;

            _systemsPool = new List <IUserCmdExecuteSystem> [threadCount];
            InitTask(threadCount, count);
            _mainThread = new WorkThread("Main", _systems);
            WorkThread[] slaveThreads = new WorkThread[threadCount];
            for (var i = 0; i < threadCount; i++)
            {
                slaveThreads[i] = new WorkThread("Slave", _systemsPool[i]);
            }

            _taskDisparcher = new TaskDispatcher(threadCount, _mainThread, slaveThreads, _taskInfos);

            _mainThread.Name = "MainThread";
            _mainThread.SetTaskDisparcher(_taskDisparcher);
            for (var i = 0; i < threadCount; i++)
            {
                slaveThreads[i].SetTaskDisparcher(_taskDisparcher);
                slaveThreads[i].Name = string.Format("SlaveThreads:{0}", i);
            }

            _taskDisparcher.Start();
        }
Esempio n. 2
0
 public UserCmdExecuteManagerSystem(IGameModule gameModule,
                                    IUserCmdExecuteSystemHandler handler)
 {
     _systems = gameModule.UserCmdExecuteSystems;
     _handler = handler;
     Init();
 }
Esempio n. 3
0
        public UserCmdUpdateMsgExecuteManagerSystem(IGameModule gameModule,
                                                    IUserCmdExecuteSystemHandler handler, ISyncUpdateLatestMsgHandler syncUpdateLatestMsgHandler)
        {
            _systems = gameModule.UserCmdExecuteSystems;
            _handler = handler;
            _syncUpdateLatestMsgHandler = syncUpdateLatestMsgHandler;

            Init();
        }
Esempio n. 4
0
 public UserCmdExecuteManagerSystem(IGameModule gameModule,
                                    IUserCmdExecuteSystemHandler handler,
                                    IGameStateProcessorFactory gameStateProcessorFactory)
 {
     _systems = gameModule.UserCmdExecuteSystems;
     _handler = handler;
     _gameStateProcessorFactory = gameStateProcessorFactory;
     _stateProviderPool         = gameStateProcessorFactory.GetProviderPool();
     _statePool = gameStateProcessorFactory.GetStatePool();
     Init();
 }
Esempio n. 5
0
        public ServerMainFeature(
            string name,
            IGameModule topLevelGameModule,
            IUserCmdExecuteSystemHandler userCmdExecuteSystemHandler,
            IVehicleCmdExecuteSystemHandler vehicleCmdExecuteSystemHandler,
            ISimulationTimer simluationTimer,
            IVehicleExecutionSelector vehicleExecutionSelector,
            ICommonSessionObjects sessionObjects,
            IRoom room) : base(name)
        {
            topLevelGameModule.Init();
            Add(new ModuleInitSystem(topLevelGameModule, sessionObjects.LoadRequestManager));
            Add(new EntityCreateSystem(topLevelGameModule));

            Add(new GameStateUpdateSystem(topLevelGameModule));

            Add(new PhysicsInitSystem(topLevelGameModule));
            Add(new PhysicsUpdateSystem(topLevelGameModule));
            Add(new VehicleCmdExecuteManagerSystem(vehicleExecutionSelector, topLevelGameModule,
                                                   vehicleCmdExecuteSystemHandler, simluationTimer, true, SharedConfig.ServerAuthorative));
            Add(new PhysicsPostUpdateSystem(topLevelGameModule));
#if (true)
//            Add(new UserCmdExecuteManagerSystem(topLevelGameModule,
//                userCmdExecuteSystemHandler,
//                sessionObjects.GameStateProcessorFactory));
            Add(new UserCmdUpdateMsgExecuteManagerSystem(topLevelGameModule, userCmdExecuteSystemHandler,
                                                         new SyncUpdateLatestMsgHandler()));
#else
            Add(new UserCmdParallelExecuteManagerSystem(topLevelGameModule,
                                                        userCmdExecuteSystemHandler,
                                                        sessionObjects.GameStateProcessorFactory, 4));
#endif

            Add(new LoadRequestManagerSystem(sessionObjects));
            Add(new ResourceLoadSystem(topLevelGameModule, sessionObjects.LoadRequestManager));

            Add(new GamePlaySystem(topLevelGameModule));

            Add(new CommonLifeTimeSystem(sessionObjects.GameContexts));
            Add(new EntityCleanUpSystem(topLevelGameModule));
            Add(new CommonDestroySystem(sessionObjects));
            Add(new FreeGameRuleSystem(room));
            Add(new SendSnapshotSystem(room));
            Add(new CompensationSnapshotSystem(room));
        }