Ragdoll code A7 lite-c!

Posted By: Helghast

Ragdoll code A7 lite-c! - 05/25/09 17:19

Hello lovely people!

Once again I continued developing my [unlimited] ragdoll code (it's really an ongoing side-project that just cant loose my grip :P).

This time, i made the code as optimised as possible (it's ~250 lines of code :D), however, optimised here means code reusability smile I havent added in any physics removal or bone update limiter in... yet!

And again, this time, it does work with updating bones to physics objects! WOOOOT

credits for that goto:
darkinferno, for tipping me where to find the code.
XD1v0, for making the update code!

Right, now we got that over with, I present screenshots, a demo and the sourcecode!








DEMO: Ragdoll Demo v3.0 (A7 code) - 2.06MB

SOURCE: Ragdoll Demo v3.0 (A7 code) - 114KB

EDIT
CONTROLS;

left mouse click = spawn ragdoll
spacebar = add force to ragdoll(s)

/EDIT

I hope to see some cool projects with this laugh
again, credits are nice, but if you do, also credit the people that made this possible (see credits above).

If you love me so much you want to make a paypal donation, PM me :P hahahaa

everybody, enjoy!

regards,
Posted By: croman

Re: Ragdoll code A7 lite-c! - 05/25/09 17:25

awesome! smile
we'll use this for sure, thnx
Posted By: warkarma

Re: Ragdoll code A7 lite-c! - 05/25/09 17:29

Did you noticed that every characters left hand goes up and right hand always goes down ?
Overall very nice coding. smile

Its a long way for me to code something similar .... frown
Posted By: Helghast

Re: Ragdoll code A7 lite-c! - 05/25/09 17:33

Originally Posted By: warkarma
Did you noticed that every characters left hand goes up and right hand always goes down ?
Overall very nice coding. smile

Its a long way for me to code something similar .... frown


yes, yes I did XD it's just a setup thingy that went wrong :P
you can change that yourself by editing the setBoneLimit function smile

good luck wink

regards,
Posted By: Germanunkol

Re: Ragdoll code A7 lite-c! - 05/26/09 10:14

amazing. very well done laugh

What always bugs me about ragdolls is that they don't seem to lie entirely still, they keep on moving a little... that's not to bad in this demo though, nice coding!
Posted By: TechMuc

Re: Ragdoll code A7 lite-c! - 05/26/09 11:06

very nice, thank you.

I think a very important feature would be to automatically switch ragdoll of, if it's not longer needed (for performance issues). E.g. activate it while falling, deactivate it while lying.
That would also stop this slight "shaking" on the ground (even without any force as germanunkol mentioned).
Posted By: Helghast

Re: Ragdoll code A7 lite-c! - 05/26/09 11:23

Originally Posted By: TechMuc
very nice, thank you.

I think a very important feature would be to automatically switch ragdoll of, if it's not longer needed (for performance issues). E.g. activate it while falling, deactivate it while lying.
That would also stop this slight "shaking" on the ground (even without any force as germanunkol mentioned).


Let me quote myself:

Quote:
optimised here means code reusability smile I havent added in any physics removal or bone update limiter in... yet!


hehehee, it's true, i had that planned, as have it planned that bones rotations dont update every frame (as that's pretty heavy on CPU... XD).

thanks for the comments, keep them going wink

regards,
Posted By: the_clown

Re: Ragdoll code A7 lite-c! - 05/26/09 14:47

Very nice contribution, thanx! This will be very helpful!

EDIT: Whoa, it looks impressive with some nice explosions!
Posted By: Helghast

Re: Ragdoll code A7 lite-c! - 05/31/09 08:44

Originally Posted By: the_clown
Very nice contribution, thanx! This will be very helpful!

EDIT: Whoa, it looks impressive with some nice explosions!


Show us the goods laugh
I'd love to see some stuff people made with it! smile

regards,
Posted By: the_clown

Re: Ragdoll code A7 lite-c! - 06/01/09 13:17

I would, but there is nothing to see but the flying dolls... I coded some explosions, but without the actual effect, you know.
Thanx to darkinferno, who showed me how to code correct physics explosions...
Posted By: Cowabanga

Re: Ragdoll code A7 lite-c! - 06/01/09 13:46

yyyyyyyyyyyyyes! laugh Worked smoothed than before! Thanks Dennis! smile
Posted By: the_clown

Re: Ragdoll code A7 lite-c! - 06/01/09 14:05

Well, the only thing missing is the blending between biped character and ragdoll.
Posted By: sebbi91

Re: Ragdoll code A7 lite-c! - 06/01/09 14:33

Nice job!

But it's lite-c and i am using c-script!
^^
I am now writing it to c-Script.(try it ^^)
Damn o.O
It would take a little bit time but the code is important for me!

Thank you for your work!

^^
Posted By: PHeMoX

Re: Ragdoll code A7 lite-c! - 06/01/09 14:35

The only thing missing now is lots of 3dgs games using this code.

By the way, what's most impressive is that the bodies look like one smooth piece, but they are separate body parts, right?? Or do you use dummy parts to change bones within a solid body mesh?

Cheers and of course thanks for sharing!
Posted By: sebbi91

Re: Ragdoll code A7 lite-c! - 06/01/09 15:13

Can you help to translate this part to c- script?
Quote:

void updateBoneHinge(ENTITY* hingeEnt, STRING* bodyPart, ENTITY* actor) {
VECTOR temp_pos, temp_ang, temp_mov, temp_ang_1;

ENTITY* hingePointer = hingeEnt;
ENTITY* actorPointer = actor;
STRING* updatePart = bodyPart;

while(hingePointer) {
...

this is the part :
Quote:

ENTITY* hingePointer = hingeEnt;
ENTITY* actorPointer = actor;
STRING* updatePart = bodyPart;



could you help?
Posted By: croman

Re: Ragdoll code A7 lite-c! - 06/01/09 16:08

if i understood it correctly, that character you see is normal model using bones and there is several invisible, physics models that are moving and the bones only updates its positions according to those models. at least it was like that in previous version smile
Posted By: Shadow969

Re: Ragdoll code A7 lite-c! - 06/01/09 19:23

that's the way it's ment to be smile
haven't looked into the code yet, but it seems that the system is pretty stable, only drawback is a little 'jerky' movement, although fps is kept stable at 60
Posted By: Helghast

Re: Ragdoll code A7 lite-c! - 06/02/09 07:35

Originally Posted By: sebbi91
Nice job!

But it's lite-c and i am using c-script!
^^
I am now writing it to c-Script.(try it ^^)
Damn o.O
It would take a little bit time but the code is important for me!

Thank you for your work!

^^


There is actually already an A6 c-script version released previously. I'll upload it tonight again for you.
(If I dont forget that is XD)

Originally Posted By: PHeMoX
The only thing missing now is lots of 3dgs games using this code.

By the way, what's most impressive is that the bodies look like one smooth piece, but they are separate body parts, right?? Or do you use dummy parts to change bones within a solid body mesh?

Cheers and of course thanks for sharing!


Yes, that would be great, if lots of games use it :P atleast, that's why i uploaded it wink

and as cerberi_croman already said;
Originally Posted By: cerberi_croman
if i understood it correctly, that character you see is normal model using bones and there is several invisible, physics models that are moving and the bones only updates its positions according to those models. at least it was like that in previous version smile


That's exactly how it works smile

Originally Posted By: Shadow969
that's the way it's ment to be smile
haven't looked into the code yet, but it seems that the system is pretty stable, only drawback is a little 'jerky' movement, although fps is kept stable at 60


Yes, the jerkiness might occur when your CPU cant handle all the physics collisions in a single frame...
I'm still adding some code in that should make it slow down a lot less when this happens (turning off ragdolls also works when it crosses a certain limit :P).


Thanks for the feedback and nice words so far smile
Hope to see some tests soon wink hehehee
If anyone needs some help on this, dont hesitate to PM/mail me wink

regards,
Posted By: goanna

Re: Ragdoll code A7 lite-c! - 06/02/09 09:16

Originally Posted By: Germanunkol
amazing. very well done laugh

What always bugs me about ragdolls is that they don't seem to lie entirely still, they keep on moving a little... that's not to bad in this demo though, nice coding!

Every Valve (Designers of Half-Life2,Left-4-Dead) game I've played using ragdoll has the same issue. I've even seen models spin in solid brushes after dieing, quite commical actually. This ragdoll physics code is very close in comparison to Valve's. Nice work, immpressive stuff. I'll be using this code in my zombie shooter for sure.
Mirror:
http://fleshhead.com/mirrors/Ragdoll_A7_src.rar
Posted By: Helghast

Re: Ragdoll code A7 lite-c! - 06/02/09 10:07

Originally Posted By: the_clown
Well, the only thing missing is the blending between biped character and ragdoll.


oops, sorry I missed your post in the last reply :P
Yes, you are right, I had that in previously (A6 code).
I should be able to add that again smile
but I got some other optimisations I want to fix first.
then that's my prioroty... I might make a testdemo with it... who knows :P heheheee

Originally Posted By: goanna
Originally Posted By: Germanunkol
amazing. very well done laugh

What always bugs me about ragdolls is that they don't seem to lie entirely still, they keep on moving a little... that's not to bad in this demo though, nice coding!

Every Valve (Designers of Half-Life2,Left-4-Dead) game I've played using ragdoll has the same issue. I've even seen models spin in solid brushes after dieing, quite commical actually. This ragdoll physics code is very close in comparison to Valve's. Nice work, immpressive stuff. I'll be using this code in my zombie shooter for sure.
Mirror:
http://fleshhead.com/mirrors/Ragdoll_A7_src.rar


thanks for the kind words and the mirror wink and yes, it's a common issue, that's what happens with physics... (they have some randomness in it, you cant always tell what's gonna happen wink ).
But it can be reduced to a minimal, which is what i intend to do smile

regards,
Posted By: sebbi91

Re: Ragdoll code A7 lite-c! - 06/03/09 13:56

thank for your help helghast!
Iam sure i will use the the A6 code because i dont understand lite c in this moment ^^!
Posted By: sebbi91

Re: Ragdoll code A7 lite-c! - 06/05/09 17:09

could you upload it please ?
Posted By: Helghast

Re: Ragdoll code A7 lite-c! - 06/05/09 20:20

Originally Posted By: sebbi91
could you upload it please ?


Sorry! forgot XD

anyway, now I did, and here it is:

A6 Ragdoll sourcecode

Keep in mind though, this is the old script, not updated with the code included in the new one... still works though wink

regards,
Posted By: sebbi91

Re: Ragdoll code A7 lite-c! - 06/06/09 10:28

works but its not the bone ragdoll ^^
It's the old version, you created a time ago!

But still thanks for it ^^


if you could translate this part to c-script it would be helpfully for me too:

Quote:

...

void updateBoneHinge(ENTITY* hingeEnt, STRING* bodyPart, ENTITY* actor) {
VECTOR temp_pos, temp_ang, temp_mov, temp_ang_1;

ENTITY* hingePointer = hingeEnt;
ENTITY* actorPointer = actor;
STRING* updatePart = bodyPart;

...



hope you could help me !

Thanks again!

with best wishes
BasTi
Posted By: Helghast

Re: Ragdoll code A7 lite-c! - 06/07/09 16:09

Originally Posted By: sebbi91
works but its not the bone ragdoll ^^
It's the old version, you created a time ago!

But still thanks for it ^^


if you could translate this part to c-script it would be helpfully for me too:

Quote:

...

void updateBoneHinge(ENTITY* hingeEnt, STRING* bodyPart, ENTITY* actor) {
VECTOR temp_pos, temp_ang, temp_mov, temp_ang_1;

ENTITY* hingePointer = hingeEnt;
ENTITY* actorPointer = actor;
STRING* updatePart = bodyPart;

...



hope you could help me !

Thanks again!

with best wishes
BasTi


the old version IS the bone ragdoll... never gotten it working under A7 before(but did under A6).

the new A7 code though cant be converted to A6 that easily... cant create local pointers etc etc.

But you could convert what you have already to Lite-c Free, the code *i think* works fine under that smile

regards,
Posted By: Hummel

Re: Ragdoll code A7 lite-c! - 06/12/09 18:23

How can I activate the physic for a ragdoll of an arbitrary angle (currently it works only with a pan of 180°)?
Posted By: Helghast

Re: Ragdoll code A7 lite-c! - 06/14/09 13:30

heheheee, you should create the ragdoll and proper hinges on the 180 degree scale, and then rotate/move it to match the actor. that's how i always did it.

regards,
Posted By: the_clown

Re: Ragdoll code A7 lite-c! - 06/14/09 13:40

AH! Post-rotating!!! I always thought about how to...
That's the clue, thanx Helghast!!
Posted By: Hummel

Re: Ragdoll code A7 lite-c! - 06/14/09 14:45

@Helgast:
I tried it this way, but the ragdoll flips back after one frame. Even if I deactivate the physics through phent_enable( ent, 0 ); before I rotate (and move) the ragdoll frown
Could you please show me a little example how to do it?

EDIT: now it works! o.O -however thx!
Posted By: Hummel

Re: Ragdoll code A7 lite-c! - 06/15/09 19:01

Has someone already written a piece of code, which adds the physics objekts "bone angle adjusting" (f.e. based on the current animation of the ragdoll) and which fits to the code from Helghast? I would be realy gratefull, if someone could post something similar here...
© 2024 lite-C Forums