Best way to use props?

Started by
2 comments, last by mikeman 17 years, 7 months ago
Hey Im currently learning a lot about 3 dgraphics, and game programming, and Ive come to a point where I would like to start making objects for testing, etc. My question, is whats the best way to impliment things such as weapons, armor, and other various world objects that the user can equip? I plan to have a base model, such as your standard man in his loin cloth, and then give the option for him to equip various pieces of armor or clothing, or weapons, to customize his appearance. From what I understand about my 3d engine that Im using, I can create some sort of 'attach' points or 'bones' on my characterMesh that I can attach other objects to, and they will assume the parent objects size/rotation/scale. So that parts easy. The problem is that now Im drawing my base model+the armor. I guess this isn't a major deal, but when you have several npcs, and users and ai, pathfinding, everything going on im sure it eats up some system performance. So is there a better way to do something like this? The other option would be to have a different character model for every single piece of armor in the game which would be pathetic. Recap: best way to use a base character model, and attach props to them and keep frame rate down?
Advertisement
Just divide the models in parts, say head,torso,legs and make different 3D models for each one(but of course all rigged the same way to the skeleton if we're talking about bone animation), for example clothed_torso,armored_torso,iron_boots_legs, and so on. You then combine and attach them together to reflect each character's properties. For example a char with a gold helmet, an armor and iron boots would be comprised by gold_helmet_head,armored_torso,iron_boots_legs. Dividing the character models into parts is very useful in other areas anyway, since you can, for example, assign a different animation in each part. So you can make your character run(legs animation), slash his sword(torso animation) and look at his enemy(head animation) at the same time.
ok so using that method...

The base character model would actually be something like:

basic_male_head
basic_male_torso
basic_male_arms
basic_male_hands
basic_male_feet
basic_male_legs

They all connect via some sort of bone system?

Then if he randomly picks up some chain leggings, everything would be the same, except that the 'basic_male_legs' would swapp to 'iron_chain_legs' as an example ??

That does make it easy. What about weapon animations, does the animations go with the hand, the torso, the weapon, or how is the best way to do that?

I currently have it setup so that the animation belongs to the weapon, and basicly just follows a spline and rotates so that it looks real. I was planning on making it so the players arm would attach to the weapon and just animate according to what the weapon was doing.

So the weapon animates the character model, and the character model is just dragged around according to the weapons position/rotation. Is it better to do it a different way? Maybe upper body or left/right arms, ?

Like I said Im new to this stuff, perhaps this should be in the beginners section, but its more related to games, so...
I only have done this with bone animation, so I don't have much to say about your "custom" animations. Plus, I used Cal3D(a pretty popular library) to do that when I implemented skeleton animation as a volunteer for the client of Raduprv's Eternal Lands(the client source is free, you can download it and take a look if you want).

Bone animation is pretty much done like this: The artist builds a skeleton out of bones, and animates them. Each animation influences some or all bones. Then, he creates the meshes and "rigs" them to the skeleton. In-game, Cal3D deforms the meshes that are attached to the skeleton based on the skeleton animation, and that's how it appears that it is animated. For example, in our case, the artist created a skeleton for,say, elves names skeleton_elf. She created several animations for that skeleton, like elf_run,elf_walk,elf_fight. Elf_run influenced the bones that represented the legs, elf_fight influenced most or all bones(IIRC) and so on. Then she created:

mesh_head1,mesh_head2,mesh_head3... and rigged them all to the same skeleton(skeleton_elf).
mesh_torso1,mesh_torso2... and rigged them.
mesh_legs1,mesh_legs2,mesh_legs_boots... and rigged them.
mesh_sword,mesh_hammer,mesh_bow...and rigged them.

Now, since all those meshes are rigged to the skeleton, all I have to do is:

1)Create a Model
2)Attach a Skeleton to it
3)Attach an arbitrary number of meshes to it.

And the meshes will animate. If a player gets a sword, I attach mesh_sword to the model. If the player gets boots, I detatch the current legs mesh and attach mesh_legs_boots and so on. As for moving the model around, it is just offseted by the character's position the client gets from the server.

This topic is closed to new replies.

Advertisement