Пример #1
0
        private static MatchMakerSettings MakeDefault(MatchMakerSettings ss)
        {
            //string closeOnMatchEndedArg = "Game.HeadlessInfo.CloseOnMatchEnded:true";
            //string noPlayerTimeoutArg = $"Game.HeadlessInfo.NoPlayerTimeout:{noPlayerTimeout}";
            //string timeoutArg = $"Game.HeadlessInfo.Timeout:{timeout}";
            //string portArg = $"Game.Network.DefaultAddress.Port:{port}";

            //return $"{closeOnMatchEndedArg} {noPlayerTimeoutArg} {timeoutArg} {portArg}";

            ss.InstanceArguments        = "Game.HeadlessInfo.CloseOnMatchEnded:true";
            ss.PortArgString            = "Game.Network.DefaultAddress.Port:{0}";
            ss.NoPlayerTimeoutArgString = "Game.HeadlessInfo.NoPlayerTimeout:{0}";
            ss.TimeoutArgString         = "Game.HeadlessInfo.Timeout:{0}";
            ss.InstanceCreateNoWindow   = true;
            ss.InstanceUseShellExecute  = false;
            ss.GameServerPortRange      = new PortRange(20000, 20010);
            ss.MasterPort                   = 19999;
            ss.HeartBeatInterval            = 1000;
            ss.MaxAllowedMissedHeartBeats   = 2;
            ss.ServerTick                   = 100;
            ss.PlayersPerGameInstance       = 2;
            ss.MaxPlayersInQueue            = 10;
            ss.PlayersMatchFoundNotifyDelay = 1000;
            string p = Path.GetFullPath("./Game/WindowsStandaloneHeadless.exe");

            ss.GameServerPath = p;
            return(ss);
        }
Пример #2
0
 public MatchMakingServer(MatchMakerSettings settings)
 {
     SerializerSingleton.Serializer.AddSerializer <ClientHeartBeatPacket>(new ClientHeartBeatSerializer());
     SerializerSingleton.Serializer.AddSerializer <ClientHandshakePacket>(new ClientHandshakeSerializer());
     SerializerSingleton.Serializer.AddSerializer <ClientInstanceReadyPacket>(new ClientInstanceReadySerializer());
     SerializerSingleton.Serializer.AddSerializer <ServerExitPacket>(new ServerExitSerializer());
     Settings = settings;
     Logger.DefaultLogger(Settings.ToString());
     PortManager       = new PortManager(Settings);
     InstanceManager   = new GameInstanceManager(Settings);
     ConnectionManager = new ConnectionManager(Settings);
     WaitingQueue      = new List <WaitingQueueItem>();
     RemoveList        = new List <WaitingQueueItem>();
 }
Пример #3
0
        public static MatchMakerSettings Load(string path)
        {
            Stream s = null;

            try
            {
                XmlSerializer xs = new XmlSerializer(typeof(MatchMakerSettings));
                s = File.OpenRead(path);
                MatchMakerSettings ret = (MatchMakerSettings)xs.Deserialize(s);
                s.Close();
                return(ret);
            }
            catch (Exception)
            {
                s?.Close();
                Logger.DefaultLogger("Could Not load the Settings File at location " + path);
            }

            MatchMakerSettings ss = new MatchMakerSettings();


            return(MakeDefault(ss));
        }