Setup for Pioneer development

I did a little development while on holiday for a FOSS game I like, called Pioneer.

I wanted to carry on when I got back, so I set about creating a dev environment for it. Here are my notes on that.


First I got Eclipse.

Then I enabled C++ development using CDT.


Pioneer is heavily Lua-driven. Since I’d be doing a lot of editing in this scripting language, I went looking for a tool. The most mature one that I could find after a short search was Koneki Lua.

Getting the code

I cloned my fork of Pioneer into a directory named ‘pioneer’. This gave me a folder structure of ‘../pioneer/pioneer/…’. I could open the parent pioneer folder as an Eclipse workspace, leaving the files inside pioneer/pioneer unpolluted by Eclipse’s files.

Building the project

I ran




to set up the code project. Building was done from within Eclipse.

The project was imported into Eclipse as a makefile project (./configure generates a bunch of makefiles).

I used the following make command to spread build between my 4 cores, leaving one to handle everything else when a build is running:

make -j 3

This was set in Eclipse in Project>C/C++ Build>Builder Settings

Evolutionary Cline Simulator

I recently had time to code a biological cline simulator.

It runs locally on your machine, and is written in JavaScript. For this reason, don’t expect usable performance from phones and tablets!


Here’s the result of one run after a few thousand steps.

evolution run showing cline

Selection Pressure
The selection pressure image describes the selection pressure within the environment. In a red region, a red coloured organism will do well. In a green region, a green organism will do well. Of the 3 colours in the RGB colour system, blue is non-selective. This means a purple (blue + red) organism will do just as well as a red one, and a turquoise one (blue + green) will do just as well as a green one. Regions in black cannot be entered by the organisms.

All genes are expressed. No alleles are recessive.

The environment canvas is where the organisms are rendered. They are rendered by their phenotype. For this model, their phenotype is simply an RGB colour. The difference between the organism’s colour and the colour of the corresponding pixel on the selection pressure image gives a value of how well the organism is faring – the best possible value would be a perfect match, i.e. a difference of 0.

For simplicity, organisms are hermaphroditic. They move randomly a short distance each step. Whenever they encounter each other, either by landing in the same pixel, or in one of the 8 adjacent pixels, they mate.

The simulated organisms are diploid, and are capable of being heterozygous, receiving one chromosomefrom each parent. Each chromosome is implemented as an RGB colour. The chromosome has 3 genes (red, green, blue), each with 256 alleles (potential values of 0-255).

Organisms are generated in a random location within a perimeter, and all have identical genomes.

The organism’s phenotype is calculated by averaging both “chromosomes”, producing a colour halfway between each chromosome colour.

If the environment is unfavourable for an individual (for example, a green organism in a location in the environment that corresponds to a red pixel in the selection pressure image), it typically moves further each processing step than if it’s in a favourable environment. This gives organisms a very limited quantity of behavioural “intelligence”. They are more likely to spend more time in a favourable environment, than an unfavourable one.

Matings produce 0-1 offspring – 0 offspring if the two parents’ gametes are incompatible, otherwise 1.

Each parent organism generates a single gamete. A gamete is a single chromosome. Gametes are generated by randomly selecting 3 genes from the parent’s available 6, 1 each of red, green and blue. There is a chance that a small mutation may be applied to each gene at this point, altering 0-3 alleles by a small amount.

Genetic compatibility is measured by comparing the difference between all 3 genes of each of the parent’s gametes. If the gametes are sufficiently similar, 1 organism is produced by the mating. If not, 0 organisms are produced – the 2 potential parents are too genetically different; they have speciated.

Injury and death
Each organism cannot live for more than 1000 processing steps. Invariably, the environment, and/or competition with their peers kills them before old age can.

Organisms have a value of “health” when this reaches 0, the organism dies. Every processing step, the organism’s phenotype is compared with the selection pressure of its pixel, and the difference (modified by a “hostility” factor), subtracted from its health.

To prevent population growing exponentially, there is a small health hit each time an organism encounters another organism; in highly populated areas, this has the effect of shortening organism’s lifespans, and preventing a population explosion. This could be imagined as multiple animals competing for resources, and spreading diseases with each other.

An organism’s health can only ever stay stable and decline. There is no way an organism can increase it’s health value.