Reverse-engineering multi-joint bosses

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
SriK
Posts: 10
Joined: Sun May 25, 2014 8:03 pm
Location: College Park, MD
Contact:

Reverse-engineering multi-joint bosses

Post by SriK »

You know what I'm talking about: Seven Force, Yokozuna, Beast Kimkoh, and many more. Large bosses pieced together from many distinct sprites, which interface and animate together smoothly. Is there a standard way that games achieved this effect, back in the 16-bit era? I'm working on a retro side-scroller project of my own, and I'm at the point where I need to know how this stuff works.

I believe the modern way to do something like this is to use a physics engine which supports joints, impose some sort of constraints between each joint so the "parts" fit together in the right ways (maybe changing the constraints for different animation states), and leave the rest up to some sort of hyper-optimized linear-algebra solver. For various technical reasons, I don't have access to that (more accurately, it would be a pain for me to interface with a proper physics engine and I'd like to avoid it if I can). It seems like overkill to import an entire physics engine just for this one function, anyway, if so many games in the 16-bit era were able to achieve these kind of effects with 7.6MhZ processors and without complex physics engines.

Here are two specific examples. I'd be interested in knowing more about the programming of each:
  • The Orphic Vipers in Super Castlevania IV (I'm sure they're doing something very simple, but the way the joints move looks complicated. The regular Bone Dragon enemy has a similar movement, I think, and that guy was from the NES games, so the calculations can't be TOO taxing)
  • Xi-Tiger and Seven Force in Alien Soldier (16:45 and 34:22 respectively in this video; they're the most complicated bosses, in a game which is basically a non-stop variation on this idea. They both look incredibly smooth, to the point where I doubt that all the animation data was inputted manually)
There are many more examples I could give, but I figure that if I can program these two guys, in addition to what I can already program, then I've covered everything that I might need. The Orphic Vipers are the most immediately pressing to me, since I'm currently working on a miniboss which demands similar movement.

(Related question, if anyone knows. I've read in interviews that Konami had a stock set of generic routines that they would use for multi-joint sprite animation, combining the routines in various ways until they got a visual effect that looked cool. The design lead of Contra: Hard Corps said he threw this approach out, and the team custom-programmed every boss individually instead. What did these "generic routines" look like? And what is Hard Corps doing in comparison?)

Feel free to post other examples you like in this thread, too, even if you can't explain how they work. (For some reason, I associate this effect way more with the Genesis than the SNES, or even the arcades, but feel free to prove me wrong.)
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Reverse-engineering multi-joint bosses

Post by lidnariq »

To me, it looks like the Orphic Vipers are just multiplied sine waves. The heads move according to some pattern, while the bodies are something of the form of sin(x)*sin(n*x+m*t), and the axis of that compound sine wave is rotated according to where the head is.

I don't see why Xi-Tiger couldn't be just lerped.
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: Reverse-engineering multi-joint bosses

Post by psycopathicteen »

How long did it take you to make that? What program did you use? I'm impressed with what you have so far actually.


I have some multijointed bosses here:

https://youtu.be/-EuIO9CaDqk
...and here:
https://youtu.be/iJNazRuMeLc

The pumpkin head, plasma grinch, and wolf use a table of what joints to connect with what, and a table of how to animate it. The giant robot, I cheated by animating it to look like a multijointed boss, but the arms actually are multijointed and in order to grab the ends of the rotating platform I google searched a mathematical formula that somebody else figured out. The fire dragon just uses a chain physics formula.
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: Reverse-engineering multi-joint bosses

Post by Oziphantom »

Physics Engine... the last thing you want to be involved in animation is Physics... unless you are doing the really new cutting edge "body animations" for sports games or something..

For a modern title forgot what the SNES did and just use http://esotericsoftware.com/ or http://dragonbones.com/en/index.html it has integration libs for basically everything and has a C library for everything else ;) This is the way you would want to do it, but back then we didn't really have such power, so you would do linear transforms/parabolic accelerations between known points, and make a tool on what ever machine you were working on to do, each and every studio/game will have its own tool set for what they did. But basically "meta sprite" x,y move deltaX,deltaY,Frames and then for bosses you would have custom code for each bit of it as needed.
fred
Posts: 67
Joined: Fri Dec 30, 2011 7:15 am
Location: Sweden

Re: Reverse-engineering multi-joint bosses

Post by fred »

Yeah, I also associate multi-joint sprites with the mega drive. Konami did use the effect in a few snes games though - contra 3 has that strange "genesis bike" mid-boss in stage 3 (and some other joint stuff), and sparkster has jointed sprites all over the place. Might be those general purpose routines you mentioned.
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: Reverse-engineering multi-joint bosses

Post by psycopathicteen »

I'm not sure, but I think Sparkster SNES has the 65816 equivalent of the Hard Corps routines, since Sparkster has the largest number of multijointed bosses on the SNES.
SriK
Posts: 10
Joined: Sun May 25, 2014 8:03 pm
Location: College Park, MD
Contact:

Re: Reverse-engineering multi-joint bosses

Post by SriK »

lidnariq wrote:To me, it looks like the Orphic Vipers are just multiplied sine waves. The heads move according to some pattern, while the bodies are something of the form of sin(x)*sin(n*x+m*t), and the axis of that compound sine wave is rotated according to where the head is.

I don't see why Xi-Tiger couldn't be just lerped.
Thanks for the tip, I'll try that out. I can kind of see it, now that you've explained it. I guess t is a counter that increments over time, but what are n and x here?

By lerped you mean that the artist manually inputted animation keyframes, and the programmer interpolated between them? That makes sense, actually.
psycopathicteen wrote:How long did it take you to make that? What program did you use? I'm impressed with what you have so far actually.
It's a custom engine written in C# using SFML. That's why I think it may be hard to import external libraries or engines. If I was making the game from scratch today I would use Unity or Game Maker Studio, but back when I started making the game those engines' 2D support wasn't quite up to par with what I needed. (Development started in 2014-2015; I haven't been working on the game consistently for all these years, it's been very on-and-off until fairly recently. The boss featured in that video took about 2-3 months, but most of that was on the art and conceptualization side, not the programming side.)
Oziphantum wrote:For a modern title forgot what the SNES did and just use http://esotericsoftware.com/ or http://dragonbones.com/en/index.html it has integration libs for basically everything and has a C library for everything else ;) This is the way you would want to do it, but back then we didn't really have such power, so you would do linear transforms/parabolic accelerations between known points, and make a tool on what ever machine you were working on to do, each and every studio/game will have its own tool set for what they did. But basically "meta sprite" x,y move deltaX,deltaY,Frames and then for bosses you would have custom code for each bit of it as needed.
Thanks, I'll look into both of these over the next few days. Do you know of any low-res sprite-based games which use either of these? It seems Spline has SFML bindings, but only for C++, not C#.

If worst comes to worst, I bet that Spline editor would make it way easier for the artists to put together keyframes for these multi-part bosses, even if we can't use their renderer. Their editor seems to export JSON, which is universally readable (we already use it to store animation data).
fred wrote:Yeah, I also associate multi-joint sprites with the mega drive. Konami did use the effect in a few snes games though - contra 3 has that strange "genesis bike" mid-boss in stage 3 (and some other joint stuff), and sparkster has jointed sprites all over the place. Might be those general purpose routines you mentioned.
Yep, I see it very much as a Konami thing (and a Treasure thing, later on). There are definitely arcade games which appear to have crazy multi-jointed sprite animation, like the Metal Slug and Gunforce games, but I think internally they just use one giant spritesheet instead of assembling the parts programatically. That might be a good approach to take, but it's a lot more work on the artists' part (without these cool-looking tools Oziphantum told me about, at least). I'm the only one working on the game full-time, so I prefer to load as much work onto my side as possible :)
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Reverse-engineering multi-joint bosses

Post by lidnariq »

SriK wrote:
lidnariq wrote:To me, it looks like the Orphic Vipers are just multiplied sine waves. The heads move according to some pattern, while the bodies are something of the form of sin(x)*sin(n*x+m*t)
Thanks for the tip, I'll try that out. I can kind of see it, now that you've explained it. I guess t is a counter that increments over time, but what are n and x here?
x is linear position, projected to a single axis along the neck. m and n are just arbitrary numbers to make it look good.
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: Reverse-engineering multi-joint bosses

Post by Oziphantom »

if you look through http://esotericsoftware.com/madewithspine you will see some pixel sprites, depends on what you call "lo-res"

The SFML is what 4 functions, look fairly straight forward to convert to c# if you know SFML well, the main meat is the spine-csharp library that does all the animation and translation, from there you just need to get each "sprite" piece and its location and then put a "billboard" at said nodes location.
SriK
Posts: 10
Joined: Sun May 25, 2014 8:03 pm
Location: College Park, MD
Contact:

Re: Reverse-engineering multi-joint bosses

Post by SriK »

Thanks for the tips, lidnariq. He's looking great (WIP assets, of course):

Image

I drew a line from the body to the head, and then added on a perpendicular component according to the equation you gave me:

Code: Select all

// a is the parallel component, ranging from 0 to 1
double a = linkId / (double)THHead.NUM_LINKS;

// b is the perpendicular component, ranging from 0 to 1
double b = Math.Sin(a * 0.5 * Math.PI) * Math.Sin(a * 2.0 * Math.PI + sinCtr / 8.0);

Position linearInterp = basePos + a * paraDir + b * perpDir;
pos.Copy(linearInterp);
Works like a charm. Still doesn't attack yet, he'll get there soon :)

I'll continue looking into Spline as well, for the next set of bosses. We have a bizarre psuedo-3D boss coming up (the fight is structured somewhat similarly to Spinderella in Dynamite Headdy) and I'm hoping I won't have to program all of him by hand.
Post Reply