public static void loadGameState(String filename) {
		try {
			JsonValue root = new JsonReader().parse(new FileHandle("saves/"+filename+".txt"));
			Json reader = new Json();
			
			// build the associative arrays through iteration
			Scene.clearEntityMapping();
			for (JsonValue child = root.get("sceneToEntityIds").child(); child != null; child = child.next()) {
				for (JsonValue child2 = child.child(); child2 != null; child2 = child2.next())
					Scene.addEntityMapping(child.name(), child2.getInt("value"));
			}
			
			Entity.clearMapping();
			for (JsonValue child = root.get("idToEntity").child(); child != null; child = child.next()) {
				Entity e = reader.fromJson(Entity.class, child.toString());
				Entity.addMapping(Integer.parseInt(child.name()), e);
			}
			
			Map<String, Warp> tmpWarps = new HashMap<String, Warp>();
			for (JsonValue child = root.get("warpData").child(); child != null; child = child.next()) {
				Warp w = reader.fromJson(Warp.class, child.toString());
				tmpWarps.put(w.locID + w.warpID, w);
			}
			
			//initialize each warp's link
			for (Warp w : tmpWarps.values()) {
				w.setLink(tmpWarps.get(w.next + w.getLinkID()));
			}
			gMain.setWarps(tmpWarps.values());
			
			if (gMain != null) {
				gMain.player = reader.fromJson(Player.class, root.get("playerData").toString());
				gMain.player.setMainRef(gMain);
				gMain.history = reader.fromJson(History.class, root.get("history").toString());	
			} else {
				System.out.println("JsonSerializer has no reference to instance of Main");
			}
			initReferences();
			
			String level = root.getString("levelID");
			Scene scene = new Scene(gMain.getWorld(), gMain, level);
			gMain.setScene(scene);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}