Hey there I have quickly prototype a dismemberment system with the following tutorial and the third person template to make my own deadspace like.
With this working more or less as I wish, I’m starting to work on my first enemy mesh and have also been working on different enemy types with different limb configurations/body types by cutting up the ue mannequin. My issue is, some enemies may have a dozen or so limbs and be mixed in with largish groups of zombies or environmental hazard type enemies, but this would obviously result in meme draw calls as each zombie is 6 meshes and the large creature might be broken into 15.
What would the best way of optimizing this system early on before I have tonnes of crap I have to redesign? Would I just stitch the meshes together on spawn and the break them apart and spawn the dismembered limb? What would your solution be?
I know that i should be merging the meshes but is there a way to unmerge them as needed or would i just hide parts of the mesh attached to the bone?
One cheapish trick you can use is to have a monolithic mesh for a char (ie, one that has all limbs intact) , then scale the bones for the limb down to 0 when it’s blown “off,” then spawn a standalone limb mesh actor at the joint location. Will still have a bunch of draw calls for the loose limbs, but at least the intact chars should only need 1 each. Can also dial back the lod settings on the severed limb meshes so the calls aren’t as expensive.
I figured mesh merge would probably be the way, what do you mwan whitboard run for each character, running the merge each time one is spawned? How would you auggest i handle detaching the now merged limb?
I like this one but i loose a little control over how far on a limb it should be severed as i need to assign the split fairly cleanly at a joint rather than potentially in the middleof the bone to create a stub.
Plus ypu dont have to destroy every limb to kill any specific creature so definitely more performant.
Yea, the lack of control is one of the drawbacks to just scaling missing limbs to 0. Could be mitigated somewhat with additive animation layers where you might, for instances, scale length of forearm bone by 50% and the hand bones to 0 so it looks like only half the forearm is missing. And since forearm is scaled, could attach gore nubs to the wrist joint. But gore nubs add draw calls back in/
The cheapest runtime solution would probably be to make skeletal meshes offline with every combination of damage, assign the versions to an enum, then use a bitmask to pick the enum value. I think L4D did something like this. Not sure how viable that would be if you have critters with 10 legs or something though.
FSkeletalMeshMerge would be easier than this, but runing the function every time a limb gets blown off could get expensive. Probably still cheaper than 15+ draw calls per char though, since it wouldn’t happen every frame unless you’re dropping multiple chars into a meat grinder constantly.
Funnily enough i think the bone scaling solution is going to work for stump generation too. Basically each intact mesh will have the ungibbed and gibbed version of the mesh overlaid one another. The dismemberable limbs will have the bone and verts duplicated and seperated into seperate objects in blender. Gibbed stump limb bone is half length and then setup with spme constraints so it will track its animation to the intact limb.
Animate the ungibbed creatyre in cascadeur, and then back in blender setup the half length bones to follow the animation of the intact model. Now when a creature spawns in i scale all 5 of the GORE bones to 0 , when dismemberment occurs, scale the intact bones to 0 and the GORE bone to 1. I think 5 additional bones per skeletal mesh will be significantly more performant than constant mesh stitch operations, especially when i can reduce bine complexity in the torso, hands and feet to account for this.
Tbh i lack the technical skill to pull off a l4d2 style system, though reading up on it has been a part of the process. I do want to be able to be able to have at most groups of 20-30 creatures, over half of which will have more than the 4limbs+head, so something fast and cheap is perfect. Will be making sure every creature and gib makes good use of LOD system.
Thanka everyone for the input! Ive tested thia roughly on a standars enemy but wont be 100% on if this is the way to go until i add a more complex enemy and start making a proper test level with lighting
Be careful with scaling. It will/can screw with movement.
Mesh merge is actually pretty performant. Fortnite uses it for character cosmetics. If I’m remembering correctly.
You can do nubs etc, just a lot more modular pieces. Thus why I said you need to whiteboard each character. Whiteboarding is simply mapping it out in detail. Full scope, think through everything before you start generating your modules.
So i think i have a solid solution. Each enemy has a limb array with each element set to 0, coorisponding to an intact limb, when one is dismembered the array element is switched to 1, and spawns a dismembered ragdoll limb at the appropriate position.
When an enemy is spawned or dismembered it reads its limb array to
Choose what models to use, and then is merged together.
Every limb needs 3 model states, nub, intact and loose. I like this versus the array containing all possible limb states as anything more than a human quickly would become unmanageable, and i can also use the limb array to drive anomation state switching, by either defining a certain element or array state.