Swinging ropes in games

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
Ralf
Rick Dangerous
Posts: 2279
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Swinging ropes in games

Post by Ralf »

Maybe we could talk more about programming tricks :)

So some games have swinging ropes forth and back like here:

Image

On Spectrum the obvious example is Jet Set Willy engine:

Image

So how do you implement such rope in your code? Is it a complicated stuff involving math, sines and cosines or is there some trick to do it in a simple way?

I suppose the lame way is to make the rope a straight line but it seems that most game do better than that.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Swinging ropes in games

Post by Nomad »

To be honest I never think of that till now but I agree it must be a difficult thing to implement even a regular repeating arc movement.

I guess the follow up question would be, could the rope movement have an irregular arc, deformation?
User avatar
Sokurah
Manic Miner
Posts: 283
Joined: Tue Nov 14, 2017 10:38 am
Contact:

Re: Swinging ropes in games

Post by Sokurah »

Here's how it was done in Jet Set Willy;

http://www.oocities.org/andrewbroad/spe ... #jsw-ropes
Website: Tardis Remakes / Mostly remakes of Arcade and ZX Spectrum games.
My games for the Spectrum: Dingo, The Speccies, The Speccies 2, Vallation & Sqij.
Twitter: Sokurah
User avatar
Morkin
Bugaboo
Posts: 3251
Joined: Mon Nov 13, 2017 8:50 am
Location: Bristol, UK

Re: Swinging ropes in games

Post by Morkin »

Ralf wrote: Wed Feb 14, 2018 9:37 am
I suppose the lame way is to make the rope a straight line but it seems that most game do better than that.
Ah yeah, Hunchback did that didn't it?

Of course there's always Juan's favourite, Jungle Fever... :lol:
My Speccy site: thirdharmoniser.com
User avatar
MatGubbins
Dynamite Dan
Posts: 1238
Joined: Mon Nov 13, 2017 11:45 am
Location: Kent, UK

Re: Swinging ropes in games

Post by MatGubbins »

Jack The Nipper 2 - coconut capers- has a very nice rope to swing on
User avatar
Rorthron
Dynamite Dan
Posts: 1644
Joined: Sun Nov 12, 2017 10:35 pm

Re: Swinging ropes in games

Post by Rorthron »

Sokurah wrote: Wed Feb 14, 2018 11:09 am Here's how it was done in Jet Set Willy;

http://www.oocities.org/andrewbroad/spe ... #jsw-ropes
The JSW rope has a kink in it, so the movement isn't completely right.
User avatar
Sokurah
Manic Miner
Posts: 283
Joined: Tue Nov 14, 2017 10:38 am
Contact:

Re: Swinging ropes in games

Post by Sokurah »

Rorthron wrote: Wed Feb 14, 2018 12:03 pm The JSW rope has a kink in it, so the movement isn't completely right.
I wasn't suggesting you should copy the code - just look at how it was done and perhaps come up with a new similar way.
Website: Tardis Remakes / Mostly remakes of Arcade and ZX Spectrum games.
My games for the Spectrum: Dingo, The Speccies, The Speccies 2, Vallation & Sqij.
Twitter: Sokurah
User avatar
Juan F. Ramirez
Bugaboo
Posts: 5102
Joined: Tue Nov 14, 2017 6:55 am
Location: Málaga, Spain

Re: Swinging ropes in games

Post by Juan F. Ramirez »

Morkin wrote: Wed Feb 14, 2018 11:24 am
Of course there's always Juan's favourite, Jungle Fever... :lol:
Aaahh, Jungle Fever, memories!

Great game to reduce my self-steem! :mrgreen:
Ralf
Rick Dangerous
Posts: 2279
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: Swinging ropes in games

Post by Ralf »

Thanks for that link.

So Matthew Smith is using some precalculated table for the points makeing the rope. Actually I could guess it.
hikoki
Manic Miner
Posts: 576
Joined: Thu Nov 16, 2017 10:54 am

Re: Swinging ropes in games

Post by hikoki »

[youtube]https://youtu.be/3JcQ4IOl1OA[/youtube]

[youtube]https://youtu.be/xZEyLEEGS0Q[/youtube]
User avatar
Joefish
Rick Dangerous
Posts: 2042
Joined: Tue Nov 14, 2017 10:26 am

Re: Swinging ropes in games

Post by Joefish »

Ah, it's not the point positions. It's the offset from the point immediately above. So you start at the top point, then the next point is +0 horizontally, +6 downwards, and so on through the table until you've plotted enough points.

Then if you start a little bit later in the table, so a little offset sneaks in at the bottom, and that works its way up to the top until the whole chain of points is offset to one side or the other.

And since it's a table, a random bit of wobblyness can be added that appears to ripple up then back down the rope near the end of the swing.
User avatar
RMartins
Manic Miner
Posts: 776
Joined: Thu Nov 16, 2017 3:26 pm

Re: Swinging ropes in games

Post by RMartins »

A reference Lookup table would be the obvious choice, for performance concerns.
Jonathan
Drutt
Posts: 11
Joined: Sun Feb 18, 2018 6:55 pm
Contact:

Re: Swinging ropes in games

Post by Jonathan »

Egghead Goes to Town used a big table of coordinates for speed, all pre-calculated in Sinclair BASIC. It was quite expensive but seeing as the screens were very efficiently stored I figured it was affordable.
Not on Twitter, left the Spectrum scene on 4th December 2018. Thanks folks, it was a pleasure knowing you.
http://www.spanglefish.com/egghead/
http://arcadegamedesigner.proboards.com/
https://jonathan-cauldwell.itch.io/
User avatar
R-Tape
Site Admin
Posts: 6353
Joined: Thu Nov 09, 2017 11:46 am

Re: Swinging ropes in games

Post by R-Tape »

Jonathan wrote: Sun Feb 18, 2018 7:02 pm Egghead Goes to Town used a big table of coordinates for speed, all pre-calculated in Sinclair BASIC. It was quite expensive but seeing as the screens were very efficiently stored I figured it was affordable.
There's a flaw somewhere though, you've gone against Spectrum best practise by not having a rope with 75% unfair collision.
Ralf
Rick Dangerous
Posts: 2279
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: Swinging ropes in games

Post by Ralf »

Egghead Goes to Town used a big table of coordinates for speed, all pre-calculated in Sinclair BASIC
Wow, calculating data in Spectrum Basic in 2017 is certainly retro :)

Personally when I needed once some precalculated data for my game, I used Excel. Not very cool, I suppose ;)

By the way, welcome to the forums, Jonathan !
Post Reply