About Store Forum Documentation Contact
Donations:
197$/mo



Post Reply 
About ragdolls
Author Message
Xerios Offline
Member

Post: #1
About ragdolls
I haven't really worked with engines before, neither am I a pro in c++
but from the start of my game making obsession I've always optimized my games to the maximum
whether it was c# , java , actionscript or even blitz3D ( basic language ) there was always a way.
What makes me happy is the speed, the less CPU or memory it uses the better =)

So let me start with the ragdolls, I've noticed that it can get pretty nasty after you have a whole bunch of them
especially in the Bloody Massacre demo.

[Image: 9pxb8n.jpg]

What you see there is a pile of bodies, now the problem is that those guys are still moving,
well not really moving but jiggling which is kind of creepy. makes me think that they'll come back to life or something.
I've also noticed some other problems I noticed once I have another ten or twenty bodies in
that same place the fps starts to decrease dramatically and even exponentially, it was kind of weird seeing
the fps drop from 60 to 10 after few kills, I also noticed that those bodies stayed active even if they were out of
the user's field of view.

Of course there are ways to prevent those stuff from happening, like making the ragdoll sleep after several seconds
after the it's parent's death, like for example npc dies , ragdoll gets activated and after several seconds it sets sleep(true)
Before posting I tried testing it out in the Blood Massacre Demo, everything ran better than I expected with a simple code such as :
Code:
if (time_after_death>50) ragdoll.sleep(true); else time_after_death++;
I honestly didn't expect for the bodies to wake up when they got in contact with another body grin
I managed to improve the game performance , fps stayed constant and the bodies didn't jiggle no more.
Later I tried making a pile of bodies to test it out the result was slow at first like last time but then after some time they all became inactive and everything got faster.

Now the problem, the reason why a body jiggles when you have to bodies one over another is because one ragdoll
pushes another which later pushes the one who pushed it which can kind of result in an infinite loop.

Imagine two ragdolls perfectly aligned over each other are dropped on a terrain, the result will be :
Ragdoll 1 who's under ragdoll 2 will touch the ground then it bounces a little off and pushes ragdoll 2 a bit up
then cause ragdoll 2 still hasn't touched the ground it will drop onto ragdoll 1 pushing it down, then since
ragdoll 1 obviously can't go though the floor, it will push itself up, pushing radoll 2 up again, and then everything repeats.

Now the solution, I thought only about one solution, it's a really simple one
making the ragdoll unable to push other ragdolls, it could be an option in the ragdoll class
that you can set on and off it'll come really handy in many situations.

I'd feel really stupid for writing all of this if there's already a way to do that smile
07-23-2009 03:32 AM
Find all posts by this user Quote this message in a reply
Xerios Offline
Member

Post: #2
Re: About ragdolls
I guess this is a "too long didn't read" case :(
07-25-2009 02:53 AM
Find all posts by this user Quote this message in a reply
sydbod Offline
Member

Post: #3
Re: About ragdolls
Xerios Wrote:I guess this is a "too long didn't read" case :(

Not the case at all. smile
I am sure many have taken note and filed your comments in the back of their minds, to be used at some later date, even if they did not post.
In my case it has made me think a little more about how to deactivate update routines that would be wasting processing power for aircraft that are sitting stationary on the ground.

The English section of this forum is the smallest section, and any useful info is always welcome (at lest I welcome it), as one never knows to whom it may be beneficial (directly or indirectly).

It is just a shame we do not have a code snippet forum section where this sort of information could be archived in a common area.
07-25-2009 03:49 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
Re: About ragdolls
you can try increasing the damping and adamping of the ragdoll actors.
or play around with different material settings for the ragdoll actors (like with decreased bounciness)

This is more a PhysX issue so you can try asking for help also here <!-- m --><a class="postlink" href="http://developer.nvidia.com/forums/index.php?showforum=16">http://developer.nvidia.com/forums/inde ... owforum=16</a><!-- m -->
07-25-2009 10:19 AM
Find all posts by this user Quote this message in a reply
Post Reply