[Prototype] Rope Physics

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

[Prototype] Rope Physics

Post by micha » Sun Jan 13, 2013 1:21 pm

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.
Attachments
rope3.love
Version 3
(2.37 KiB) Downloaded 272 times
rope2.love
Version 2 of happy smiley on a rope.
(2.13 KiB) Downloaded 116 times
rope.love
Happy smiley swinging on a rope
(1.5 KiB) Downloaded 228 times
Last edited by micha on Tue Jan 22, 2013 6:19 pm, edited 2 times in total.

User avatar
Darky
Citizen
Posts: 65
Joined: Sat Jun 02, 2012 1:41 pm
Contact:

Re: [Prototype] Rope Physics

Post by Darky » Sun Jan 13, 2013 1:42 pm

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..)
http://darky-ben.fr/Xut my webcomic (french)

User avatar
Ref
Party member
Posts: 677
Joined: Wed May 02, 2012 11:05 pm

Re: [Prototype] Rope Physics

Post by Ref » Sun Jan 13, 2013 6:29 pm

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.

User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: [Prototype] Rope Physics

Post by micha » Sun Jan 13, 2013 6:37 pm

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.

User avatar
verilog
Citizen
Posts: 97
Joined: Thu Nov 03, 2011 3:15 am
Contact:

Re: [Prototype] Rope Physics

Post by verilog » Thu Jan 17, 2013 6:42 am

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!

User avatar
norubal
Party member
Posts: 122
Joined: Tue Jan 15, 2013 5:55 am

Re: [Prototype] Rope Physics

Post by norubal » Fri Jan 18, 2013 2:18 am

it's cute :awesome:

User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: [Prototype] Rope Physics

Post by micha » Mon Jan 21, 2013 10:36 pm

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?

User avatar
Nixola
Inner party member
Posts: 1940
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: [Prototype] Rope Physics

Post by Nixola » Mon Jan 21, 2013 10:59 pm

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
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics

Clouds
Prole
Posts: 23
Joined: Tue Nov 27, 2012 4:06 am

Re: [Prototype] Rope Physics

Post by Clouds » Tue Jan 22, 2013 1:05 am

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?

User avatar
xXxMoNkEyMaNxXx
Party member
Posts: 206
Joined: Thu Jan 10, 2013 6:16 am
Location: Canada

Re: [Prototype] Rope Physics

Post by xXxMoNkEyMaNxXx » Tue Jan 22, 2013 4:47 am

I agree with Clouds on the point that the rope should have more segments the longer it is.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 201 guests