Jump to content
  • Advertisement
Sign in to follow this  
bobbinus

instantiating a skinmesh multiple times..

This topic is 4864 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello I am using the DX demo skinned mesh sample in my game demo. I am in the process of making it multiplyer and I want to uses this same model(tiny.x) for all the players. So currently I have a player class that has all the player's game information and the skinned mesh. Now that i want the game to have say 4 players i thought it would make sense to only keep one copy of the mesh and just animate it seperatly for each player. Animating uses setTime() to update the rotation matrix member for each sFrame. Does anyone have an idea for the best solution to this situation...? I thought using multiple copies of the skinmesh would be wasteful and this situation must be common because many games have multiple copies of a particular animated mesh. If you could provide an idea in relation to the skinnedmesh sample i would really appreciate it(SDrawElement,SFrame,SMeshContainer).

Share this post


Link to post
Share on other sites
Advertisement
Im not sure how directx's sample is. But I can say you want to keep 2 seperate classes. One for the Object(Entity) and one for the mesh. The mesh can be made up in all different ways using matrix stacks which contains a different rotation of what not for each body part. Or simply just start with one model(body part) and have it hold a matrix containing its translation, scale, and rotation into the world. Then simply reference it under the many objects that use that mesh(hold a pointer to it is an easy way.)

Here is my setup...

ObjectManager
.....localObjectList
..........MeshIndex
..........MatrixToWorld
.....localMeshList

Where The manager takes care figuring out what to render and in what order. The localObject is a class that holds the matrix that takes it from local coords into world coords to be rendered. It also holds an index to the mesh list and material info & what not... The localMesh contains the actual mesh and all frames that you would use. I simply call upon it in the objectmanager per what object is being rendered.

Again sorry dont know much about the sample, but for me this worked best considering I was using my own importer/model type. Also the object manager helped me out alot so I dont have to keep changing the whole render sequence. I can make sure it always renders in the correct order so as few state changes are needed as possible.

Hope this helps.

Share this post


Link to post
Share on other sites
They are seperate clases kind of, the player class has a member struct that is the skinmesh container. I think it sounds ok to have an multiple player objects that share the skinmesh container(static member of the class) and then just animate each mesh per frame depending on data within the player class(ie playerIsMoving etc...)... But if i run my game in window mode where the FPS can be 500+ it doesnt really make sense to update the animations per frame because mostly they wouldnt have changed. But to throttle the animation updates down when multiple players share the skinmesh object would mean I need to have a copy of the animation data per player so that rendering can still proceed correctly for each player....im a bit confised about which way is best here... ;(

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!