Jump to content

  • Log In with Google      Sign In   
  • Create Account


Creating "Chains" of objects with smooth motion.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 kburkhart84   Members   -  Reputation: 1596

Like
0Likes
Like

Posted 12 November 2012 - 07:48 PM

I'm making a game with Game Maker(Studio), but I understand C/C++ so that won't be a problem.

I'm looking at creating a bit of variety. Simple chains that follow a path are pretty easy, but what about chains that are more "wild." It seems like they are partly IK chain based, but I'm not so sure, considering that I don't think older platforms had enough power to really do IK with this many "links/bones" as these games have. So it seems to me that in general this should not be too difficult to do. I'm pretty sure it wasn't done pre-drawn, also considering the limited space constraints of these old platforms. I have found a few videos so you can see what I'm talking about.
http://www.youtube.com/watch?v=BUoAVtYn6GQ at time 1:54. The guy talking is pretty stupid sounding, but it is a good example, which is the scorpion boss from Legend of Zelda: A Link To The Past(SNES) You can see the scorpion tail is "wagging" for the most part, but then gets shot out towards link.
http://www.youtube.c...?v=NcXuvqwIztc is the final boss to the SNES game BioMetal( a really difficult Shooter). You can see the "arm" chain thing at the bottom that moves around pretty fluid and random, and doesn't appear to follow a given path, or be constrained to an IK chain type thing either.
There are other examples, including bosses from the Contra series of games.
So, does anyone have any insight how to create this effect. I'm sure the ones where the chain objects simply follow the leader is easy, as you can simply have each one follow the next one in line, but how about the fluid circular motion, etc...?

Thanks in advance for the help.



Sponsor:

#2 JTippetts   Moderators   -  Reputation: 8259

Like
0Likes
Like

Posted 12 November 2012 - 10:59 PM

I don't know much about GameMaker, but if it has a physics module you can model something like that as a chain of hinge joints, with angular constraints on the hinges to keep the chain from folding up. (Remove the constraints to provide a movement mode like in the second video, when the chain sort of collapses in on itself). Lightweight 2d physics libraries such as Box2D make this sort of thing relatively easy.

#3 Endurion   Crossbones+   -  Reputation: 3415

Like
0Likes
Like

Posted 12 November 2012 - 11:53 PM

I doubt there's anything remote resembling physics in there.

Looks more like some kind of Bezier in the Zelda screen shot.

In the second it looks like delta offsets are passed up the chain. The start of the tail seems to only turn clockwise or counter clock wise and those movements chain along to the outside. When the arm lashes out to the top left it looks like a scintillating series of cw/ccw turns.
Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

#4 kburkhart84   Members   -  Reputation: 1596

Like
0Likes
Like

Posted 13 November 2012 - 05:06 PM

I don't know much about GameMaker, but if it has a physics module you can model something like that as a chain of hinge joints, with angular constraints on the hinges to keep the chain from folding up. (Remove the constraints to provide a movement mode like in the second video, when the chain sort of collapses in on itself). Lightweight 2d physics libraries such as Box2D make this sort of thing relatively easy.


I actually have to agree with the quote below. I seriously doubt any of this is physics related, although GM Studio does now include Box2D physics.

I doubt there's anything remote resembling physics in there.

Looks more like some kind of Bezier in the Zelda screen shot.

In the second it looks like delta offsets are passed up the chain. The start of the tail seems to only turn clockwise or counter clock wise and those movements chain along to the outside. When the arm lashes out to the top left it looks like a scintillating series of cw/ccw turns.


So how do you think they did those in the original console systems? I'm wondering if the SNES even had the processing power to handle bezier curves.



#5 Yrjö P.   Crossbones+   -  Reputation: 1412

Like
0Likes
Like

Posted 13 November 2012 - 06:36 PM

So how do you think they did those in the original console systems? I'm wondering if the SNES even had the processing power to handle bezier curves.

A wristwatch should have the processing power to handle Bezier curves.

That said, they don't need Bezier curves to get that Zelda tail. Like Endyrion said, it could be a simple transform getting re-applied on top of itself to produce the next point on the tail. If a constant transform doesn't quite give them what they want, they might also be slightly nudging the transform between applying it. Neither the initial transform or the nudges need not be rigorously correct, just cheap and good enough.

#6 kburkhart84   Members   -  Reputation: 1596

Like
0Likes
Like

Posted 13 November 2012 - 07:04 PM

OK, I see how the transforms would work, and I'm pretty sure I can apply it to GM's gml scripting with no problems. Now, I doubt that the randomness of the second tail was done with simple transforms. In fact, it at times "scrunches" into itself, it does a "whip-like" motion creating a wave, and it sometimes extends trying to hit the ship. Does anyone have any clue how that part could be done?



#7 JTippetts   Moderators   -  Reputation: 8259

Like
1Likes
Like

Posted 13 November 2012 - 10:12 PM

Correct, the posted videos probably weren't using physics systems. However, in today's world, 2D physics libraries are an extremely cheap drop-in solution, and you can get such a thing up and running literally in moments. I did a small test using Love2D and Box2D, and got a chain swirling around very much like the one in the second video in about 15 minutes. I can post the code, if you like; it's dead simple. The hard work is done by the physics library, all I had to do was tweak a few parameters.

That being said, you could probably also achieve a similar effect by using "canned" animations, by pre-computing animation tracks for each ball in the chain for a particular movement, especially for the Zelda boss, since there isn't the wavy variation that the second one has. I suspect the second one might be canned, too, since those bullet-hell games tended to be pretty tightly timed and patterned.

Edited by JTippetts, 13 November 2012 - 10:18 PM.


#8 kburkhart84   Members   -  Reputation: 1596

Like
1Likes
Like

Posted 13 November 2012 - 10:48 PM

I actually just posted something like the "canned" things you are talking about on the GMC(game maker community). Since GM has a path system, and easy functions to calculate positions on those paths(between 0 and 1) similar to lerping along the path, I can take advantage of that. I'm thinking I create multiple paths, like for example the tail for the scorpion have a path for left and one for right. Each point of the chain would be at a certain position of paths(0, 0.1, 0.2, of there are 10 chain links) and then I can simply have the links lerp to the respective positions between paths. I can also apply something similar to the biometal one by having some paths that are more "weird" than simple curves, and then lerping points between them. Lastly, the path system lets you create paths at runtime, with different parameters, so for example it is easy to make paths like bezier curves instead of linear paths, so I could even make random paths for the chain links to lerp between.

So far, this seems like it is going to be the best solution. In fact, now that I'm thinking more about it, I may be able to come up with a sort of "cheap IK chain" using these same paths...We'll see.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS