So here's the idea, I'd like to create a 3D biological simulation game where you raise a population of creatures throughout several generations. I want the creatures to have DNA that dictates how they will look (which will lead to the breeding, and eventual evolution of these creatures through artificial selection). I'd like them all to have the same basic form, with modifications onto the form controlled by the DNA. The concept is something like how all people are humanoid form, and our DNA controls things like height, weight, arm size, ear shape, and other features. Big changes in the creature like extra arms don't have to be accounted for, I would just like the basic form to be manipulable.
The only method I see that would make this possible is procedural generation (correct me if I'm wrong). Part of the DNA would act as the seed for the procedural generator to control the manipulations onto the form. If the method would work, data on the creature's age could act as something of a multiplier to control characteristics to simulate the growing from baby to adult.
I'm afraid procedural generation is new to me, and I'm a relatively new game developer. Is my idea of procedurally generating modifications to the basic form sound? And if so how would I go about starting it, and eventually implementing it?
Thanks in advance, Devin.
I've been researching for about 3 hours now, and I think I've come across something else that may tie into this.
Metaballs could be used to make the initial form of the creature procedurally by using the DNA code and could have their properties edited to make adjustments. That would allow for extension/resizing of limbs/torso and changing posture of the form all through the code. I'm pretty sure the game Spore used metaballs in their frames to allow for the editing as well.
However that would only account for re-sizing and changing posture. I would still need to find someway to attach features to the metaball frame, such as ears, eyes, etc. And I would need for those features to be controlled through the DNA as well to produce many differing variations.
I'm not sure if I'm on the right track here. Any advice or direction on how to produce the generated features, or how to use the DNA to produce the metaball positions?
Or maybe I need to go another direction instead of metaballs, I appreciate any support.
I am already half way through coding exactly this.
I have figured out the skeletons and breading, along with cross species breading and movement generation. Now working on muscle groups and skin detail.
Metaballs don't work, unless you use thousands of them, the shape of a muscle does not fit the metaball premise, and the mechanics of the way muscles work means they change shape based on position of bones.
I have created a set of equations for each muscle type that return a bool, inside is true, outside the muscle is false.
I am also looking at using standard stored volumes, created in a graphics package, that can be morphed to fit.
Not sure which is going to be faster at this point.
My main problem is the size of the DNA string, I started out with 128 genes, that turned out to be far too small.
This is a hell of a big project, not sure if you have realised how big yet. A few hours research gives you the impression it's doable and not too difficult.
A few days coding and you soon realise that it's a world of sh1t and is going to take a lot of work.
I'm committed now, (or should be) you may want to think again.
After all how does a five legged humanoid walk? Where do all the legs join the skeleton? What about a zero legged humanoid, how does that move?
What happens when a biped cross breeds with a quadruped?
These are all issues I have had to address, and it's a nightmare
Even in the simple case you are thinking about, have a look at parametric face recognition to see how many parameters they use. Really each of those should be included in the DNA as a HOX gene.
I have a HOX gene for a size modifier for each bone ( I have simplified the skeleton some what though) , these HOX genes are cumulative in my system as I want a large amount of genetic diversity, in real life they work on a first come first served basis.
Then eye colour, hair colour, hair type, etc. etc. etc.
Even in a simple system the size of the DNA string gets large very quickly.
You're coding a similar game already? That's really interesting. What made you come up with the idea? And how much time have you put into it, it sounds like you have it pretty far developed.
I took alot of my inspiration for the idea from a combination of Spore and the Creatures Series.
My plan was to have a system of biochemistry for the driving forces such as hunger and energy movement through the ecosystem. With chemicals like atp being used for energy, and creatures/plants having different types of molecules like lipids and carbohydrates to serve as the chemistry variables. For the creature AI itself it would be interesting to have a neural network to simulate learning and that would appear to work well with the biochemistry system for drives.
My purpose behind the game was becoming something along the lines of a type of zookeeper/ecosystem balancer/breeder, but you would try to develop the species towards being able to self sustaining in a specific biome to unlock new tools (like a DNA mapper or something) to give a secondary goal.
I had intended to use metaballs to create something on the level of the spore creator and try to create the parts with a higher level of detail. I hadn't really thought about using a muscular system, i was just going to create a skeletal movement system for the metaballs. It would be lacking in realism but my goal was simply to get a frame moving at this early stage.
I know it's alot of work and probably above my skill level, but I'm eager to try. When I get an idea in my head it eats at me until I at least attempt it. I'm going to try and put together a creature creator at least.
If you have the time, I'd love to know what solutions you found to those problems.
Bipeds and quadrupeds usually can't breed, I don't think there is a working example in nature.
How did you make the skeleton generate from the DNA? (I'm assuming that the skeleton is your base level with the muscle taking form based off of the skeleton because it sounds like your muscles are dependent on the bone structure)
It seems like to have 128 genes you would have to have each gene cover an entire grouping of traits, generating the unique skeleton frames alone seems they it would take 128 variables.
I'm afraid I don't really know what standard stored volumes are, or actually even what the equations for the bool are for.
The game design is more or less finished, the game coding is a couple of months in.
A lot of the back end is complete, it's the display code that's an issue.
I have to support OpenGLES 1.0, 2.0, and software rendering, so it's a big block of code.
The way the skeleton is grown in nature is really interesting. It starts with the base of the spine and the dna is decoded as it goes along.
So the dna would be saying "grow straight", then after a period of time, "grow a t junction" or "turn this direction"
In my code I just have a HOX gene for each bone and build a list of them, then when I finish parsing the DNA I connect the bones together.
In my game it is possible to breed all creatures together, so breading a star fish with a dog is legal and my code has to handle it.
In nature a HOX gene is about 180 base pairs (I think,can't be bothered to look it up) so that is one layer of compression in effect
I am using a voxel system for my creatures, I start off with a 3D array and fill areas of the array with values to indicate muscle, skin etc,
Then I use a marching cube system to polygonise the array.
And the DNA to texture.
That should be the easy part of the code, compared to the animation system anyway.
You're working on the coding of the creatures development, but what game design do you have? When I was brainstorming what game would show off the features of the DNA the most I noticed that the game could be on an individual pet type system, or an entire ecology. I ended up planning on the pet system.
I know the creators of spore published a document about how they handled the formulas for animating a system that hadn't been created yet. Maybe they have something that could help? I looked for a link, but I can't find it.
3d arrays are a system I can't find much information on. I'm trying to look for tutorials on them or something to look at, but I can't find one. I'm trying to look at all of the technologies that could be used to create the creature procedurally.
What type of software are you using (like 3d modeler)? Did you use a pre-made game engine/library to start off the code?
Would the HyperFun programming language or Function Representation (F-rep) help any?
From what I've researched they are used to simulate surface geometry and internal composition. It simulates the creation using functions, and with a conversion system it seems you could create that function with DNA.
So it would be something like ADFETFEDR (gene) would convert to (formula) which creates the complete 3d model with composition.
I'm sure you know more about volumetric systems and voxels. Would this technique work or help at all?
And as for the animation, I'm looking at using something along the lines of this http://tinyurl.com/7a9dcot You could have it generate the movement specifics at the birth of the creature and use those while the creature was alive, or maybe do it on the fly.
I am porting Natural Motions Morpheme to our OS.
That will handle all the actual animation, creating the base clips from the skeleton is an issue that I have prototype code for.
I'm not telling you anything about my game design, it's a commercial game !
Let's just say that Chris Hinsley and I have been in this business a long time and know how to write a fun game and leave it at that.
My DNA handling is both simple and complex at the same time.
The way breading is handled uses real world models, the DNA strings from the parents are split at random points and recombined, that some mutation is applied. This creates a valid DNA sequence and some junk DNA. Which is what happens in the real world. A lot of our DNA is now junk.
But using the created DNA string is simple, I am not treating the DNA string as base pairs. I'm treating each item in the DNA string as a gene.
So by defining genes for each parameter I want, I can quickly parse the DNA into values that make sense.
When it comes to rendering, I'm going to use voxels.
The easiest way to think about voxels is think of them as lego. You have a 3D space in front of you and if something exists in a region of that space, put a lego brick there.
By doing this for the whole of the 3D space you end up with a lego model of the object.
How good it looks depends on the size of the lego bricks.
If you are really close to the object, you need a lot of very small lego to make it look good.
If you are very far away from the object, you need a few very big lego bricks
Get the idea?
I listened to some of the Spore teams thoughts on animating creatures. Their system involved using a query system to move types of parts rather than the specific arm or leg. The system allowed the same animation techniques to be applied to many different forms.
I was just trying to look for a good game engine and thought you might know of one that works well with the type of character generations.
I can follow how you plan to organise the DNA, but how will you use the string of data to create the model for the creatures? That was my reasoning for looking into the FReps programs and Hyperfun.
Turning a single string of data into a 3d model seems to be a big stumbling block.
I can see how you could create a few simple geometric shapes for creatures using the basic code for the position and size, but creating 3d complexity from lines of code is what I can't come up with any solution for.
how can you create the skeleton/muscles/etc from a code?
I'm pretty sure that the game Minecraft uses a voxel system in Java. I get what that does at least.
You should check out the genetic system in the indie game LinkRealms at LinkRealms.com. They let new applicants in every Saturday.
So far the genetic system is limited to breeding roosters for the cockfights and as dungeon runs, but wolves and snapdragons will be released eventually. There are both behavioral and cosmetic genes, and the randomness of the breeding process is a lot of fun. Hands down the best pet/breeding system I've seen anywhere.
This youtube video sums up their genetic and breeding systems.
That green rooster fighting the bugs in the last few seconds of the video is one of my breeds. He didn't have the best behavioral genes, but I bred him until his general look became common in my breeding. An amazing system really. If they hadn't wasted it on roosters and done something like dragons instead, that game would be epic.
I was just trying to look for a good game engine and thought you might know of one that works well with the type of character generations.
Nope, don't use engines. I write my own for everything. We have a deal in place with Natural Motion so I will be using their animation system though, after I have ported it.
I can follow how you plan to organise the DNA, but how will you use the string of data to create the model for the creatures?
I build a list of the bones that exist in the skeleton, I then build a connection graph which links all the bones together into a skeleton.
I then build a list of muscles and attach them to the bones.
I then run the animation system one frame at a time, use the relative position of the bones to work out the position of the muscles.
The muscles then are rendered into a 3D array as voxels based on the length and type of the muscle ( including if they are in tension or compression )
The whole of this is then skinned with a marching cubes algorithm and skin parameters applied.
The result is stored as a texture for later real time display as I am targeting fairly low end devices
On a decent PC or games machine you should be able to do it real time with a few clever shaders.
There was some Presentations at Siggraph about Spore. I can't find the papers now, but there are some videos and slides here: http://www.andrewwillmott.com/s2007
Thanks you guys. I've managed to work out the system. I'm creating resources for it now, but the core of the system and how it works is fleshed out enough to give me enough directive to work on.