Page 1 of 2

[Prototype] Rope Physics

Posted: Sun Jan 13, 2013 1:21 pm
by micha
Dear Community,

for a game idea I experimented with rope physics. This is my first prototype.
It is chain of infinitely stiff springs. Implementation is via verlet integration with iteration over the length constraints. I found the idea here: http://www.xtremevbtalk.com/showthread.php?t=224429.

First I wanted to implement a rope as in Worms2 and Fury of the Furries. But these seem to look unrealistic in the sense that you can push (!) yourself upwards with ropes (as if they are metal bars).

Control with arrow keys: Left/Right makes you swing, up/down changes rope length.

What do you think?

Edit: I added a new version, with slightly different physical implementation.
Edit2: Added Version 3.
New features: Collision with a circle, and the ropes fixed point can be moved with wasd.

Re: [Prototype] Rope Physics

Posted: Sun Jan 13, 2013 1:42 pm
by Darky
It's awesome !
Image

PS : i've got some weird movement on my old computer (still get 300 fps but when I hit left, right, down or up, the rope goes crazy..)

Re: [Prototype] Rope Physics

Posted: Sun Jan 13, 2013 6:29 pm
by Ref
Darky wrote:It's awesome !
PS : i've got some weird movement on my old computer (still get 300 fps but when I hit left, right, down or up, the rope goes crazy..)
Dynamics are very dependent on 'dt' being provided resulting in system specific results.
Just adding a print statement causes 'dt' to change and rope movement to go out of control on my computer.
Found setting 'dt' to 0.003 and damp to 0.999 gave more predictable results on my system.

Re: [Prototype] Rope Physics

Posted: Sun Jan 13, 2013 6:37 pm
by micha
Ref wrote:
Darky wrote:It's awesome !
PS : i've got some weird movement on my old computer (still get 300 fps but when I hit left, right, down or up, the rope goes crazy..)
Dynamics are very dependent on 'dt' being provided resulting in system specific results.
Just adding a print statement causes 'dt' to change and rope movement to go out of control on my computer.
Found setting 'dt' to 0.003 and damp to 0.999 gave more predictable results on my system.
Thanks. Thats valuable feedback.

I figured, some parts of my code don't use dt properly. I will correct that.

Re: [Prototype] Rope Physics

Posted: Thu Jan 17, 2013 6:42 am
by verilog
This is very nice, micha, excellent work!
I did a quick test and didn't get any weird rope behaviour while swinging with the left and right keys.

The overall effect it is pretty cool, nice rope physics.

Keep it up!

Re: [Prototype] Rope Physics

Posted: Fri Jan 18, 2013 2:18 am
by norubal
it's cute :awesome:

Re: [Prototype] Rope Physics

Posted: Mon Jan 21, 2013 10:36 pm
by micha
Dear community,

I added a new file in the original post. I implemented the physics a bit different. They are supposed to represent real physics more closely.
Also the dt hopefully is not implemented consistently.

I also added a floor.

Do you still get unexpected rope behaviour?

Re: [Prototype] Rope Physics

Posted: Mon Jan 21, 2013 10:59 pm
by Nixola
The first time I opened it, I got no rope. Once I opened it again it was there though, it's as good as the first one here

Re: [Prototype] Rope Physics

Posted: Tue Jan 22, 2013 1:05 am
by Clouds
micha wrote:Fury of the Furries
Ahhh! Someone else who knows that game. It's still one of my favorites of all time (although I first owned its licensed clone, Pac-in-Time.) My best wishes to you. :awesome:

The rope2 sim appears to work well, although the smiley seems to have stronger swinging force the longer the rope is. Also, the rope gets quite coarse and jacob's-ladder-esque when it gets long - is it possible (or practical) to have a dynamic, semi-proportional number of segments?

Re: [Prototype] Rope Physics

Posted: Tue Jan 22, 2013 4:47 am
by xXxMoNkEyMaNxXx
I agree with Clouds on the point that the rope should have more segments the longer it is.