Ragdolls & fun with motion controllers

Hi all,

Ever wanted good interaction of your character with the environment or other characters, e.g. running into walls, dropping off cliffs or being tackled… Well I do and I figured that pre-animated characters will never succeed at this so I started animating ragdolls, which resulted in this system I share here.

The ragdoll control scheme is best compared with a marionette. Invisible forces push & pull the ragdoll limbs around to follow invisible controller/driver objects. These objects are moved around using python scripts. Walking around covers a large part of the scripting since it includes obstacle detection and where best to place the feet, e.g. walking up stairs.

My ultimate goal is to make a sword-fighting game with realistic attacks, parries and counter-attacks. I also want to make the system general so that if it all really works I can build a complete adventure around it with pit-traps, rope swinging and all… (just day-dreaming for now ;)).

So below is the current status, then some tips and tricks and also a progress overview since the first outlines of the system in my fencing game.

Current status
Knight_update17_6_2012.blend (7.29 MB)
Improved the movement system :slight_smile:
-Synchronized head orientation with movement
-Improved combat strafing
-Added running. Leaning into corners really looks nice, starting and stopping needs more work to get perfect.
-And FOOTSTEP SOUNDS are back :cool: (did not pack them however… :evilgrin:)

Basics: Numpad (movement) & arrow keys (looking) or 2 axis gamepad
Change movement mode: left alt
Running or lunge: left shift
Sword poses: numbers 1 trough 7
Cameras: F1 - F8

Spawn TAB
zombie pose O
drop items F
drop dead hold space
crouch left control
Target AI L
Stand up B

Tips & Tricks
Games are about faking so it looks real (just like my marionette system is not build around muscles)
-Increasing the mass of the hands & feet will give them more control/stability
-Add an additional force upon impact with anything if the response is not strong enough
-Do not think you get rid of pre-defined animations (but definitely with more freedom/interaction). Each walk cycle, evasion, jump or other action needs to be programmed, it is not that your ragdoll gets smart and knows on its own how to react on any event. If I implement the system correctly however each action will only need to be programmed once and can then be copied for other characters with little tuning :wink:
-Do not try to lift 20-40 kg (maybe this is no problem for you), the ragdoll is not tuned for this (hard to have a large stable control region), and such heavy objects will never make effective weapons to swing around

For tuning tips on the ragdolls you have 4 parameters in the ragdoll_init.py script, just play around with different settings to get a feel of what does what :stuck_out_tongue:
-First I determine a target speed for my limb. This speed is proportional (v_prop) to the distance between limb and controller/driver. So the target speed also slows down before you are in position, this is very important for stability. The target speed is capped at a set maximum (v_max).
-Secondly the force is calculated. This is proportional (f_prop) to the difference in the current limb velocity and the target velocity. The force is also capped at a maximum (f_max).
Same goes for rotation. And a mayor part is off course placing and moving the controllers/drivers around.

If you want to apply this setup to your own character:
-Use a scale of 1 Blender Unit is 10 cm, make sure you increase the gravity and soundspeed by a factor 10 in the world and scene panels. My experience is that Blender does not have accurate collisions for objects smaller than ~0.1 BU.
-USE BRIK, it is easy and takes the pain out of creating rigged ragdolls. I build the whole setup for spawning ragdolls around the BRIK add-on, no way to go without it. BRIK addon files including my patch

Progress overview
9 April 2012: Ragdoll abuse with traps
Works best in 2.61 (camera tracking was weird in 2.62, and also 1 matrix calculation was inverted/needs a minus sign)
.blend file
-Removed the flapping shoulders & toes
-A bit more stable movement
-Simple AI followers
-Updated movement control
-More stabilized head camera
-Some fun with traps :evilgrin:

28 Januari 2012: Ragdoll spawning
Just combined my set-up with the BRIK add-on to get spawning of ragdoll group working. Also works for linking :wink:

15 October 2011: General update… feature overview

19 June 2011: Some first tuning results in the 2.5 series

20 November 2010: Last 2.49b update: rope swinging

2.49b blend file

Forward W
Back X
Stop S
Strafe left Z
Strage right C
Strange mix E
Crouch toggle Left Ctrl
Turn left A
Turn right D
Run Q
Jump (while running) Left Shift

Grab M
Aim J
Drop U
Shoot Space

Sword poses numbers 1 through 7
Camera F1 through F8
Grab rope K
Ragdoll fun Numpad 4, 6, 2 and 8
Get up from ground B

11 August 2010: boxy ragdolls (not yet rigged and skinnen with armature)

1 March 2010: Last real update on my Fencing game. With this game I realized that the the core of the game will be its biggest limit, so from here I started working on a universal ragdoll system :cool:

And how I started this as my first blender project :smiley:

i like it good work

The very first steps of a great Ragdoll system. Congratulations, it seems quite solid, only not usable as of yet, of course. Aim for easy implementation (no specific object orientated) from the start.
Add multipede control on your next to-do-list.
Keep up the great work.

whoe thats awesome very natural looking. I really look forward to seeing this finish up.

Great ragdoll system! But that’s alot of math, I guess your are a programmer.I hope you make it flexible enough for us, to modify it easily.

Woah! That’s awesome! I’ve been aiming to do something like this since I first got my hands on blender! XD

IT’S AWESOME! Add running and jumping and you’re my personal hero XD

that’s pretty cool, the rag doll makes nice natural movements, that’s nice, good job :slight_smile:

Looking at the amount of work… There’s nothing that I can say but WOW… AWESOME!
Can’t wait whats next! Maybe the rag trying to jump or trying to re balance himself after falling down and trying to land properly…

Thanks for the comment, I made a small update so now you can stop (S) and move again (W). Removed a bug but there are still a few left.

@Torakunsama: What kind of multipedes are you looking for. Horses, dogs, frogs, rabits, centipedes :spin:. I think for a simple step by step animation my script can be a good starting point but the main challenge is that you need different ragdoll setups for about anything I can think of.

And I will try to make the setup as clear as possible. Animating ragdolls just requires programming but I hope to get to the point that you can just fill in the step size, direction etc. and that you can leave the rest to sort itself out.

@haidme: Most of the math just checks if the next position for the foot is a free position on solid ground. I shoot several rays to check this but once it works you don’t need to worry about it.

And I will have to see if I get around to jumping (It is a bit more complex of an action). And after that I can worry about hitting the ground again, it is simple if you land badly because there is one thing that ragdolls do best, falling down!!! :smiley:

Thanks for share, wen you finish, it ll be the best lokomotion system create for bge so far, thanks.
I hope you succed!

Great! :smiley:

I’m guessing the most used will be Quadropods and Octopods <- Is that even a legit word?

Most animals come into the first category sheep, dogs, horses, cats, wolves, all of that. Then there are the insects, although I’m starting to wonder do they have six legs and two arms?

Sounds awesome! :smiley:

Agreed, however… once you get that to work, people will make the ragdoll suffer… You know that right? :stuck_out_tongue: Here have an :RocknRoll: because this, this is awesome.

Runs away to get the latest version

EDIT: Awww… I get an instant crash with the new file. :confused:

Made a new update:

  • arms swing along
  • some first tests with running, but I found out I need to change the setup a bit for running and jumping (store more parameters somewhere)

Agreed, however… once you get that to work, people will make the ragdoll suffer… You know that right? :stuck_out_tongue:

It is a good thing that I am not in a more rights for ragdolls commity :smiley:

EDIT: Awww… I get an instant crash with the new file. :confused:

Do you have some more info about the crash? Any command prompt errors? OS? When does it crash (at blender startup or at the start of the game)? And please try if the new update does the same.

I could not help myself, I added a Big Gun :evilgrin:

see first post

Walking is getting better, no more stumbling over its own feet. Running still has some work to go.



:o, another example of ragdoll abuse…

By the way it starts to get more fun if you increase the cannonball weight in the last layer to at least 50 to have more impact. (I have yet to make the ragdolls collapse upon impact)

Do you have some more info about the crash? Any command prompt errors? OS? When does it crash (at blender startup or at the start of the game)? And please try if the new update does the same.

It just crashes instantly, no warning, nothing in the console. I’m running on Windows 7 64-bit I’m guessing that’s the problem XD

I just tried it here on a Windows 7 64-bit computer and it runs fine, so I am at a loss as to what causes the problem :spin:. Maybe try the latest build of blender 2.49b, sorry I can’t help you any further.

This is great
very good work, im guessing that scripting was a pain but the results turned out perfect :slight_smile:

Cool, but you can do to blender 2.5?

This is awesome!!
great work.


This one gave me the idea, why not give him an baseball bat to :smiley: