public void init(){
		gameDataMap = new TreeMap<Integer, GameData>();
		gameData = new GameData(gameSetting);
		agentNameMap = new HashMap<Agent, String>();

		List<Agent> agentList = gameServer.getConnectedAgentList();

		if(agentList.size() != gameSetting.getPlayerNum()){
			throw new IllegalPlayerNumException("Player num is "+gameSetting.getPlayerNum()+" but connected agent is "+agentList.size());
		}

		Collections.shuffle(agentList, rand);

		Map<Role, List<Agent>> requestRoleMap = new HashMap<Role, List<Agent>>();
		for(Role role:Role.values()){
			requestRoleMap.put(role, new ArrayList<Agent>());
		}
		List<Agent> noRequestAgentList = new ArrayList<Agent>();
		for(Agent agent:agentList){
			Role requestedRole = gameServer.requestRequestRole(agent);
			if(requestedRole != null){
				requestRoleMap.get(requestedRole).add(agent);
				System.out.println(agent+" request "+requestedRole);
			}
			else{
				noRequestAgentList.add(agent);
				System.out.println(agent+" request no role");
			}
		}
		
		
		for(Role role:Role.values()){
			List<Agent> requestedAgentList = requestRoleMap.get(role);
			for(int i = 0; i < gameSetting.getRoleNum(role); i++){
				if(requestedAgentList.isEmpty()){
					gameData.addAgent(noRequestAgentList.remove(0), Status.alive, role);
				}
				else{
					gameData.addAgent(requestedAgentList.remove(0), Status.alive, role);
				}
			}
		}

		gameDataMap.put(gameData.getDay(), gameData);

		gameServer.setGameData(gameData);
		for(Agent agent:agentList){
			gameServer.init(agent);
			agentNameMap.put(agent, gameServer.requestName(agent));
		}
	}