public ServerGame() : base(120) { screens = new Dictionary <string, GameScreen>(); ConfigSection serverSection = Program.Config.GetSection("Server"); int maxPlayers = 32; if (serverSection == null) { DashCMD.WriteError("[server.cfg - ServerGame] Section 'Server' is missing!"); } else { maxPlayers = serverSection.GetInteger("max-players") ?? 32; ConfigSection socketSection = serverSection.GetSection("Socket"); if (socketSection == null) { DashCMD.WriteError("[server.cfg - ServerGame] Section 'Socket' is missing!"); } else { string ip = socketSection.GetString("host-ip") ?? "127.0.0.1"; int port = socketSection.GetInteger("host-port") ?? 12123; if (!NetHelper.TryParseIP(ip, out HostIP)) { DashCMD.WriteError("[server.cfg - ServerGame] Socket.host-ip is invalid!"); } } } if (!AOSServer.Initialize(maxPlayers, new IPEndPoint(HostIP, HostPort))) { DashCMD.WriteError("Failed to initialize server!"); DashCMD.StopListening(); return; } server = AOSServer.Instance; InitializeDebugging(); AddScreen(new MatchScreen(this)); SwitchScreen("Match"); }