responseCreateEnv.setEnvironment(env);
client.getServer().addResponseToOtherPeopleInTheSameWorld(client.getId(), world.getID(), responseCreateEnv);
Zone startZone = env.getZones().get(0);
SimulationEngine se = startZone.getSimulationEngine();
String networkName = "WoB-" + env.getID() + "." + startZone.getOrder() + "-" + System.currentTimeMillis() % 100000;
int nodeList[] = {13, 20, 31};
startZone.setManipulationID(se.createAndRunSeregenttiSubFoodweb(nodeList, networkName, 0, 0, false));
ZoneDAO.updateManipulationID(startZone.getID(), startZone.getManipulationID());
List<NodeBiomass> lNodeBiomass = new ArrayList<NodeBiomass>();
lNodeBiomass.add(new NodeBiomass(GameServer.getInstance().getSpeciesTypeByNodeID(13).getAvgBiomass() * 10 / Constants.BIOMASS_SCALE, 13));
lNodeBiomass.add(new NodeBiomass(GameServer.getInstance().getSpeciesTypeByNodeID(20).getAvgBiomass() * 10 / Constants.BIOMASS_SCALE, 20));
lNodeBiomass.add(new NodeBiomass(GameServer.getInstance().getSpeciesTypeByNodeID(31).getAvgBiomass() * 10 / Constants.BIOMASS_SCALE, 31));
if (!lNodeBiomass.isEmpty()) {
System.out.println("Updating Initial Biomass...");
se.updateBiomass(startZone.getManipulationID(), lNodeBiomass, 0);
}
se.getBiomass(startZone.getManipulationID(), 0, 0);
world.setEnvironment(env);
world.setPlayer(client.getPlayer());
responseGetEnv.setWorld(world);
client.setWorld(world);
WorldDAO.updateLastPlayed(world.getID());
WorldDAO.updateWorldProperties(world);
int initialAmount = 3;
for (SpeciesZoneType szt : se.getSpecies().values()) {
int species_id = GameServer.getInstance().getSpeciesTypeByNodeID(szt.getNodeIndex()).getID();
se.setParameter(0, szt, startZone.getManipulationID(), Constants.PARAMETER_X, szt.getParamX());
world.getGameEngine().createOrganisms(species_id, startZone.getID(), initialAmount, Constants.CREATE_STATUS_DEFAULT);
world.getGameEngine().createOrganismsByBirth(species_id, startZone.getID(), szt.getSpeciesCount() - initialAmount);
}
try {
String csv = null;
while (true) {
csv = se.getBiomassCSVString(startZone.getManipulationID());
if (!csv.isEmpty()) {
break;
} else {
System.out.println("Error: CSV [" + startZone.getManipulationID() + "] Retrieval Failed!");