Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'd like to have a procedural system that uses a string of data to create a 3d creature. The way I've thought to do this is to use the code to generate a simple creature skeleton (I'll get to the skin generation when I have time) so I can test different source data's effect on the structure produced.

How can i use a set of data to generate the simple 3d skeleton?

The code would have information used to show what type of bone it was(hierarchy), the bone length, and how the bone was positioned and use this to make the model. (At least in planning, I don't know how to implement it)

Edit: The goal is to create creatures of different forms and skeletons. The creation will be mirrored down the spine so both sides are the same.

I'd like it to be highly adaptable but I'd like to specify a max of 4 legs and 4 arms (8 limb max only 4 on ground for walking). Being able to create a basic structure for humanoids, quadrupeds, and mixes (like a centaur or biped with no arms) is the goal.

I've looked for how to create a model off of the code procedurally, looking at stuff like FRep isosurfaces and metaballs, but I'm stumped on how to make it happen. I decided any progress is better that none, so I'd like to get a generator for something like an animators skeleton example to make sure I can get working structures (and later have something to work with to begin working on the animation algorithm).

Sorry for the lack of information at first, I was trying to keep the question simple. If you have an idea for the creation of the structure(skeleton) or maybe even the form itself I'd appreciate the help. Thanks

share|improve this question
    
Please describe what you mean by "a basic character skeleton". A humanoid? 2 Arms, 2 Legs? 4 Legs? Arbitrary number of legs/arms? You need to be more specific about what you want to achieve. Also: Will this creature be animated? –  bummzack Dec 24 '11 at 12:26
    
It's not an easy task. I don't have a link but search for interviews with the Spore game team. –  Patrick Hughes Dec 25 '11 at 10:29
add comment

2 Answers 2

If you're providing all the information for the bones, then really this is more of a importer isn't it? The code is not really generating any content, it's simply displaying the content you provide.

Start with the simple case of a single bone. Make sure your code can read the bone specifications and draws the bone correctly (starting out with simple lines would be easiest, perhaps colored differently at each end?). Then move to two bones, ensure they line up the way you want. Then try adding bones that are to be drawn symmetrically. You could probably define these bones to have specific properties like what kind of joint they have, and if they are mirrored across the body. You could do some things to help visualize the data, for example drawing ball and socket joints as a sphere, and elbow joints as a cylinder.

If you're planning on animating this, you'll need to do a bit of work there. Likely you'd want to use inverse kinematics. The book Game Programming Gems 8 has a section on creating a "Non-Iterative--Closed-Form--Inverse-Kinematic-Chain-Solver" a mouth full for sure, but nevertheless helpful.

Even with a IK solver, you're going to have a very difficult time creating procedurally generated animations for walking/movement. As @Patrick Hughes mentioned, Spore is a great example of this challenge. There's a nice resource called Real-time Motion Retargeting to Highly Varied User-Created Morphologies that should help you start to understand the undertaking you have ahead of you. Make sure you take a look at the PDF linked on that page.

That being said, if you created an animation system that could do this, you'd have no trouble getting a job :).

EDIT

I'll add more details on the actual drawing of the bones. First, let me define some of the details you'll have to keep track of, for each bone.

  • Bone start position - This is a 3D offset from the parent end position. For limbs and such, this would just be zeros, or at least small numbers, but it's better to have this information for things like ribs where the offset could be greater.

  • Bone line equation - I recommend starting out with straight lines, but you may want curved bones in the future (ribs, clavicle, etc). This information would include the bone length and direction. You'd use this information for calculating mid-point attachments to this bone.

  • Bone end position - This is a 3D offset from this bones start position. You'll need this for the starting point of some child bones. This can just be computed from the start position and the line equation. It's just nice to have to so you don't have to compute it every time you want it.

  • Bone connection type - There are at least one of these per bone, it could be a joint or something more solid like the ribs connecting to the sternum. You'll want this information at first to draw what the connection looks like, and maybe eventually to tell your animation system how this bone is allowed to move.

Your bones should be laid out in some sort of tree data structure. With the root bone (generally the hip or base of the spine) being at the root of the tree.

Start with the character position in 3D space. This is the starting point for all the bones, it's the root. Use this position as the offset for your first bone. The way the bones are set up, once you have the first position, you can calculate the start/end of every bone in the system. Once you have all the start and end positions of the bones in your system, you're ready to draw.

I'm going to assume you're starting with straight lines for bones.

Draw in whatever order you want, but you might as well parse the tree you already have set up. So start with the root bone, and draw it. This is as simple as drawing a line from start position to end position of the first bone. If you're not sure how to draw a line in your system of choice, I'd recommend taking a step back and deciding if you're ready for this project.

Continue parsing the tree and drawing lines from the start position to the end position for each bone. You may want to pull this information out into some other data structure for quicker drawing, but that's outside the scope of this answer.

I have to say though, from your responses so far, I think this project may be beyond your current skills.

share|improve this answer
    
I especially second the last line :D. If you manage this stuff, you'd get any programming/design job you want. –  FullyLucid Dec 26 '11 at 5:42
    
The initial problem I'm having is turning the data string for the bone information into a model. I've looked into turtle graphics, primitive instancing, l-systems, metaballs, and FReps. But I still don't know what to use for the bone modeling. My goal is to make the bones and joints model out of simple instructions (like the bone length, joint type, and direction the bone grows in). I just can't find a method to draw the bones. –  user12092 Dec 26 '11 at 14:44
    
I'm trying to understand exactly what you're starting with. Are you starting with the lengths, joint types and direction of each bone? Or are you wanting to generate that information? –  Byte56 Dec 26 '11 at 16:33
    
Basically I want to code a model from a set of "genes". The genes would show parameters like the lengths, joint types, direction, and such. Then the system I want to make would use that information to create a 3d model. Then I could alter the genes/parameters to create a different model. So the system is like turning DNA from genotype to phenotype. I need to be able to create a skeleton/model from a set of parameters. Thanks for helping out btw –  user12092 Dec 26 '11 at 17:32
    
It probably is beyond my current skills. However this is the project I'd like to start. I've been trying to learn as much as I can so I can chose which system to start figuring it out in, since once I start the system will be my limiting factor. Thank you for your help. –  user12092 Dec 26 '11 at 18:47
add comment

From what I understood reading your question, I'm assuming you want to procedurally generate a character, given some arbitrary data. Eg. a given username will generate a unique creature for that user.

The way I would go about this is to extract a number from the username (by using something like a CRC sum, or some other form of hashing). Then use that number as seed for a random-generator.

As Byte56 already mentioned in his excellent answer, going for a fully procedural approach is going to be very hard. I think it might be simpler to have multiple basic skeleton setups that can be parametrized. So maybe you have an armature for two, four and six legs with some extreme setups. Eg. a humanoid with very short legs, one with normal legs and another one with very long legs.

Ideally you would have existing animation data for (at least) the extreme cases, so that you can interpolate/morph intermediate states from one extreme to the other.

If you then have a user-name, you would seed the random generator as described above and first do a random roll which basic armature to use. Then perform other random rolls to determine other factors, such as which "intermediate state" to use, "animation speed", "skin color" etc.

Even though this approach isn't fully procedural, it will still generate a unique character for every username (given that you have sufficient base-armatures and variations thereof). As long as you just use this to create creatures using a given input and don't allow the users to add more limbs (like in Spore), the outlined approach should be much simpler to implement than a fully procedural character-generator.

share|improve this answer
    
I'm more looking for data with direction. Less like arbitrary data and more like DNA, I want it to have the instructions to make the model.The user won't be able to specify any inputs either. Creating a skeleton would work, but how would I be able to make the bone lengths and such parametrizable? –  user12092 Dec 26 '11 at 14:50
    
@user12082 Starting simpler is almost always the best way to go. You would parameterize skeletons by defining specific aspects of the you'd like to change from skeleton to skeleton. From simple (height of skeleton), to complex (size of feet, leg length, slouch angle, cranium circumference). Then your generator takes those aspects into account when creating the skeleton. –  Byte56 Dec 26 '11 at 16:43
    
But how would I take those parameters to make the model's structure, like how they fit together into joints and such. I know how to set basic shapes to parameters in 3d modeling programs, but not how to make multiple shapes change while staying connected to each other. I don't really know where to start making the parts parameterized in the skeleton either. –  user12092 Dec 26 '11 at 17:40
    
Multiple shapes changing while connected to each other is animation. And as I mentioned in my answer, that's going to be exceedingly difficult. The parameters are just for creating the skeleton, they don't really apply after it's been created. –  Byte56 Dec 26 '11 at 18:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.