Creating "Chains" of objects with smooth motion.

Started by
6 comments, last by kburkhart84 11 years, 5 months ago
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.
[media]
[/media] 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.
[media]http://www.youtube.c...?v=NcXuvqwIztc[/media] 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.


Advertisement
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 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>


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.



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.
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?


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.
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.


This topic is closed to new replies.

Advertisement