Skip navigation

A good friend of mine, Alex Haase, visited me this weekend and I told him about my idea for an evolution-based game/simulation to expose the mechanics of the evolutionary process and the complexity of homeostasis within a single organism as well as within an entire species. We collaborated to create a very detailed set of rules, environments, and implementations in order to achieve this end. I’m incredibly proud to present the method we came up with.


A given organism’s genetic code will be represented by an array of strings. This array will be arbitrary [8-80] in length, and the strings will also be arbitrary in length [1-256]. This will bring maximum storage for a single genetics table to (256 bytes * 80 / 1000 bytes/kb) 20.48kb. This is quite reasonable and represents a rather large amount of data. However, data in a real gene is not read from end to end. Different genes are spread out over the chromosome, including sections of inert and unused data. Upon generation of the genetics table, a gene map will also be created to determine where each gene sequence begins and ends. This will be represented by an array of arrays containing gene location objects which will hold table index, gene start, and gene end. In this way, the genetics table can be parsed for information dynamically without the possibility of easy user interpretation. Alex had suggested that patterns be evaluated for certain well-known advantageous traits (such as camouflage, cyst stasis, or territorial marking). I agree with a slight modification: the the pattern checking be based not on a specific, static pattern, but by recognition of stepped character differences (more about this later). These patterns will be stored in a dictionary (hash table) of trait expression objects.

So, the way all of these pieces come together is like so:

The genetic table generator will run, generating a table with random properties and values. Keep in mind, the strings will actually be evaluated on their ASCII values in relation to target values. More on this in a few. A simple genetic table might look something like this:

[0] -> Ysl74.,34,.9/\]2gg5D25][46

[1] -> IIb,berl3/64654=/+saddhrt9rh-9454y

[2] -> ?>wa/a’QR#M KGLcknw83_+++

The gene map will create an array containing information like this:

(Motility) [0] -> [0] -> {index: 2, start: 6, end: 15}

The trait generator will generate a table of traits looking something like this:

[“Hibernation”] -> {34, 123, 65, 19}

[“Poison”] -> {10, 99, 14, 29, 78, 16, 41}

The numbers in the trait expressions represent the difference from one character to the next. So a gene section with the ASCII difference between it’s first and second letters that is 10 would begin to qualify for the trait at index 1. The more of these sequential differences the gene satisfies, the stronger the trait will manifest. This kind of checking may be quite expensive, but we’ll have to see.

Genes will be evaluated against a randomly determined array of arrays of numbers to determine the organisms resulting fitness. Genes will be read using the gene map to concatenate all of the like genes together, and then the system will begin evaluating each gene based on it’s ASCII value. The randomly determined array works as a standard. The deviation from the standard by each character in the string goes towards the gene’s score. Then the length of the gene, the total score, and the number of standard elements are factored in to get the final score for that gene. So, say our Motility gene standard was 34-198-102, and we had a gene that was translated into ASCII with values 56-202-181-89-30-2-102. Well, 56 is closest to 34 and is off by 22, so the first score is 22. 202 is closest to 198 and off by 4 so the total so far is 26. 181 is closest to 198 and is off by 17, so the total score is 43; and so on. Normally I would do all the math, but I don’t feel like it right now. Let’s just assume that the total score is 116. We then calc the gene potency by dividing the maximum string capacity (255 * 7), 1785, by the total score to get 15.3879. We then divide this answer by the number of standard values (4), to get the final value of 3.8. This is a fantastically good gene value. Most values will have values between 1.2 and 2.8, but it will vary greatly.


Our first plan for the implementation focused on microbial life. It’s a great starting point, so that’s what I will present here and will be working with for a while. However, I hope expand to multi-cellular creatures at some point, because I feel this system has a lot of potential no matter what scale you work at. So, here are attributes used to describe an organisms capabilities and presence within the sim/game:

  • Offense: Determines the amount of damage the organism can deal to it’s target food source. Food sources will only relinquish food (or die) after a certain amount of damage has been dealt.
  • Motility: The speed at which the organism can move about. This value will be guaged on percentage of a maximum value.
  • Defense: The amount of physical damage resistance, representing cell wall composition or hide thickness etc.
  • Sensation: The degree to which the organism is aware of it’s surroundings.
  • Blending: The degree to which the organism can blend into it’s environment.
  • Health: Determines the maximum amount of damage the organism can sustain until it dies.
  • Metabolism: The percentage of energy the organism can glean from it’s food source.  A higher value allows for more energy output.
  • Storage: The amount of food the organism stores for later use.  Stored food also increases the organisms weight, requiring more energy to move.
  • pH Resistance: The range of pH values the organism can survive in.  If the organism is in an environment it is not resistant to, it will begin taking damage at a rate of (|resist – environment|).  This gives them time to move into suitable environs.
  • Radiation Resistance: The amount of radiation the organism can withstand without becoming ill.  Double this value will kill the organism outright.  Radiation always has a chance of damaging DNA, so rad resist is simply for living conditions.
  • Ion Resistance: The range of diluted ions that the organism can live in.  This attribute functions similarly to pH resistance.
  • Thermal Resistance: The heat range in which the organism can live.  This attribute functions similarly to pH resistance.
  • Redundancy: The number of copies of genetic code the organism possesses.  When something effects DNA (such as radiation damage or replication), a random copy will be selected.  This aids in radiation resistance and mutation resistance.
  • Regeneration: How quickly physical wounds and health are healed.
  • Sequencing: The speed and accuracy at which replication occurs.  Levels are stepped, providing more accuracy, then more speed, etc.
  • Diet:  This one’s tricky.  This attribute determines which food sources the organism can eat, which ones it cannot eat, and which ones are poisonous (should it eat it), including poisons from attacks and other biological agents.


In between each generation cycle, each organism will have active stats that will be taken into consideration while advancing state:

  • Health: The current amount of health the organism has.  If this falls to 0, it dies and can be therefore eaten.
  • Motility Modifier: This is directly effected by the organism’s health, decreasing as the organism is injured, allowing predators to  secure their prey more easily.
  • Energy: This is spent to perform different tasks, such as moving, digestion, attacking, regenerating, or reproducing.  Energy is gained through the eating and digestion of food.
  • Food Stored: The amount of food the organism has stored before it needs to feed again.
  • Health Modifier: This stat is directly effected by the organism’s radiation, pH, ion, and heat conditions.  If this modifier changes the organism’s maximum health to 0 or lower, the organism dies.
  • Conditions: This array stores the amount of ongoing radiation, pH, ion, heat, poison, physical, and other conditions that may be affecting the creature.


The ‘test’ environment for this sim/game will be a petri dish.  The environment will be filled with many different species of bacteria, and resources will be pretty readily available, just to make sure the system works.  However, as the scope of this project grows, environments will become much more realistic and interesting.

  • pH Balance: The acidity of the surrounds.
  • Ion Balance: The amount of dissolved ions.
  • Background Radiation: The amount of ambient radiation.
  • Ambient Heat: The amount of ambient heat in the environment.
  • Resource Pockets: These pockets of food will be scattered about randomly.

The environment will change, sometimes slowly, sometimes rapidly.  Many different events will occur to change the environment in one way or another to show how selective pressures change species.

So, that’s the idea for now.  I’m still trying to figure out how to make this into a fun and interesting *game* versus a interesting *simulation*.  Will give more details later.



  1. Your are Great. And so is your site! Awesome content. Good job guys! Interesting article, adding it to my favourites!

    • Roucis Kyle
    • Posted March 29, 2009 at 13:10
    • Permalink

    Hey thanks a lot! It means a lot to me to have a supportive and enthusiastic reader base. Also, I gauge my value as a human being by my page views, but that’s my problem…Thanks again!

  2. Kyle,

    You’ve got an interesting but *very* complex project here. That’s an incredible amount of variables to deal with and reminds me of your boarding action game. I suggest a couple of things when proceeding forward:

    1. Break this down into parts. You will probably want to start with larger systems and work your way down. You will want to test each system at a time rather than throwing tons of variables into the pool – that will only make it easier obscure the results of your tests. Breaking it down into parts will also allow you to test each individual part. Look at the Advanced Prototyping lecture for more detailed information. Something as complex as Spore wasn’t built in a day, but it was also not built as one large system, but rather as smaller chunks that were put together into a whole. That’s one of a few effective ways to build complex systems.

    2. Your final question here is game vs simulation. Remember the elements that make a game: rules, goals, and conflict. You’ve certainly got a lot of rules, but you don’t have goals and there is no clear conflict. Rules can give you a system or simulation that is interesting to watch, such as Conway’s Game of Life. But Conway doesn’t have a goal or conflict to his ‘game’ and so it is a simulation, not a game. Think about your project in terms of higher-order systems. What is the experience you want your player/user to have? What types of goals do you want them to work for?

    • Roucis Kyle
    • Posted March 31, 2009 at 18:48
    • Permalink

    Those are precisely the issues I have been attempting to address before diving in. Also, I haven’t had (nor will I have) the time anytime soon to whole-heartedly start working on this idea, prototype or otherwise.

    Yes, it’s quite complex, but it really has to be to show how evolution and selective pressures work. They operate best in a highly complex environment built from simple interactions. This necessitates that the program track as many things as possible to allow for the greatest flexibility.

    As far as the question of game vs. simulation: you are totally right. I have been juggling several ideas around to turn this concept into a game instead of a simulation, and I will probably be doing that for quite some time. Of course, this part of the development of it can come very late in the process. I need to mock up as much as I can and actually get it working before I decide what I can capitalize on for gaming experience.

    That may seem backwards for some people (it did to me when I first wrote it), but it actually makes sense in this case. The original purpose of this idea was to create an evolution/selective pressure simulation. The decision to turn it into a game really comes from the fact that it’s so flexible and interesting that it could really provide some interesting gameplay and a powerful message.

    So, yes. I will working on breaking this down into manageable chunks, prototyping each chunk, and figuring out what kinds of goals, special rules, and end states that the game will present as well as it’s overall message.

    Thanks for the input, I appreciate the critique! I’ll be sure to let you all know how things progress in the future.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: