@Override
	public void run() 
	{
		GameData lData = service.getGameData();
		int lSpeedCount = 0;
		while (isRunning)
		{
			try 
			{
				Message lMessage = new Message();
					
				if (lData.getCurrentState() == GameState.GAME_RUNNING)
				{
					if (lSpeedCount < GameData.ENEMY_SPEED)
					{
						lSpeedCount++;
					}
					else
					{
						lData.moveEnemies();
						lSpeedCount = 0;
					}
				}

				// Copy and package the current game state to be sent to all clients and spectators
				lMessage.addBodyProperty("board", lData.getBoardAsString());
				lMessage.addBodyProperty("rows", Board.ROWS);
				lMessage.addBodyProperty("cols", Board.COLS);
				lMessage.addBodyProperty("players_permitted", GameData.PLAYERS_PERMITTED);
				lMessage.addBodyProperty("game_state", lData.getCurrentState().ordinal());
				ArrayList<PlayerStatus> list = lData.getPlayerStatuses();
				lMessage.addBodyProperty("player_infos", list);
				
				service.getStateBuffer().put(lMessage);
				
				if(lData.getCurrentState() == GameState.GAME_RUNNING) {
					if(lData.allPlayersDead())
						lData.reset();
					else if(lData.allEnemiesDead() && lData.isPlayerOnExit()) {
						if(lData.allEnemiesDead()) {
							lData.increaseLevel();
							lData.increaseEnemySpeed();
							lData.reset();
						}
					}
				}
				
				Thread.sleep(32);
			} 
			catch (InterruptedException e) 
			{
				service.getLogger().logMessage(TAG + ": " + e.getLocalizedMessage());
			}
		}
	}