public void GetGame_GameExists_GotTheCorrectGame()
        {
            int       maxWins = 3;
            Move      move1   = new Move("Rock");
            Move      move2   = new Move("Scissors");
            Move      move3   = new Move("Paper");
            GameRules rules   = new GameRules(maxWins);

            move1.AddKill(move2.Name);
            move2.AddKill(move3.Name);
            move3.AddKill(move1.Name);

            rules.AddMove(move1);
            rules.AddMove(move2);
            rules.AddMove(move3);

            string sessionId = GameSessionManager.StartGame(rules, "player1", "player2");

            //Act
            Game game = GameSessionManager.GetGame(sessionId);

            //Assert
            Assert.AreEqual("player1", game.Player1Name);
            Assert.AreEqual("player2", game.Player2Name);
        }
示例#2
0
        public string StartGame(string player1Name, string player2Name)
        {
            string sessionId = GameSessionManager.StartGame(
                GetGameRules(), player1Name, player2Name);

            return(sessionId);
        }
        public void FinishAllGames_NoSessions_SessionCountIs0()
        {
            //Arrange
            int       maxWins = 3;
            Move      move1   = new Move("Rock");
            Move      move2   = new Move("Scissors");
            Move      move3   = new Move("Paper");
            GameRules rules   = new GameRules(maxWins);

            move1.AddKill(move2.Name);
            move2.AddKill(move3.Name);
            move3.AddKill(move1.Name);

            rules.AddMove(move1);
            rules.AddMove(move2);
            rules.AddMove(move3);

            GameSessionManager.StartGame(rules, "player1", "player2");
            GameSessionManager.StartGame(rules, "player1", "player2");
            GameSessionManager.StartGame(rules, "player1", "player2");

            //Act
            GameSessionManager.FinishAllGames();

            //Assert
            Assert.AreEqual(0, GameSessionManager.GetCurrentStartedCount());
        }
 private static void OnUpdateSocketServerSessionMessageReceived(UpdateSocketServerSessionMessage message)
 {
     if (GameSessionManager.TryGet(message.SessionId, out GameSession session))
     {
         session.UpdateSocketServerSessionMessageReceived(message);
     }
 }
        private static void OnGameMatchmakingMessageReceived(GameMatchmakingMessage message)
        {
            if (GameSessionManager.TryGet(message.SessionId, out GameSession session))
            {
                session.DestructGameState();

                if (session.FakeAttackState != null)
                {
                    session.LoadGameState(session.FakeAttackState);
                    session.FakeAttackState = null;

                    return;
                }

                switch (message.MatchmakingType)
                {
                case GameMatchmakingMessage.GameMatchmakingType.DEFAULT:
                    GameMatchmakingManager.Enqueue(session);
                    break;

                case GameMatchmakingMessage.GameMatchmakingType.DUEL:
                    GameDuelMatchmakingManager.Enqueue(session);
                    break;
                }
            }
        }
        public void FinishGame_OneGame_GameIsNotStarted()
        {
            int       maxWins = 3;
            Move      move1   = new Move("Rock");
            Move      move2   = new Move("Scissors");
            Move      move3   = new Move("Paper");
            GameRules rules   = new GameRules(maxWins);

            move1.AddKill(move2.Name);
            move2.AddKill(move3.Name);
            move3.AddKill(move1.Name);

            rules.AddMove(move1);
            rules.AddMove(move2);
            rules.AddMove(move3);

            string sessionId = GameSessionManager.StartGame(rules, "player1", "player2");

            //Act
            GameSessionManager.FinishGame(sessionId);

            //Assert
            Assert.AreEqual(false, GameSessionManager.IsGameStarted(sessionId));
            Assert.AreEqual(0, GameSessionManager.GetCurrentStartedCount());
        }
示例#7
0
        /// <summary>
        /// Tcp客户端连接断开,通知业务层
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="clientPoint"></param>
        public void OnTcpClientClosed(object sender, EndPoint clientPoint)
        {
            var        token = ClientConnectManager.GetToken(clientPoint.ToString());
            PacketHead head  = new PacketHead(ConnectType.Tcp, PacketMsgType.Closed);

            head.GameId   = token.GameId;
            head.ServerId = token.ServerId;
            head.Uid      = token.Uid;
            var session = GameSessionManager.GetSession(head.GameId, head.ServerId);

            if (session == null)
            {
                return;
            }
            head.Address    = session.GameAddress;
            head.EnableGzip = false;
            PacketMessage packet = new PacketMessage();

            packet.Head    = head;
            packet.Content = new byte[0];
            if (CheckConnected(head.Address))
            {
                OnSendToGame(head.Address, packet.ToByte());
            }
        }
示例#8
0
#pragma warning disable RECS0154 // Parameter is never used
        static void Main(string[] args)
#pragma warning restore RECS0154 // Parameter is never used
        {
            GameSessionManager gameSession = new GameSessionManager("Dragos",
                                                                    DifficultyLevel.Medium);

            gameSession.SimulateRound();
        }
示例#9
0
        public void SetSession(GameSessionManager session)
        {
            UnsubscribeFromCurrentSession();
            this.session = session;
            SubscribeToCurrentSession();

            UpdateViews();
        }
示例#10
0
 void Awake()
 {
     if (singleton != null)
     {
         Debug.LogError("GameSessionManager singleton already exists");
     }
     singleton = this;
 }
示例#11
0
 // Use this for initialization
 void Start()
 {
     myRigidbody              = GetComponent <Rigidbody2D>();
     myFeetCollider           = GetComponent <BoxCollider2D>();
     myAnimator               = GetComponent <Animator>();
     myRigidbody.gravityScale = defaultGravityScale;
     myGameSessionManager     = FindObjectOfType <GameSessionManager>();
 }
示例#12
0
 public ChatController()
 {
     _GameMan = new GameplayManager();
     _UserGameStoreManager = new UserGameStorageManager();
     _GameSessionManager   = new GameSessionManager();
     _ChatHub        = new HubService();
     _SessionManager = new SessionManager();
 }
        private static void OnGameSpectateLiveReplayMessageReceived(GameSpectateLiveReplayMessage message)
        {
            if (GameSessionManager.TryGet(message.SessionId, out GameSession session))
            {
                ServerRequestManager.Create(new LiveReplayAddSpectatorRequestMessage
                {
                    LiveReplayId = message.LiveReplayId,
                    SlotId       = message.IsEnemy ? 1 : 0,
                    SessionId    = session.Id
                }, ServerManager.GetDocumentSocket(9, message.LiveReplayId)).OnComplete = args =>
                {
                    if (args.ErrorCode == ServerRequestError.Success && args.ResponseMessage.Success)
                    {
                        if (session.IsDestructed())
                        {
                            ServerMessageManager.SendMessage(new LiveReplayRemoveSpectatorMessage
                            {
                                AccountId = message.LiveReplayId,
                                SessionId = session.Id
                            }, 9);
                        }
                        else
                        {
                            session.DestructGameState();
                            session.SpectateLiveReplayId     = message.LiveReplayId;
                            session.SpectateLiveReplaySlotId = message.IsEnemy ? 1 : 0;
                        }
                    }
                    else if (!session.IsDestructed())
                    {
                        LiveReplayFailedMessage liveReplayFailedMessage = new LiveReplayFailedMessage();

                        if (args.ErrorCode == ServerRequestError.Success)
                        {
                            LiveReplayAddSpectatorResponseMessage responseMessage = (LiveReplayAddSpectatorResponseMessage)args.ResponseMessage;

                            switch (responseMessage.ErrorCode)
                            {
                            case LiveReplayAddSpectatorResponseMessage.Reason.NOT_EXISTS:
                                liveReplayFailedMessage.SetReason(LiveReplayFailedMessage.Reason.GENERIC);
                                break;

                            case LiveReplayAddSpectatorResponseMessage.Reason.FULL:
                                liveReplayFailedMessage.SetReason(LiveReplayFailedMessage.Reason.NO_FREE_SLOTS);
                                break;
                            }
                        }
                        else
                        {
                            liveReplayFailedMessage.SetReason(LiveReplayFailedMessage.Reason.GENERIC);
                        }

                        session.SendPiranhaMessage(liveReplayFailedMessage, 1);
                    }
                };
            }
        }
示例#14
0
        /// <summary>
        /// 从游戏服接收数据
        /// </summary>
        /// <param name="gameAddress">游戏服的地址</param>
        /// <param name="data"></param>
        public override void Receive(string gameAddress, byte[] data)
        {
            try
            {
                PacketMessage packet  = PacketMessage.Parse(data);
                var           head    = packet.Head;
                GameSession   session = null;
                switch (head.MsgType)
                {
                case PacketMsgType.None:
                    //心跳包
                    session = GameSessionManager.GetSession(head.GameId, head.ServerId);
                    if (session != null)
                    {
                        session.GameAddress = gameAddress;
                        session.AccessTime  = DateTime.Now;
                        Console.WriteLine("{0}>>Connect to host of game server {1}-{2} from {3}", DateTime.Now.ToLongTimeString(), head.GameId, head.ServerId, gameAddress);
                    }
                    break;

                case PacketMsgType.Register:
                    session             = new GameSession(head.GameId, head.ServerId);
                    session.GameAddress = gameAddress;
                    session.AccessTime  = DateTime.Now;
                    GameSessionManager.Register(session);
                    break;

                case PacketMsgType.Push:
                    OnSendToClient(head.Address, data);
                    break;

                case PacketMsgType.SendTo:
                case PacketMsgType.Request:
                    //发送到其它通道
                    Send(head.Address, packet.ToByte());
                    break;

                case PacketMsgType.Broadcast:
                    //广播到客户端
                    var clientPointList = ClientConnectManager.FindAll(head.GameId, head.ServerId);
                    foreach (var endPoint in clientPointList)
                    {
                        OnSendToClient(endPoint.ToString(), data);
                    }
                    break;

                default:
                    throw new Exception(string.Format("The message type:{0} is not supported.", head.MsgType));
                }
            }
            catch (Exception ex)
            {
                TraceLog.WriteError("Receive game {0} error:{1}", gameAddress, ex);
            }
        }
示例#15
0
        public static void Init()
        {
            ServerGame.GameDatabase = new CouchbaseDatabase("magic-players", "game");

            GameResourceManager.Init();
            GameMatchmakingManager.Init();
            GameDuelMatchmakingManager.Init();
            GameAvatarManager.Init();
            GameSessionManager.Init();
            LiveReplayManager.Init();
            GameBaseGenerator.Init();
            WordCensorUtil.Init();
        }
示例#16
0
    // Start is called before the first frame update
    void Awake()
    {
        DontDestroyOnLoad(gameObject);

        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
    }
示例#17
0
 void Update()
 {
     timer -= Time.deltaTime;
     if (timer <= 0)
     {
         timer = 0.0f;
         Debug.Log("Timer is up!");
         GameSessionManager.RaiseOnEnd();
     }
     else
     {
         UpdateText();
     }
 }
        public override void OnReceiveSessionMessage(ServerSessionMessage message)
        {
            switch (message.GetMessageType())
            {
            case ServerMessageType.START_SERVER_SESSION:
                GameSessionManager.OnStartServerSessionMessageReceived((StartServerSessionMessage)message);
                break;

            case ServerMessageType.STOP_SERVER_SESSION:
                GameSessionManager.OnStopServerSessionMessageReceived((StopServerSessionMessage)message);
                break;

            case ServerMessageType.UPDATE_SOCKET_SERVER_SESSION:
                GameMessageManager.OnUpdateSocketServerSessionMessageReceived((UpdateSocketServerSessionMessage)message);
                break;

            case ServerMessageType.FORWARD_LOGIC_MESSAGE:
                GameMessageManager.OnForwardLogicMessageReceived((ForwardLogicMessage)message);
                break;

            case ServerMessageType.FORWARD_LOGIC_REQUEST_MESSAGE:
                GameMessageManager.OnForwardLogicMessageRequestMessageReceived((ForwardLogicRequestMessage)message);
                break;

            case ServerMessageType.CHANGE_GAME_STATE:
                GameMessageManager.OnChangeGameStateMessageReceived((ChangeGameStateMessage)message);
                break;

            case ServerMessageType.GAME_MATCHMAKING:
                GameMessageManager.OnGameMatchmakingMessageReceived((GameMatchmakingMessage)message);
                break;

            case ServerMessageType.GAME_MATCHMAKING_RESULT:
                GameMatchmakingManager.OnGameMatchmakingResultMessageReceived((GameMatchmakingResultMessage)message);
                break;

            case ServerMessageType.GAME_START_FAKE_ATTACK:
                GameMessageManager.OnGameStartFakeAttackMessageReceived((GameStartFakeAttackMessage)message);
                break;

            case ServerMessageType.GAME_FRIENDLY_SCOUT:
                GameMessageManager.OnGameFriendlyScoutMessageReceived((GameFriendlyScoutMessage)message);
                break;

            case ServerMessageType.GAME_SPECTATE_LIVE_REPLAY:
                GameMessageManager.OnGameSpectateLiveReplayMessageReceived((GameSpectateLiveReplayMessage)message);
                break;
            }
        }
示例#19
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(this.gameObject);
        }

        anim          = player.GetComponentInChildren <Animator>();
        currentLevel  = SceneManager.GetActiveScene().buildIndex;
        nextLoadLevel = currentLevel + 1;
    }
示例#20
0
    void Start()
    {
        if (_instance != null)
        {
            Debug.LogWarning("Another instance of GameSessionManager exists - ensure you're cleaning up properly");
        }
        else
        {
            _instance = this;
        }

        // spawn player if we don't exist yet
        if (localPlayerInstance == null)
        {
            localPlayerInstance = GameObject.Instantiate(LocalPlayerPrefab, LocalPlayerSpawn.position, Quaternion.identity);
        }
    }
示例#21
0
        public GameData MakePlay(
            string sessionId,
            string player1MoveName,
            string player2MoveName)
        {
            Game game = GetStartedGame(sessionId);

            game.Play(player1MoveName, player2MoveName);

            if (game.HasWinner())
            {
                RegisterGameResult(game);

                GameSessionManager.FinishGame(sessionId);
            }

            return(game.Data);
        }
示例#22
0
        public bool CreateGameSession(GameSession gameSession, string sessionToken)
        {
            ;
            var client = ClientTable.Instance.SearchClient(sessionToken);

            if (client != null)
            {
                if (client.User.IsAdmin && gameSession.Validate())
                {
                    GameSessionManager.AddSession(gameSession);
                    return(true);
                }

                return(false);
            }

            return(false);
        }
示例#23
0
    // Get game data
    protected override void LoadData()
    {
//TODO: sure it's called before any other method?
        gameSessionManager = GameSessionManager.Instance;
        currentLevel       = gameSessionManager.GetLevel();
        Debug.Log("GameDataManager:Load - level: " + currentLevel);

        lives     = gameSessionManager.GetLives();
        continues = gameSessionManager.GetContinues();

        LoadSpecifics();

        Debug.Log("GameDataManager:Load - lives: " + lives);
        Debug.Log("GameDataManager:Load - continues: " + continues);

        levels = GameGraphLoader.LoadLevelGraph(GRAPH_LEVELS);

        foreach (KeyValuePair <int, LevelNode> level in levels)
        {
            if (gameSessionManager.IsLevelCompleted(level.Key))
            {
                level.Value.completed = true;
            }
        }

/*
 * Debug.Log("levels:");
 *      foreach(KeyValuePair<int, LevelNode> levelNode in gameDataManager.levels) {
 *          LevelNode level = levelNode.Value;
 *          Debug.Log("level");
 *          Debug.Log("    id: " + level.id);
 *          Debug.Log("    scene: " + level.scene);
 *
 *          if (level.next != null) {
 *              for (int j=0; j<level.next.Count; ++j) {
 *                  Debug.Log("    next: " + level.next[j]);
 *              }
 *          }
 *      }
 */

        SetLevels();
    }
示例#24
0
        public void StartGame(bool withAi)
        {
            var     player1 = new Player(CellSign.X, turnController);
            IPlayer player2;

            if (withAi)
            {
                player2 = new AiPlayer(CellSign.O);
            }
            else
            {
                player2 = new Player(CellSign.O, turnController);
            }

            session = new GameSessionManager(player1, player2, GameField.MinFieldSize);
            fieldController.SetSession(session);

            session.StartGame();
        }
        private static void OnForwardLogicMessageReceived(ForwardLogicMessage message)
        {
            if (GameSessionManager.TryGet(message.SessionId, out GameSession session))
            {
                PiranhaMessage logicMessage = LogicMagicMessageFactory.Instance.CreateMessageByType(message.MessageType);

                if (logicMessage == null)
                {
                    throw new Exception("logicMessage should not be NULL!");
                }

                logicMessage.GetByteStream().SetByteArray(message.MessageBytes, message.MessageLength);
                logicMessage.SetMessageVersion(message.MessageVersion);
                logicMessage.Decode();

                if (!logicMessage.IsServerToClientMessage())
                {
                    session.LogicMessageManager.ReceiveMessage(logicMessage);
                }
            }
        }
示例#26
0
        /// <summary>
        /// 发送数据到游戏服
        /// </summary>
        /// <param name="clientAddress">客户端的地址</param>
        /// <param name="data"></param>
        public override void Send(string clientAddress, byte[] data)
        {
            PacketHead head = null;

            try
            {
                PacketMessage packet = PacketMessage.Parse(data);
                head = packet.Head;
                switch (head.MsgType)
                {
                case PacketMsgType.Request:
                    var session = GameSessionManager.GetSession(head.GameId, head.ServerId);
                    if (session != null)
                    {
                        string gameAddress = session.GameAddress;
                        OnSendToGame(gameAddress, data);
                    }
                    else
                    {
                        var error = PacketMessage.CreateError(head, MessageError.NotFound, LanguageHelper.GetLang().ServerMaintain);
                        OnSendToClient(clientAddress, error.ToByte());
                        TraceLog.WriteError("Can not find the game:{0} server:{1}", head.GameId, head.ServerId);
                    }
                    break;

                default:
                    throw new Exception(string.Format("The message type:{0} is not supported.", head.MsgType));
                }
            }
            catch (Exception ex)
            {
                TraceLog.WriteError("Send game to {0} error:{1}", clientAddress, ex);
                var error = PacketMessage.CreateError(head, MessageError.SystemError, LanguageHelper.GetLang().ServerBusy);
                OnSendToClient(clientAddress, error.ToByte());
            }
        }
        private static void OnGameFriendlyScoutMessageReceived(GameFriendlyScoutMessage message)
        {
            if (GameSessionManager.TryGet(message.SessionId, out GameSession session))
            {
                session.DestructGameState();

                FriendlyScoutHomeDataMessage friendlyScoutHomeDataMessage = new FriendlyScoutHomeDataMessage();
                LogicClientHome logicClientHome = new LogicClientHome();

                logicClientHome.GetCompressibleHomeJSON().Set(message.HomeJSON);
                logicClientHome.GetCompressibleGlobalJSON().Set(ResourceManager.SERVER_SAVE_FILE_GLOBAL);
                logicClientHome.GetCompressibleCalendarJSON().Set(ResourceManager.SERVER_SAVE_FILE_CALENDAR);

                friendlyScoutHomeDataMessage.SetAccountId(message.AccountId);
                friendlyScoutHomeDataMessage.SetAvatarId(message.AccountId);
                friendlyScoutHomeDataMessage.SetCurrentTimestamp(TimeUtil.GetTimestamp());
                friendlyScoutHomeDataMessage.SetLogicClientHome(logicClientHome);
                friendlyScoutHomeDataMessage.SetLogicClientAvatar(session.GameAvatar.LogicClientAvatar);
                friendlyScoutHomeDataMessage.SetMapId(message.MapId);
                friendlyScoutHomeDataMessage.SetStreamId(message.StreamId);

                session.SendPiranhaMessage(friendlyScoutHomeDataMessage, 1);
            }
        }
        public void GetGameSessionCount_OneGame_SessionCountIs1()
        {
            int       maxWins = 3;
            Move      move1   = new Move("Rock");
            Move      move2   = new Move("Scissors");
            Move      move3   = new Move("Paper");
            GameRules rules   = new GameRules(maxWins);

            move1.AddKill(move2.Name);
            move2.AddKill(move3.Name);
            move3.AddKill(move1.Name);

            rules.AddMove(move1);
            rules.AddMove(move2);
            rules.AddMove(move3);

            string sessionId = GameSessionManager.StartGame(rules, "player1", "player2");

            //Act
            int sessionCount = GameSessionManager.GetCurrentStartedCount();

            //Assert
            Assert.AreEqual(1, sessionCount);
        }
示例#29
0
 public MockClient3(GameSessionManager gameSessionManager) : this()
 {
     this.gameSessionManager = gameSessionManager;
 }
        /// <summary>
        /// Starts the main game process.
        /// </summary>
        public static void StartGameProcess(GameSessionManager sessionManager)
        {
            GameSessionManager = sessionManager;

            Logger.Log("About to launch main game executable.");

            // Re-process INI files
            PreprocessorBackgroundTask.Instance.Run();

            // Wait for INI preprocessing to complete. Time-out if it seems to have stalled.
            // TODO ideally this should be handled in the UI so the client doesn't appear just frozen for the user.
            int waitTimes = 0;

            while (PreprocessorBackgroundTask.Instance.IsRunning)
            {
                Thread.Sleep(1000);
                waitTimes++;
                if (waitTimes > 10)
                {
                    MessageBox.Show("INI preprocessing not complete. Please try " +
                                    "launching the game again. If the problem persists, " +
                                    "contact the game or mod authors for support.");
                    return;
                }
            }

            OSVersion osVersion = ClientConfiguration.Instance.GetOperatingSystemVersion();

            string gameExecutableName;
            string additionalExecutableName = string.Empty;

            if (osVersion == OSVersion.UNIX)
            {
                gameExecutableName = ClientConfiguration.Instance.UnixGameExecutableName;
            }
            else
            {
                string launcherExecutableName = ClientConfiguration.Instance.GameLauncherExecutableName;
                if (string.IsNullOrEmpty(launcherExecutableName))
                {
                    gameExecutableName = ClientConfiguration.Instance.GetGameExecutableName();
                }
                else
                {
                    gameExecutableName       = launcherExecutableName;
                    additionalExecutableName = "\"" + ClientConfiguration.Instance.GetGameExecutableName() + "\" ";
                }
            }

            string extraCommandLine = ClientConfiguration.Instance.ExtraExeCommandLineParameters;

            File.Delete(ProgramConstants.GamePath + "DTA.LOG");
            File.Delete(ProgramConstants.GamePath + "TI.LOG");
            File.Delete(ProgramConstants.GamePath + "TS.LOG");

            GameProcessStarting?.Invoke();

            if (UserINISettings.Instance.WindowedMode && UseQres)
            {
                Logger.Log("Windowed mode is enabled - using QRes.");
                Process QResProcess = new Process();
                QResProcess.StartInfo.FileName        = ProgramConstants.QRES_EXECUTABLE;
                QResProcess.StartInfo.UseShellExecute = false;
                if (!string.IsNullOrEmpty(extraCommandLine))
                {
                    QResProcess.StartInfo.Arguments = "c=16 /R " + "\"" + ProgramConstants.GamePath + gameExecutableName + "\" " + additionalExecutableName + "-SPAWN " + extraCommandLine;
                }
                else
                {
                    QResProcess.StartInfo.Arguments = "c=16 /R " + "\"" + ProgramConstants.GamePath + gameExecutableName + "\" " + additionalExecutableName + "-SPAWN";
                }
                QResProcess.EnableRaisingEvents = true;
                QResProcess.Exited += new EventHandler(Process_Exited);
                Logger.Log("Launch executable: " + QResProcess.StartInfo.FileName);
                Logger.Log("Launch arguments: " + QResProcess.StartInfo.Arguments);
                try
                {
                    QResProcess.Start();
                }
                catch (Exception ex)
                {
                    Logger.Log("Error launching QRes: " + ex.Message);
                    MessageBox.Show("Error launching " + ProgramConstants.QRES_EXECUTABLE + ". Please check that your anti-virus isn't blocking the CnCNet Client. " +
                                    "You can also try running the client as an administrator." + Environment.NewLine + Environment.NewLine + "You are unable to participate in this match." +
                                    Environment.NewLine + Environment.NewLine + "Returned error: " + ex.Message,
                                    "Error launching game", MessageBoxButtons.OK);
                    Process_Exited(QResProcess, EventArgs.Empty);
                    return;
                }

                if (Environment.ProcessorCount > 1 && SingleCoreAffinity)
                {
                    QResProcess.ProcessorAffinity = (IntPtr)2;
                }
            }
            else
            {
                Process DtaProcess = new Process();
                DtaProcess.StartInfo.FileName        = gameExecutableName;
                DtaProcess.StartInfo.UseShellExecute = false;
                if (!string.IsNullOrEmpty(extraCommandLine))
                {
                    DtaProcess.StartInfo.Arguments = " " + additionalExecutableName + "-SPAWN " + extraCommandLine;
                }
                else
                {
                    DtaProcess.StartInfo.Arguments = additionalExecutableName + "-SPAWN";
                }
                DtaProcess.EnableRaisingEvents = true;
                DtaProcess.Exited += new EventHandler(Process_Exited);
                Logger.Log("Launch executable: " + DtaProcess.StartInfo.FileName);
                Logger.Log("Launch arguments: " + DtaProcess.StartInfo.Arguments);
                try
                {
                    DtaProcess.Start();
                    Logger.Log("GameProcessLogic: Process started.");
                }
                catch (Exception ex)
                {
                    Logger.Log("Error launching " + gameExecutableName + ": " + ex.Message);
                    MessageBox.Show("Error launching " + gameExecutableName + ". Please check that your anti-virus isn't blocking the CnCNet Client. " +
                                    "You can also try running the client as an administrator." + Environment.NewLine + Environment.NewLine + "You are unable to participate in this match." +
                                    Environment.NewLine + Environment.NewLine + "Returned error: " + ex.Message,
                                    "Error launching game", MessageBoxButtons.OK);
                    Process_Exited(DtaProcess, EventArgs.Empty);
                    return;
                }

                if (Environment.ProcessorCount > 1 && SingleCoreAffinity)
                {
                    DtaProcess.ProcessorAffinity = (IntPtr)2;
                }
            }

            GameProcessStarted?.Invoke();

            Logger.Log("Waiting for qres.dat or " + gameExecutableName + " to exit.");
        }
 /// <summary>
 /// Enable the game session manager
 /// </summary>
 private void enableManager()
 {
     if (base.isLocalPlayer) {
         if (singleton != null)
         {
             Debug.LogError("GameMaster singleton already exists");
             return;
         }
         singleton = this;
         CameraController.singleton.SetMapDimensions(map.height, map.width);
         CameraController.singleton.setGlobalView ();
     }
     if (base.isClient) {
     //			GameObject panel = GameObject.FindGameObjectWithTag ("EndGamePanel");
     //			panel.SetActive (true);
     }
 }