Battle for Survival v0.1.3

Last edited: september 16th 2005

This document is intended to give a first time user an idea of Battle for Survival, also it lists the changes since last version. Also for now this document will be the main part of the website for the project, soon: More detailed information for people that want to develop their own organisms for battle for survival can be found in the java docs.

Since I tried to release as quick as possible this file wont be complete (by far). Please watch the website for newer versions. Also I would love to hear from people that have looked at this project. (see contact details below) Since I don't have a clue if people are interested in toys like this, I will let the amount of work put into it depend on the responses.


What is Battle for Survival

I got the idea for the program from game of life, and my interests in darwins theories. The game (or toy) constists of a set of rules simulating a world, where organisms 'live' in. I've tried to make it possible for organisms to be plants and to be animals, although there is no strict diffrence.

This project has several possible applications. First is as a toy or game. It can be great to watch what happens when several of those organisms struggle around. Hopefully other people will send me their own organisms so I can add them for everyone to watch. Also it is simple to program organisms yourself. However to make a good one has proven to be a great challenge. Currently not supported is human control of an organism, but it can be added in the futures (perhaps even multiplayer).

Another use is more scientific, the project can provide a base for research in the field of artificial intelligence and perhaps even biology (behaviour research).

Organisms take turns in executing actions. All these actions cost/give time, material and/or energy. The most important thing is making mass which allows them to specialise for diffrent actions. Examples of the actions are:
grow mass: costs energy and material, gains mass
move: depends on the masses that increase speed, costs energy
fight: attack another organism
eat: eat food from the ground
root: get materials from the ground: only possible if root mass is available
create offspring(create embryo)
feed offspring (before birth)
give birth (drop embryo)

types of mass that can be grown are:
root: to get materials from the ground (penalty for movement)
foto: (fotosythesis) to get energy
speed: to allow movement
figth: to fight
digestion: to turn food(= dead organism) into materials and energy
armor: better defence when fighting and harder to eat

Since these lists are incomplete a good way to start understanding the world is to look at and (both in src/surival/world/)

I have made a few test organisms and the rules seem to work quiet well. And I've got about 50 parameters that can be set.

The program is set up to allow concurrent development. The world allows for an unlimited amount of windows to be attached to view
and control the world. Save and load functions are working. Current windows are:
A picture of the world (showing where organisms are)
a listing of all actions taken by organisms
a control window (save, load, speed control)
a listing of the organisms
a listing of species to compare which one is winning
an overview to look at all details of 1 organism.

The first run

Here is what can happen on my first big test run, starting with 1 tree, in this text I will explain what the screens mean, and what actually happens. Since there are a few random actions done by the Tree, not all runs will be the same.

At the start only 1 tree was around. The tree is an organism that grows roots to get material from the ground and fotosynthese mass(leaves) to get energy. It grows what it needs most according to some simple rules. At an age of 800 turns it will start to put all effort into reproduction and finally at age 1500 it will die, due to the current maximum age in the rules. A new child will use its first turns randomly moving a bit away from the parent and then start growing like the mother did.

Now there are several screens to look at. First there is a list of all individuals that have lived. Clicking on them will show their statistics and the turn history which is a bit hard to read basically it describes all attempted actions. In the world view the red blocks indicates that there is 1 or more individuals at a certain point in the world, blue means empty space. There is also some debug information on this screen. Last there is the species screen. Now it is only showing 1 species, because by default only 1 is inserted into the wordl. It shows the totals of the statics of the all living individuals having the same ancestor. If the program is slow you can turn of some of the screens to increase speed, however the more organisms are around, the longer it will take to complete a full cycle of turns for all organisms. The counter on the main control screen indicates the amount of turns taken in this simulation.

Now on to what happened in the simulation. First the tree kept growing and growing, very fast. Since the ground is full of material it wasn't having any problem getting big. Then it reached the age of 800 and started to reproduce, very succesfully. Soon there is a red blob in the world view, indicating where individuals are, and the species overview shows hundreds of individuals, increasing at a high pace still. At turn 1500 the first individual dies of old age (it is also possible to die of lack of energy, but fotosynthese always gives energy, so trees don't die easily once they have grown a little bit). In the view of all individuals you can see some trees don't grow at all, those generally are at a location with little materials left in the ground(the last number in the line describing the individual).

The amount of living individuals kept growing, at turn 5000 the amount of individuals was 5500, all locations were filled with at least 1 individual. Now the size of the population was steady, very few new individuals got born. This indicates not many could get strong enough to reproduce. The amount of individuals starts to drop, and the average age they have goes up, it reaches more than 1200 at one moment. Again this indicates an old population with little children. The reason of course is that there is not enough material to maintain a population of theds size. In the time between turn 5000 and turn 9000 the amount of individuals dropped as low as 170, only every now and then a child was born. Interesting to see is that the location where the first individual started, thus the first blob was, is also the first one to be empty. At this time the amonut of individuals increased again, this time only until 3200 individuals. Fun to see here was that it was again from 1 point, so probably only 1 or 2 individuals have been the cause for this new big growt. After this it dropped again. At turn 13000 the population was only 200 and for the following time, until 27000 the amount fluctuates between 100 and 400 indivuduals. Again at some points as blobs of individuals. Finally around turn 27000 the last individual dies and the simulation is over with a total of 16651 individuals that have lived during the simulation.

Requirements/How to run the program

The project is written in java 5 (this is the same as 1.5!!) only using default libraries, so to run this project all you need is to have java installed on your computer. And which operating system you have shouldn't matter. To check the version of java you currently have give the following command on the windows command prompt or linux terminal:
> java -version
To run the program do the following when in the bin directory:
> java -cp . survival.Survival
To run the program with extra memory use the '-Xmx250M' parameter (replacing 250M with the amount of memory you want):
> java -cp . -Xmx250M survival.Survival
If you want to incluide diffrent types of organisms you need to edit the in src/surival, more details are incluided there. The default organism running is a tree like organism. After changing the code you can recompile with the following command from the src directory (requires the java development kit (jdk 1.5) from, or any other compiler) :
> javac -d ../bin/ survival/

Make sure the bin directory of your java installation is in your path environment variable (or wathever your OS calls it), please see the java installation manual for more information.
You can download the java runtime environment from

Possible project improvements

Better windows (for instance for dynamic loading of organisms)
Allowing ini files with rule parameters.
More tweaking of the rules.
Making more example organisms.
User controled organisms
Network play for user controled organisms


I totally understand if you feel very lost when looking at the project at this stage. One of the reasons is the lack of documentation, and a good starting walkthrough. Letting me know that you take interest in this project is important cause based on that I will decide if it is usefull to write more extended documentation. Here I will describe some problems with hte program:

The program is very slow

The program running slow depends on 2 aspects: the java screen updates are very resource intensive , when you close the screens (all but the one called survival can be closed and recalled) then the running speed will increase a lot. Also currently the program uses a lot of memory when many creatures are around, there is a lot of room for improvement there.

I don't have a clue what to do with this

I prefer calling this program a toy, and not really a game. There is no winning, just looking at what happens when certain organisms cooperate. And a way for programmers to do some 'Intelligent Design'. Any novice programmer (also non java) that understands the principles of variables, methods and condition statements (if ... then .. else .. etc) should be able to make organisms.

When looking at the logs of a running program you see a lot of numbers, each line generally describes 1 action. It can be failed, or succesfull. Looking up the first word in the Turn class of the documentation can give a better idea of what happens. The logs generally state how much the action cost and gained (sometimes the / and a second number indicates how much was available). All the numbers have a label with them indicating what the number means, normally this is an abbreviation of the full word to save space, like 'ene' for 'energy'.
For people looking for the first changes to an organism, I have made SimpleTree with some additions. Don't forget to update to add the tree to world.

Version History

version 0.1.3

Released: september 16th 2005

Added extra better world views.
Added Create new world button
Added Add Organism dialog.
Fixed bug with ConcurrentModificationException.
Fixed bug with screens not showing properly if opened when simulation is paused.
Fixed bug where some material vanished
Lots of minor fixes.

version 0.1.2

Released: september 11th 2005

Added a section to this document explaining a first run for new users
Added a help section to this document
Finally fixed the problem with memory, the program should now run very long using about 30mb memory. The down side of this that the current version can't show the long history per individual anymore. Hopefully in the future I can add the option to log to a database (or the file system in some other way)
Fixed structure error in the of the rules
Fixed small bugs

version 0.1.1

Released: september 2nd 2005

Added SimpleTree, as easy as organisms get
Formatting logs improved
Fixed some tiny bugs
Added detailed GPL information to each file
Added the 'HELP!!!' section to this file

version 0.1.0 - first release

Released: september 1st 2005

The aim of this version is to show people the current project. It has a fair amount of java docs for developes but it doesn't contain much documentation for users. Also the windows are made in a hurry, so I haven't put time in good looks or understanding. In this version the world is complete and usable. Unfortunately I have only 1 test organism, something like a tree. If you run the program by default it should contain 1 individual the after a while spawns some children.

The only big problem with it now is its memory usage. Java has a limit of 100mb memory (that can be changed) the 100mb is reached when 1000 organisms run for 2000 'turns'. There should be a lot of room to win in deleting old information (or writing it to a file/database).

Here follows a small list of what is missing/wrong in this version:
The world screen shows some debug information
The rules aren't totally tweaked
Most of the test organisms aren't documented. Only Tree is.
There is no real user documentation
There are several compilation warnings, those will be fixed later.
There should be move informative function in the Turn class to assist Organism creators
Not everything is properly tested for bugs


If you want to contact me best is to post on the forums of the project or to send me an email at 'thirler at'
The location of the project is: