@Override
	public void run() {
		//hack to make server multithreaded
		if(server==null) {
			try {
				server = new ServerSocket(6015);
			} catch (IOException e) {
				e.printStackTrace();
			}
			while(true) {
				try {
					//accept connection and create new player
					Socket newSocket = server.accept();
					newSocket.setTcpNoDelay(true); // stops TCP from combining packets, reduces latency
					int id = generatePlayerID();
					RemotePlayer newPlayer = new RemotePlayer(id, newSocket, game, game.getBoardWidth(), game.getBoardHeight());
					playersByID.put(id, newPlayer);
					//create and start a new thread, running the socket worker code
					new Thread(newPlayer).start();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		} else {
			//will be run the second time
			sendLoop();
		}
	}