/// <summary> /// This method begins preperations for the building of the game world by creating and filling the world and also creating the update timer /// for the server as well. /// </summary> static void Start() { // No players have added at this moment so set the member variable to false. noPlayersJoined = true; // Create the HashTable for the client sockets and thier respective player cube ids. ClientSockets = new Dictionary <Socket, int>(); socketsToRemove = new List <Socket>(); allWorldCubes = new StringBuilder(); DeadPlayersUIDs = new HashSet <int>(); // Create the game world. world = new World("C:\\Users\\weisched\\Source\\Repos\\JacksonRepo\\AgCubio\\Resources\\XMLWorldParameters.xml"); // Lock the world object, and create all the food that will be added to the world. lock (world) { // Populate the world with an initial amount of food world.CreateFood(world.INITIAL_FOOD_AMT, true); world.CreateVirus(world.MAX_VIRUSES, true); } // Create timer for calling Update() updateTimer = new Timer(1 / (world.UPDATES_PER_SECOND / (double)1000)); updateTimer.Elapsed += new ElapsedEventHandler(updateTimerEvent); updateTimer.Start(); // Call Sever_Awaiting_Client method and await the connection of the first client. Network.Server_Awaiting_Client(HandleNewClient, 11000); // Also have server listen for incoming web requests on Port 11100 Network.Server_Awaiting_Client(GetWebRequest, 11100); }