1
0
mirror of https://github.com/fazo96/AIrium.git synced 2025-01-10 09:34:20 +01:00

Improved UI a lot, again!

This commit is contained in:
Enrico Fasoli 2015-07-07 14:04:33 +02:00
parent 86f75ada18
commit fcd1e540e6
6 changed files with 741 additions and 214 deletions

View File

@ -132,5 +132,6 @@ public class Game extends ApplicationAdapter {
public void setPaused(boolean paused) {
this.paused = paused;
if(world != null) world.fire(Listener.PAUSED_OR_RESUMED);
}
}

View File

@ -11,7 +11,7 @@ package com.mygdx.game;
*/
public interface Listener {
public static int FPS_CHANGED = 0, CREATURE_LIST_CHANGED = 1;
public static int FPS_CHANGED = 0, CREATURE_LIST_CHANGED = 1, PAUSED_OR_RESUMED = 2;
public void on(int event);
}

View File

@ -15,7 +15,8 @@ import logic.neural.Brain;
public class Creature extends Element implements Runnable {
public static int default_radius = 20, max_hp = 100;
public static float max_speed = 3, max_beak = default_radius / 4, fov, sightRange;
public static float max_speed = 3, max_beak = default_radius / 4, fov, sightRange, corpseDecayRate = 0, hpDecay = 0.5f;
public static boolean leaveCorpses = false;
private Brain brain;
private float dir, hp, prevHp, speed, fitness, rotSpeed, beak;
@ -53,14 +54,16 @@ public class Creature extends Element implements Runnable {
@Override
public void update() {
// apply hunger
hp -= 0.5f;
hp -= hpDecay;
prevHp = hp;
if (hp < 0) { // Dead
Game.get().getWorld().getGraveyard().add(this);
Vegetable carcass = new Vegetable(getX(), getY());
carcass.setSize(getSize());
//carcass.setDecayRate(0.01f);
Game.get().getWorld().add(carcass);
if (leaveCorpses) {
Vegetable carcass = new Vegetable(getX(), getY());
carcass.setSize(getSize());
carcass.setDecayRate(corpseDecayRate);
Game.get().getWorld().add(carcass);
}
return;
}
if (speed > max_speed) {
@ -182,7 +185,7 @@ public class Creature extends Element implements Runnable {
}
s.circle(getX() + eyeX, getY() + eyeY, 3);
//FOV
float degrees = fov * 180f / (float) Math.PI;
float degrees = fov * 360f / (float) Math.PI;
float orient = dir * 180f / (float) Math.PI - degrees / 2;
s.setColor(0.3f, 0.3f, 0.3f, 1);
s.arc((float) eyeX + getX(), (float) eyeY + getY(), sightRange, orient, degrees);
@ -269,7 +272,7 @@ public class Creature extends Element implements Runnable {
angle = relAngle - ndir;
dist = tempDist;
// Check if attackable
if (beak > beak/2 && tempDist < beak * 1.5f && tempAngle < fov/2) {
if (beak > beak / 2 && tempDist < beak * 1.5f && tempAngle < fov / 2) {
// Attacking!
hp++;
fitness++;
@ -325,6 +328,8 @@ public class Creature extends Element implements Runnable {
if (workerThread == null) {
workerThread = new Thread(this);
workerThread.start();
} else {
workerThread.interrupt();
}
}

View File

@ -25,9 +25,10 @@ public class World implements Runnable {
private int width, height, nPlants, creatPerGen;
private int generation = 1;
private boolean multithreading, cmdLaunchNewGen = false;
private boolean multithreading, cmdLaunchNewGen = false, cmdRestart = false;
private int fpsLimit, fps = 0;
private Map<String, Float> options;
private long ticksSinceGenStart = 0, maximumTicksPerGen = 0;
private Creature selected;
private final ArrayList<Element> elements;
private final ArrayList<Element> toAdd;
@ -94,6 +95,22 @@ public class World implements Runnable {
}
public void update() {
if (cmdRestart) {
elements.clear();
graveyard.clear();
creatures.clear();
plants.clear();
toAdd.clear();
deadPlants.clear();
newGen(true);
cmdRestart = false;
}
ticksSinceGenStart++;
if (maximumTicksPerGen > 0 && ticksSinceGenStart >= maximumTicksPerGen) {
// Force new gen
Log.log(Log.INFO, "Reached maximum generation time ("+maximumTicksPerGen+")");
newGen(false);
}
for (Element e : toAdd) {
elements.add(e);
if (e instanceof Creature) {
@ -125,8 +142,27 @@ public class World implements Runnable {
while (plants.size() < nPlants) {
spawnVegetable();
}
for (Element e : elements) {
e.update();
if (multithreading) { // Multi-thread: use workers
for (Vegetable v : plants) {
v.update();
}
for (Creature c : creatures) {
c.startWorker();
}
Thread.yield();
int finishedCount = 0;
while (finishedCount < creatures.size()) {
finishedCount = 0;
for (Creature c : creatures) {
if (c.isWorkerDone()) {
finishedCount++;
}
}
}
} else { // Single-thread
for (Element e : elements) {
e.update();
}
}
}
@ -158,8 +194,10 @@ public class World implements Runnable {
int topSize;
if (graveyard.size() == 1) {
topSize = 1;
} else if (options.containsKey("parents_count") && options.get("parents_count") >= 1) {
topSize = (int) Math.max(2, Math.round(options.get("parents_count")));
} else {
topSize = (int) Math.max(2,Math.round(graveyard.size() * 0.05f));
topSize = (int) Math.max(2, Math.round(graveyard.size() * 0.05f));
}
Creature[] top = new Creature[topSize];
// Calculate avg fitness and prepare best agent list
@ -173,7 +211,8 @@ public class World implements Runnable {
avgFitness += c.getFitness();
}
avgFitness = avgFitness / graveyard.size();
Log.log(Log.INFO, "Gen " + generation + " done. Avg fitness: " + avgFitness);
Log.log(Log.INFO, "Gen " + generation + " done. Ticks: "+ticksSinceGenStart+". Avg fitness: " + avgFitness);
ticksSinceGenStart = 0;
// Generate children
for (Creature c : graveyard) {
int first = (int) Math.floor(Math.random() * topSize);
@ -201,14 +240,18 @@ public class World implements Runnable {
width = Math.round(options.getOrDefault("world_width", 2000f));
height = Math.round(options.getOrDefault("world_height", 2000f));
fpsLimit = Math.round(options.getOrDefault("fps_limit", 60f));
maximumTicksPerGen = Math.round(options.getOrDefault("max_ticks", 0f));
creatPerGen = Math.round(options.getOrDefault("number_of_creatures", (float) Math.min(Math.round(width * height / 20000), 50)));
nPlants = Math.round(options.getOrDefault("number_of_plants", width * height / 5500f));
multithreading = options.getOrDefault("enable_multithreading", -1f) > 0;
Creature.corpseDecayRate = options.getOrDefault("corpse_decay_rate", 0f);
Creature.leaveCorpses = options.getOrDefault("enable_corpses", 0f) > 0;
Creature.default_radius = Math.round(options.getOrDefault("creature_radius", 20f));
Creature.max_hp = Math.round(options.getOrDefault("creature_max_hp", 100f));
Creature.max_speed = Math.round(options.getOrDefault("creature_max_speed", 3f));
Creature.fov = Math.round(options.getOrDefault("creature_fov", (float) Math.PI / 2.5f));
Creature.sightRange = Math.round(options.getOrDefault("creature_sight_range", 100f));
Creature.hpDecay = options.getOrDefault("creature_hp_decay", 0.5f);
}
private Element spawn(boolean isCreature, float[][][] brainMap) {
@ -263,7 +306,7 @@ public class World implements Runnable {
}
}
private void fire(int eventCode) {
public void fire(int eventCode) {
for (Listener f : listeners) {
f.on(eventCode);
}
@ -349,6 +392,10 @@ public class World implements Runnable {
this.multithreading = multithreading;
}
public void restart() {
cmdRestart = true;
}
public void launchNewGen() {
cmdLaunchNewGen = true;
}

View File

@ -8,6 +8,24 @@
<Properties>
<Property name="text" type="java.lang.String" value="File"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="exitButton">
<Properties>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
<KeyStroke key="Ctrl+Q"/>
</Property>
<Property name="text" type="java.lang.String" value="Exit"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exitButtonActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="jMenu3">
<Properties>
<Property name="text" type="java.lang.String" value="Simulation"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="startButton">
<Properties>
@ -20,15 +38,15 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="startButtonActionPerformed"/>
</Events>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="exitButton">
<MenuItem class="javax.swing.JMenuItem" name="pauseMenuButton">
<Properties>
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
<KeyStroke key="Ctrl+Q"/>
<KeyStroke key="Ctrl+P"/>
</Property>
<Property name="text" type="java.lang.String" value="Exit"/>
<Property name="text" type="java.lang.String" value="Pause"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exitButtonActionPerformed"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="pauseMenuButtonActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
@ -69,7 +87,10 @@
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" value="AIrium"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[517, 365]"/>
<Dimension value="[530, 450]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[530, 450]"/>
</Property>
</Properties>
<SyntheticProperties>
@ -147,13 +168,13 @@
<Component id="logLevelBox" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="jScrollPane1" alignment="0" pref="519" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="0" pref="525" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jScrollPane1" pref="275" max="32767" attributes="0"/>
<Component id="jScrollPane1" pref="340" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
@ -224,14 +245,11 @@
<Component class="javax.swing.JList" name="creatureList">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="5">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringItem index="4" value="Item 5"/>
<StringArray count="1">
<StringItem index="0" value="No creatures"/>
</StringArray>
</Property>
<Property name="selectionMode" type="int" value="0"/>
</Properties>
<Events>
<EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="creatureListValueChanged"/>
@ -254,25 +272,19 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel2" pref="499" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="nCreaturesSlider" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="fpsLimitSlider" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="currentFpsLimit" min="-2" max="-2" attributes="0"/>
<Component id="currentNCreatures" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="fpsLimitSlider" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="currentFpsLimit" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="nCreaturesSlider" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="currentNCreatures" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
@ -281,25 +293,68 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="currentNPlants" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="jCheckBox1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jCheckBox2" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="worldSizeSlider" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="worldSizeSlider" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="currentWorldSize" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="pauseButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="corpseDecaySlider" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="currentCorpseDecay" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="topSizeSlider" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="currentTopSize" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="sightRangeSlider" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="currentSightRange" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel9" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="hpDecaySlider" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="pauseButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="toggleFPSLimitCheckbox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="multithreadingCheckbox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="enableCorpsesCheckbox" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="24" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="currentHpDecay" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel10" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="maxTicksSlider" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="currentMaxTicks" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
@ -309,51 +364,82 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="fpsLimitSlider" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" pref="26" max="-2" attributes="0"/>
<Component id="currentFpsLimit" min="-2" pref="26" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jCheckBox1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="currentNCreatures" max="32767" attributes="0"/>
<Component id="nCreaturesSlider" max="32767" attributes="0"/>
<Component id="jLabel4" max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel3" alignment="0" min="-2" pref="26" max="-2" attributes="0"/>
<Component id="fpsLimitSlider" min="-2" max="-2" attributes="0"/>
<Component id="currentFpsLimit" min="-2" pref="26" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="toggleFPSLimitCheckbox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="multithreadingCheckbox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="enableCorpsesCheckbox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" pref="26" max="-2" attributes="0"/>
</Group>
<Component id="currentNCreatures" alignment="1" min="-2" pref="26" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="nCreaturesSlider" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="currentNPlants" min="-2" pref="26" max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" pref="26" max="-2" attributes="0"/>
<Component id="nPlantsSlider" min="-2" max="-2" attributes="0"/>
<Component id="currentNPlants" min="-2" pref="26" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel7" min="-2" pref="26" max="-2" attributes="0"/>
<Component id="worldSizeSlider" min="-2" max="-2" attributes="0"/>
<Component id="currentWorldSize" min="-2" pref="26" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="worldSizeSlider" max="32767" attributes="0"/>
<Component id="currentWorldSize" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel7" alignment="0" max="32767" attributes="0"/>
<Component id="corpseDecaySlider" max="32767" attributes="0"/>
<Component id="currentCorpseDecay" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel2" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel6" min="-2" pref="26" max="-2" attributes="0"/>
<Component id="topSizeSlider" min="-2" max="-2" attributes="0"/>
<Component id="currentTopSize" min="-2" pref="26" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jLabel8" max="32767" attributes="0"/>
<Component id="sightRangeSlider" max="32767" attributes="0"/>
<Component id="currentSightRange" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="hpDecaySlider" max="32767" attributes="0"/>
<Component id="jLabel9" max="32767" attributes="0"/>
<Component id="currentHpDecay" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel10" min="-2" pref="26" max="-2" attributes="0"/>
<Component id="maxTicksSlider" min="-2" max="-2" attributes="0"/>
<Component id="currentMaxTicks" min="-2" pref="26" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="44" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="pauseButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="108" max="32767" attributes="0"/>
<Component id="pauseButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Warning: changing settings while the simulation is running could crash the program"/>
</Properties>
</Component>
<Component class="javax.swing.JSlider" name="fpsLimitSlider">
<Properties>
<Property name="minimum" type="int" value="1"/>
@ -370,22 +456,28 @@
<Property name="text" type="java.lang.String" value="FPS Limiter"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox1">
<Component class="javax.swing.JCheckBox" name="toggleFPSLimitCheckbox">
<Properties>
<Property name="text" type="java.lang.String" value="Unlimit FPS"/>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="jCheckBox1StateChanged"/>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="toggleFPSLimitCheckboxStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="currentFpsLimit">
</Component>
<Component class="javax.swing.JCheckBox" name="jCheckBox2">
<Properties>
<Property name="text" type="java.lang.String" value="Multithreading (Experimental)"/>
<Property name="enabled" type="boolean" value="false"/>
<Property name="text" type="java.lang.String" value="60"/>
</Properties>
</Component>
<Component class="javax.swing.JCheckBox" name="multithreadingCheckbox">
<Properties>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" value="Multithreading (Experimental)"/>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="multithreadingCheckboxStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="Number of Creatures"/>
@ -454,6 +546,116 @@
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="pauseButtonStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="enableCorpsesCheckbox">
<Properties>
<Property name="text" type="java.lang.String" value="Creatures leave a corpse when they die"/>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="enableCorpsesCheckboxStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Corpse decay rate"/>
</Properties>
</Component>
<Component class="javax.swing.JSlider" name="corpseDecaySlider">
<Properties>
<Property name="value" type="int" value="0"/>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="corpseDecaySliderStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="currentCorpseDecay">
<Properties>
<Property name="text" type="java.lang.String" value="0"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" value="Number of Parents (Top Size)"/>
</Properties>
</Component>
<Component class="javax.swing.JSlider" name="topSizeSlider">
<Properties>
<Property name="maximum" type="int" value="25"/>
<Property name="value" type="int" value="0"/>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="topSizeSliderStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="currentTopSize">
<Properties>
<Property name="text" type="java.lang.String" value="0"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="text" type="java.lang.String" value="Creature sight range"/>
</Properties>
</Component>
<Component class="javax.swing.JSlider" name="sightRangeSlider">
<Properties>
<Property name="maximum" type="int" value="1000"/>
<Property name="minimum" type="int" value="20"/>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="sightRangeSliderStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel9">
<Properties>
<Property name="text" type="java.lang.String" value="Creature HP Decay"/>
</Properties>
</Component>
<Component class="javax.swing.JSlider" name="hpDecaySlider">
<Properties>
<Property name="maximum" type="int" value="1000"/>
<Property name="value" type="int" value="500"/>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="hpDecaySliderStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel10">
<Properties>
<Property name="text" type="java.lang.String" value="Max Generation Lifespan"/>
</Properties>
</Component>
<Component class="javax.swing.JSlider" name="maxTicksSlider">
<Properties>
<Property name="maximum" type="int" value="100000"/>
<Property name="value" type="int" value="0"/>
</Properties>
<Events>
<EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="maxTicksSliderStateChanged"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="currentSightRange">
<Properties>
<Property name="text" type="java.lang.String" value="100"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="currentHpDecay">
<Properties>
<Property name="text" type="java.lang.String" value="0.5"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="currentMaxTicks">
<Properties>
<Property name="text" type="java.lang.String" value="0 (Unlimited)"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="Reset Defaults"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>

View File

@ -42,6 +42,7 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
setLocationRelativeTo(null); // Center the window
Log.addListener(this);
options = new HashMap<String, Float>();
updateSettings();
guiUpdater = new Thread() {
@Override
public void run() {
@ -82,12 +83,11 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
jScrollPane2 = new javax.swing.JScrollPane();
creatureList = new javax.swing.JList();
jPanel1 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
fpsLimitSlider = new javax.swing.JSlider();
jLabel3 = new javax.swing.JLabel();
jCheckBox1 = new javax.swing.JCheckBox();
toggleFPSLimitCheckbox = new javax.swing.JCheckBox();
currentFpsLimit = new javax.swing.JLabel();
jCheckBox2 = new javax.swing.JCheckBox();
multithreadingCheckbox = new javax.swing.JCheckBox();
jLabel4 = new javax.swing.JLabel();
nCreaturesSlider = new javax.swing.JSlider();
currentNCreatures = new javax.swing.JLabel();
@ -98,18 +98,38 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
worldSizeSlider = new javax.swing.JSlider();
currentWorldSize = new javax.swing.JLabel();
pauseButton = new javax.swing.JToggleButton();
enableCorpsesCheckbox = new javax.swing.JCheckBox();
jLabel2 = new javax.swing.JLabel();
corpseDecaySlider = new javax.swing.JSlider();
currentCorpseDecay = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
topSizeSlider = new javax.swing.JSlider();
currentTopSize = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
sightRangeSlider = new javax.swing.JSlider();
jLabel9 = new javax.swing.JLabel();
hpDecaySlider = new javax.swing.JSlider();
jLabel10 = new javax.swing.JLabel();
maxTicksSlider = new javax.swing.JSlider();
currentSightRange = new javax.swing.JLabel();
currentHpDecay = new javax.swing.JLabel();
currentMaxTicks = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
status = new javax.swing.JLabel();
menuBar = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
startButton = new javax.swing.JMenuItem();
exitButton = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
startButton = new javax.swing.JMenuItem();
pauseMenuButton = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenuItem2 = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("AIrium");
setMinimumSize(new java.awt.Dimension(517, 365));
setMinimumSize(new java.awt.Dimension(530, 450));
setPreferredSize(new java.awt.Dimension(530, 450));
logTextArea.setEditable(false);
logTextArea.setColumns(20);
@ -139,12 +159,12 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(logLevelBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 519, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 525, Short.MAX_VALUE)
);
logPaneLayout.setVerticalGroup(
logPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(logPaneLayout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE)
.addGap(10, 10, 10)
.addGroup(logPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
@ -155,10 +175,11 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
tabs.addTab("Log", logPane);
creatureList.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
String[] strings = { "No creatures" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
});
creatureList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
creatureList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
creatureListValueChanged(evt);
@ -168,9 +189,6 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
tabs.addTab("Creatures", jScrollPane2);
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel2.setText("Warning: changing settings while the simulation is running could crash the program");
fpsLimitSlider.setMinimum(1);
fpsLimitSlider.setSnapToTicks(true);
fpsLimitSlider.setToolTipText("The maximum amount of ticks per second the simulation is allowed to compute");
@ -183,15 +201,22 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
jLabel3.setText("FPS Limiter");
jCheckBox1.setText("Unlimit FPS");
jCheckBox1.addChangeListener(new javax.swing.event.ChangeListener() {
toggleFPSLimitCheckbox.setText("Unlimit FPS");
toggleFPSLimitCheckbox.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
jCheckBox1StateChanged(evt);
toggleFPSLimitCheckboxStateChanged(evt);
}
});
jCheckBox2.setText("Multithreading (Experimental)");
jCheckBox2.setEnabled(false);
currentFpsLimit.setText("60");
multithreadingCheckbox.setSelected(true);
multithreadingCheckbox.setText("Multithreading (Experimental)");
multithreadingCheckbox.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
multithreadingCheckboxStateChanged(evt);
}
});
jLabel4.setText("Number of Creatures");
@ -239,6 +264,79 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
}
});
enableCorpsesCheckbox.setText("Creatures leave a corpse when they die");
enableCorpsesCheckbox.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
enableCorpsesCheckboxStateChanged(evt);
}
});
jLabel2.setText("Corpse decay rate");
corpseDecaySlider.setValue(0);
corpseDecaySlider.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
corpseDecaySliderStateChanged(evt);
}
});
currentCorpseDecay.setText("0");
jLabel6.setText("Number of Parents (Top Size)");
topSizeSlider.setMaximum(25);
topSizeSlider.setValue(0);
topSizeSlider.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
topSizeSliderStateChanged(evt);
}
});
currentTopSize.setText("0");
jLabel8.setText("Creature sight range");
sightRangeSlider.setMaximum(1000);
sightRangeSlider.setMinimum(20);
sightRangeSlider.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
sightRangeSliderStateChanged(evt);
}
});
jLabel9.setText("Creature HP Decay");
hpDecaySlider.setMaximum(1000);
hpDecaySlider.setValue(500);
hpDecaySlider.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
hpDecaySliderStateChanged(evt);
}
});
jLabel10.setText("Max Generation Lifespan");
maxTicksSlider.setMaximum(100000);
maxTicksSlider.setValue(0);
maxTicksSlider.addChangeListener(new javax.swing.event.ChangeListener() {
public void stateChanged(javax.swing.event.ChangeEvent evt) {
maxTicksSliderStateChanged(evt);
}
});
currentSightRange.setText("100");
currentHpDecay.setText("0.5");
currentMaxTicks.setText("0 (Unlimited)");
jButton1.setText("Reset Defaults");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
@ -246,21 +344,18 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 499, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(nCreaturesSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(fpsLimitSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(currentFpsLimit)
.addComponent(currentNCreatures)))
.addComponent(fpsLimitSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(currentFpsLimit))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(nCreaturesSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(currentNCreatures))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -268,53 +363,117 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(currentNPlants))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jCheckBox1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jCheckBox2))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(worldSizeSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(worldSizeSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(currentWorldSize))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(pauseButton)
.addGap(0, 0, Short.MAX_VALUE)))
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(corpseDecaySlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(currentCorpseDecay))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(topSizeSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(currentTopSize))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(sightRangeSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(currentSightRange))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(hpDecaySlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(pauseButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton1))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(toggleFPSLimitCheckbox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(multithreadingCheckbox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(enableCorpsesCheckbox)))
.addGap(0, 24, Short.MAX_VALUE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(currentHpDecay))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(maxTicksSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(currentMaxTicks)))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(fpsLimitSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(currentFpsLimit, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jCheckBox1)
.addComponent(jCheckBox2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(currentNCreatures, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(nCreaturesSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(fpsLimitSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(currentFpsLimit, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(toggleFPSLimitCheckbox)
.addComponent(multithreadingCheckbox)
.addComponent(enableCorpsesCheckbox))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(currentNCreatures, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(nCreaturesSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(currentNPlants, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(nPlantsSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(currentNPlants, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(nPlantsSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(worldSizeSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(currentWorldSize, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(worldSizeSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(currentWorldSize, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 108, Short.MAX_VALUE)
.addComponent(pauseButton)
.addComponent(corpseDecaySlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(currentCorpseDecay, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(topSizeSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(currentTopSize, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(sightRangeSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(currentSightRange, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(hpDecaySlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(currentHpDecay, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(maxTicksSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(currentMaxTicks, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(pauseButton)
.addComponent(jButton1))
.addContainerGap())
);
@ -341,15 +500,6 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
jMenu1.setText("File");
startButton.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_MASK));
startButton.setText("Start");
startButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
startButtonActionPerformed(evt);
}
});
jMenu1.add(startButton);
exitButton.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK));
exitButton.setText("Exit");
exitButton.addActionListener(new java.awt.event.ActionListener() {
@ -361,6 +511,28 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
menuBar.add(jMenu1);
jMenu3.setText("Simulation");
startButton.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_R, java.awt.event.InputEvent.CTRL_MASK));
startButton.setText("Start");
startButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
startButtonActionPerformed(evt);
}
});
jMenu3.add(startButton);
pauseMenuButton.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK));
pauseMenuButton.setText("Pause");
pauseMenuButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
pauseMenuButtonActionPerformed(evt);
}
});
jMenu3.add(pauseMenuButton);
menuBar.add(jMenu3);
jMenu2.setText("About");
jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));
@ -400,20 +572,22 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
}// </editor-fold>//GEN-END:initComponents
private void exitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitButtonActionPerformed
System.exit(0);
if (JOptionPane.showConfirmDialog(this, "Are you sure? The program will exit!") == JOptionPane.YES_OPTION) {
System.exit(0);
}
}//GEN-LAST:event_exitButtonActionPerformed
private void startButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startButtonActionPerformed
if (game != null) {
if (JOptionPane.showConfirmDialog(this, "Are you sure? The program will exit!") != JOptionPane.YES_OPTION) {
// Restart
if (JOptionPane.showConfirmDialog(this, "Are you sure? The simulation will be restarted!") != JOptionPane.YES_OPTION) {
return;
}
game.dispose();
app.stop();
pauseButton.setEnabled(false);
startButton.setText("Start");
status.setText("Simulation Stopped.");
game.getWorld().restart();
game.setPaused(false);
updateGUI();
} else {
// Start new
LwjglApplicationConfiguration.disableAudio = true;
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.height = 600;
@ -421,7 +595,7 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
config.resizable = false;
config.title = "AIrium Renderer";
app = new LwjglApplication(game = new Game(options), config);
startButton.setText("Stop");
startButton.setText("Restart");
pauseButton.setEnabled(true);
game.getWorld().addListener(this);
setCreatureList();
@ -440,35 +614,73 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
}
public void updateGUI() {
if (game == null) {
return;
}
status.setText("Generation: " + game.getWorld().getGeneration() + " FPS: " + game.getWorld().getFps());
if (game.isPaused()) {
pauseButton.setSelected(true);
pauseMenuButton.setText("Resume");
pauseButton.setText("Resume");
} else {
pauseButton.setSelected(false);
pauseMenuButton.setText("Pause");
pauseButton.setText("Pause");
}
setCreatureList();
}
private void setCreatureList() {
String list[] = new String[game.getWorld().getCreatures().size()];
for (int i = 0; i < list.length; i++) {
if (i >= game.getWorld().getCreatures().size()) {
return;
}
list[i] = "Fitness: " + game.getWorld().getCreatures().get(i).getFitness();
}
creatureList.setListData(list);
}
private void resetDefaultSettings() {
fpsLimitSlider.setValue(60);
nCreaturesSlider.setValue(25);
nPlantsSlider.setValue(700);
worldSizeSlider.setValue(2000);
corpseDecaySlider.setValue(0);
topSizeSlider.setValue(0);
sightRangeSlider.setValue(50);
hpDecaySlider.setValue(500);
maxTicksSlider.setValue(0);
updateSettings();
}
private void updateSettings() {
if (fpsLimitSlider.getValueIsAdjusting()) {
return;
}
currentFpsLimit.setText("" + fpsLimitSlider.getValue());
if (jCheckBox1.isSelected()) {
if (toggleFPSLimitCheckbox.isSelected()) {
options.put("fps_limit", 0f);
} else {
options.put("fps_limit", (float) fpsLimitSlider.getValue());
}
options.put("enable_multithreading", multithreadingCheckbox.isSelected() ? 1f : 0f);
options.put("number_of_creatures", (float) nCreaturesSlider.getValue());
options.put("number_of_plants", (float) nPlantsSlider.getValue());
options.put("corpse_decay_rate", corpseDecaySlider.getValue() / 1000f);
options.put("enable_corpses", enableCorpsesCheckbox.isSelected() ? 1f : 0f);
currentNCreatures.setText(nCreaturesSlider.getValue() + "");
currentNPlants.setText(nPlantsSlider.getValue() + "");
currentCorpseDecay.setText(corpseDecaySlider.getValue() / 1000f + "");
options.put("world_width", (float) worldSizeSlider.getValue());
options.put("world_height", (float) worldSizeSlider.getValue());
currentWorldSize.setText(worldSizeSlider.getValue() + "");
topSizeSlider.setMaximum(nCreaturesSlider.getValue());
currentTopSize.setText(topSizeSlider.getValue() + (topSizeSlider.getValue() <= 0 ? " (Auto)" : ""));
options.put("parents_count", (float) topSizeSlider.getValue());
options.put("creature_sight_range", (float) sightRangeSlider.getValue());
options.put("creature_hp_decay", (float) hpDecaySlider.getValue() / 1000);
options.put("max_ticks", (float) maxTicksSlider.getValue());
currentMaxTicks.setText(maxTicksSlider.getValue() + "");
currentHpDecay.setText(hpDecaySlider.getValue() / 1000f + "");
currentSightRange.setText(sightRangeSlider.getValue() + "");
if (game != null) {
game.getWorld().reloadOptions();
}
@ -483,40 +695,19 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
}//GEN-LAST:event_logLevelBoxItemStateChanged
private void creatureListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_creatureListValueChanged
try {
if (creatureList.getSelectedIndex() >= 0) {
Game.get().getWorld().selectCreature(Game.get().getWorld().getCreatures().get(creatureList.getSelectedIndex()));
if (game == null) {
creatureList.setSelectedIndex(-1);
} else {
try {
if (creatureList.getSelectedIndex() >= 0) {
Game.get().getWorld().selectCreature(Game.get().getWorld().getCreatures().get(creatureList.getSelectedIndex()));
}
} catch (IndexOutOfBoundsException ex) {
JOptionPane.showMessageDialog(this, "This creature is not available");
}
} catch (IndexOutOfBoundsException ex) {
JOptionPane.showMessageDialog(this, "This creature is not available");
}
}//GEN-LAST:event_creatureListValueChanged
private void fpsLimitSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_fpsLimitSliderStateChanged
updateSettings();
}//GEN-LAST:event_fpsLimitSliderStateChanged
private void jCheckBox1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jCheckBox1StateChanged
updateSettings();
}//GEN-LAST:event_jCheckBox1StateChanged
private void nCreaturesSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_nCreaturesSliderStateChanged
updateSettings();
}//GEN-LAST:event_nCreaturesSliderStateChanged
private void nPlantsSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_nPlantsSliderStateChanged
updateSettings();
}//GEN-LAST:event_nPlantsSliderStateChanged
private void worldSizeSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_worldSizeSliderStateChanged
updateSettings();
}//GEN-LAST:event_worldSizeSliderStateChanged
private void pauseButtonStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_pauseButtonStateChanged
game.setPaused(pauseButton.isSelected());
pauseButton.setText(pauseButton.isSelected() ? "Resume" : "Pause");
}//GEN-LAST:event_pauseButtonStateChanged
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
if (desktop != null) {
@ -536,25 +727,100 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
jMenuItem2ActionPerformed(evt);
}//GEN-LAST:event_jMenuItem1ActionPerformed
private void pauseMenuButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pauseMenuButtonActionPerformed
if (game == null) {
return;
}
game.setPaused(!game.isPaused());
}//GEN-LAST:event_pauseMenuButtonActionPerformed
private void topSizeSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_topSizeSliderStateChanged
updateSettings();
}//GEN-LAST:event_topSizeSliderStateChanged
private void corpseDecaySliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_corpseDecaySliderStateChanged
updateSettings();
}//GEN-LAST:event_corpseDecaySliderStateChanged
private void enableCorpsesCheckboxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_enableCorpsesCheckboxStateChanged
updateSettings();
}//GEN-LAST:event_enableCorpsesCheckboxStateChanged
private void pauseButtonStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_pauseButtonStateChanged
game.setPaused(pauseButton.isSelected());
}//GEN-LAST:event_pauseButtonStateChanged
private void worldSizeSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_worldSizeSliderStateChanged
updateSettings();
}//GEN-LAST:event_worldSizeSliderStateChanged
private void nPlantsSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_nPlantsSliderStateChanged
updateSettings();
}//GEN-LAST:event_nPlantsSliderStateChanged
private void nCreaturesSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_nCreaturesSliderStateChanged
updateSettings();
}//GEN-LAST:event_nCreaturesSliderStateChanged
private void multithreadingCheckboxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_multithreadingCheckboxStateChanged
updateSettings();
}//GEN-LAST:event_multithreadingCheckboxStateChanged
private void toggleFPSLimitCheckboxStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_toggleFPSLimitCheckboxStateChanged
updateSettings();
}//GEN-LAST:event_toggleFPSLimitCheckboxStateChanged
private void fpsLimitSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_fpsLimitSliderStateChanged
updateSettings();
}//GEN-LAST:event_fpsLimitSliderStateChanged
private void sightRangeSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_sightRangeSliderStateChanged
updateSettings();
}//GEN-LAST:event_sightRangeSliderStateChanged
private void hpDecaySliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_hpDecaySliderStateChanged
updateSettings();
}//GEN-LAST:event_hpDecaySliderStateChanged
private void maxTicksSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_maxTicksSliderStateChanged
updateSettings();
}//GEN-LAST:event_maxTicksSliderStateChanged
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
resetDefaultSettings();
}//GEN-LAST:event_jButton1ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel container;
private javax.swing.JSlider corpseDecaySlider;
private javax.swing.JList creatureList;
private javax.swing.JLabel currentCorpseDecay;
private javax.swing.JLabel currentFpsLimit;
private javax.swing.JLabel currentHpDecay;
private javax.swing.JLabel currentMaxTicks;
private javax.swing.JLabel currentNCreatures;
private javax.swing.JLabel currentNPlants;
private javax.swing.JLabel currentSightRange;
private javax.swing.JLabel currentTopSize;
private javax.swing.JLabel currentWorldSize;
private javax.swing.JCheckBox enableCorpsesCheckbox;
private javax.swing.JMenuItem exitButton;
private javax.swing.JSlider fpsLimitSlider;
private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JCheckBox jCheckBox2;
private javax.swing.JSlider hpDecaySlider;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JPanel jPanel1;
@ -563,13 +829,19 @@ public class GUI extends javax.swing.JFrame implements LogListener, Listener {
private javax.swing.JComboBox logLevelBox;
private javax.swing.JPanel logPane;
private javax.swing.JTextArea logTextArea;
private javax.swing.JSlider maxTicksSlider;
private javax.swing.JMenuBar menuBar;
private javax.swing.JCheckBox multithreadingCheckbox;
private javax.swing.JSlider nCreaturesSlider;
private javax.swing.JSlider nPlantsSlider;
private javax.swing.JToggleButton pauseButton;
private javax.swing.JMenuItem pauseMenuButton;
private javax.swing.JSlider sightRangeSlider;
private javax.swing.JMenuItem startButton;
private javax.swing.JLabel status;
private javax.swing.JTabbedPane tabs;
private javax.swing.JCheckBox toggleFPSLimitCheckbox;
private javax.swing.JSlider topSizeSlider;
private javax.swing.JSlider worldSizeSlider;
// End of variables declaration//GEN-END:variables