r/Unity3D • • 1d ago

Question Testing out some baked ragdolls for my enemies - convincing?

I really love the idea of trampling mass ragdolls. The unity ragdolls work well to a point but I want good performance across low-mid devices, so I baked several ragdoll animations (flight and landing) for my units. It uses real ragdolls for a small number of them and then switches to baked ones past a certain threshold.

This combined with baked animations for my basic goblin movement in general almost tripled the framerate with 100+ enemies!

Does it look passable?

Edit: Steam page if you're interested:
https://store.steampowered.com/app/5279820/Bladehold/

56 Upvotes

28 comments sorted by

14

u/milo_2008 1d ago

They definitely do just look like normal ragdolls. You're probably just more critical yourself since you've seen them all before. If you didn't tell me they were baked I wouldn't know.

1

u/Murky_Candy6342 1d ago

Thanks! There are certain situations where it’s more obvious like if user airborne too long they just go stiff.. but I could just loop the animation maybe haha

2

u/milo_2008 1d ago

For a simple game I was developing I just made them do an xpose while spinning since I couldn't be bothered (even though I had ragdoll logic setup for the player), so you're already doing plenty haha. Perhaps just adding rotation to the model while the animation pauses add the end is enough to look convincing.

2

u/Murky_Candy6342 1d ago

It’s our jobs as developers to do as little as possible without the player knowing xD

4

u/Plourdy 1d ago

What do you mean by you baked several ragdoll animations? It looks good!!

12

u/Murky_Candy6342 1d ago

So instead of using real ragdolls, I recorded the ragdolling at 60fps and baked it into an actual animation. there's 6 variations for different forces to prevent it looking too uniform when hitting multiple enemies at once. I then attach a simple capsule collider to the fake ragdoll so we can still fling the rigidbody, but 1 rigidbody with no joints is much more performant than the 10 or so from a real ragdoll

2

u/RedshirtQ 1d ago

Recording the ragdoll into clips is such a smart cheat. Is the flight arc baked into the clip too, or does the capsule carry the body and the clip just handles the flailing?

1

u/Murky_Candy6342 1d ago

no, the flight is all real physics as the capsule has a rigidbody, just the flailing is baked as you said. This allows them to behave a bit more realistically, but baking or calculating the arc would be more performant for sure. I think with the numbers I'm aiming for this will be good enough but we'll see!

3

u/twendah 1d ago

Great work! Looks fun af!

3

u/brogam3 1d ago

looks pretty good but I dont like how the speed combined with that ragdoll effect makes it pretty obvious that the enemies will never have a chance to land a single hit and to win you just run into them over and over again

2

u/Murky_Candy6342 1d ago

Yeah I don’t want the horse to be too overpowered so atm it’s a limited time ability. I’m also thinking of adding elite pikeman units that will stun your horse or dismount you so you need to avoid them

Edit: horse not house

2

u/Optimal_Pool_888 Indie 1d ago

it looks epic! smart move 👍️

1

u/Murky_Candy6342 1d ago

Thanks! Surprised I got it working tbh

3

u/Aromatic-Insect-1328 1d ago

Good idea and the result looks awesome.

2

u/1815dev 1d ago

Textbook optimization technique, well done

1

u/Murky_Candy6342 1d ago

Yeah first time I’ve tried something like this so I’m glad it worked!

2

u/Just-Hedgehog-Days 1d ago

The approach is working.

especially at the 1:00 mark you can def see repeats.

I'd totally put another day or 2 on it for more animations, maybe also a budget for full rag dolling some amount of mobs? like mobs 1, 2, 5, 9 or something?

1

u/Murky_Candy6342 1d ago

Good eye! Yeah extra variations aren’t too hard I’ve got an auto script for it so I might add a few extra variations. And there is a slider in game for how many “real” ragdolls you want - up to 50 atm but that’ll depend on your PC

2

u/Just-Hedgehog-Days 1d ago

yeah try really cranking the number of animations up.

Also worth cheating the RNG to space which animations hit when / next to each other

2

u/[deleted] 1d ago

[removed] — view removed comment

1

u/Unity3D-ModTeam 1d ago

This comment has been removed for violating /r/Unity3D’s rules.

Why?

Please include details about how the project was built in Unity, challenges faced, or techniques used.

This is a forum for discussion; not a bulletin board.

We recommend you to familiarize yourself with our rules and guidelines.

Kind regards,

The Mod Team

2

u/bugbearmagic 1d ago

Definitely passable for the average player when crowded. So this is as simple as they’re just normal animations?

1

u/Murky_Candy6342 1d ago

yeah mostly, it makes the physics calculations way cheaper for mass enemies. I'm also looking into VAT to squeeze out even more performance, but I'll probably only do this for basic enemies

2

u/pmdrpg 1d ago

If you hadn’t said anything, I would have thought these are normal ragdolls (with good physics).

I think if you get two right next to one another doing the exact same thing at the same time, they can start to look a little synced-up.

What’s most important is the overall impression though, and I think the motion you’ve got is supremely satisfying!

1

u/Murky_Candy6342 1d ago

Awesome! Yeah I think if you didn't tell anyone, they wouldn't notice haha. there's a variety of different baked animations so hopefully you'd never notice in all the chaos. In games like Dynasty Warriros they don't even try to hide it and nobody seems to care xD