added a gameloop to the server and separated all of the network logic out