Jump to content
  • Advertisement
  • entries
  • comments
  • views

Let there be LIFE!

Sign in to follow this  
Embassy of Time


I recently had a very fulfilling conversation with an old buddy of mine. It was about an idea I have had for a while now about how to create artificial life for my game. For those who do not know it, most other procedural generation of life is basically like those cardboard faces some of us made as kids (y'know, before kids were basically born with internet access. Those were desperate times, I tells ya): You have a set of long, thin cardboard 'boxes', one for each of hair, eyes, nose, mouth, and chin/beard, and then on each of the long thin thing's sides, you draw a different kind of hair/eyes/nose/mouth/chin. Then you can flip them over to mix and match and create new faces. In much the same way, a game like No Man's Sky mainly takes heads, body types, legs, maybe tails and horns and such, and mix a bunch of standard premade ones together into a new creature. Add random color for fun. Anyone who has followed NMS let's plays on YouTube know that after a little while, the creatures start to look closely related in pretty dumb ways ("hey, that guy has the same antlers as the one on the other planet, but why does he only have two legs??"). This is not, in my book, truly procedural creation.

As with most other things in the game, I like to take the scientific approach to things. That includes life. Although I hope to soon write an entry in my SCIENCE (biatch) series about this, I thought I'd throw the basics of the idea into public and see if someone has interesting comments on it. It is based on something called chemotaxis, which basically translates into "chemical movement". In super-short, very early life on Earth (just single cells, long before animals and plants) developed from little blobs of fat with DNA inside them, and the DNA changed every now and then when a new blob was born (we call it mutation). The blobs that survived and made new blobs were the ones that had changes that made them act in useful ways. One such way was surprisingly simple: Spaz out when things aren't going your way! Yes, the origins of complex life can be tracked back to blobs of fat having a temper tantrum. Puts modern life into perspective, doesn't it?

The reason is that when a blob spazzes out, it ends up moving around a lot. If it spazzes out due to toxic stuff in the water (early life was NOT on land), that means a greater chance that it gets away from the toxic water. So blobs that spaz out from toxic water survive. But the real prize is an even more human-like tantrum: Spazzing out when there is no food around! That means a blob does not stay long in places with little food, and stays longer (i.e. does not spaz out) in places with more food. That's good for surviving.

It seems insanely simple: Spazzing out to get away from dumb places makes you stay alive longer, and make more baby blobs that do the same. But that's one of the very first keys to life. And that makes it seem like a good place to start creating artificial life, too! So here is the idea: Scatter thousands of dots around an area. Give them some basic attributes: Move, turn, make a new dot, or die. Oh, and one vital ability: Create some other random dot, which can't really do anything, it just has a number. The dots with all the abilities we call "cells". The ones without any actual abilities we call "chemicals". And when a cell meets a chemical, it reacts in a random way, either raising or lowering an ability, or creating a new chemical.

The trick here is that every time a new cell is created, it has the same abilities and reactions as its 'parent'. So if a cell's parent reacted to chemical #7184 by spinning slowly clockwise, then the new cell does the same. Every now and then, a cell has a tiny difference (maybe it spins counter-clockwise, or slower or faster, or not at all). That is mutation; you do roughly the same as your parent, but with your own little twist on it. So now, let's think how these cells may start acting. And note that this is only guesswork, as the tests have not been programmed yet (I'm still on creating mountains procedurally, and valleys and erosion and maybe even atmospheres are next on my list).


You've created your thousand cells and let them create new cells and probably die for a few minutes, and a few mutations have shown up. Some cells react to a chemical by dying slower (and thus having more time to make new cells). Others die faster from another chemical. Others move slower around certain chemicals, not unlike in chemotaxis. Over time, the ones with the better mutations will get around to making more copies of themselves, thus filling up the place with themselves and pushing weaker ones out. Survival of the fittest.

But this was not what made the conversation between myself and my friend intersting. What did that was thinking about possible activity further down the road! Imagine a cell that turns one chemical into another chemical, which is lethal to certain other cells. That 'killer cell' would be able to smite any opponent that died from the chemical! If the killer cell turned chemical #2084 into chemical #5339, and its rivals died from #5339, the killer cell would survive best in places with a lot of #2084 floating around. That means that the killer cells would lurk in certain areas, near cells that produced #2084. Like a lion lurking in the bushes, ready to strike at those #5339-sensitives foolish enough to wander near. That would leave more food for the killer cells. And one idea was to have all cells contain chemicals for a bit before using them, releasing the unused chemicals on death. That means killer cells could evolve to kill other cells for their chemicals. And you have predators! Not the alien kind, though, just simulated cells.

Let's imagine more. What if cells of type A produced chemicals that were really good for cells of type B? B would survive best if it evolved (i.e. its children cells mutated) to follow A around. This is just chemotaxis over again, with the exception that the source of the good stuff is moving around. So now you have 'parasites', so to speak, following another type of cell around to snack off whatever it leaves behind, like seagulls after a ferry snacking on dropped food. But let's push it further: What if cells of type B produced something that cells of type A could use? This is symbiosis, where different species live together because they help each other unintentionally, like those birds living off what they find in a crocodile's teeth, and the croc thus getting free dental care (yes, those birds exist). Clusters of A and B would likely end up roaming together, because those that behaved in ways that kept them together would survive better.

Or maybe let's combine these ideas: What if A produced something that B used to kill its rivals with? And what if those rivals were also the rivals of A? That would basically be cell type A using cell type B as a 'living weapon' to kill its enemies! Or maybe B makes chemicals that attract other cells for A to kill and eat. Or maybe B attracts cells of type C, which are the ones that A can actually benefit from! That makes the symbiosis a bigger system, with different cell type depending more and more on others, to the point where you no longer even think of them as individual cells, but as little cell systems surviving together. Even with thousands of cells in the simuation, you may end up with a few dozen actual 'cell systems' moving around almost like living beings of their own. And what do you know, that's almost(!) how bigger creatures evolved, by cells sticking together to benefit each other! Have a single cell type evolve to produce a safe environment for the other types to thrive inside, and you basically have the very first multi-cellular organisms...

This is a simple idea taken to extreme possible conclusions. But the point isn't whether or not the results will be exactly like described; the point is that it's a simple system. It's a very simple thing (a 'cell' dot that can move, turn, copy itself (with the occassional mutation), die, and react to the 'chemical' dots) that may or may not evolve on its own into something more interesting, one little change at a time. Even if cells only react to half a dozen chemicals, the results can be insanely complex, creating weird patterns and relations between cell types.

It's definitely not just swapping a goat's head onto a horse and giving it afunny tail and painting it bright yellow.

CanA,t wait to try it out!

Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!