Advertisement

How to implement skeletal animation in 2d game?

Started by March 29, 2015 04:24 PM
7 comments, last by ninnghazad 9 years, 9 months ago

Hi, I'm trying to make a 2d fighting game in which you can equip different weapons. As I want to have multiple weapons, it's impossible to use sprite-sheets because I would have to re-draw every animation for each weapon. So I'm thinking of using a bone based animation system.

However, I'm using allegro(a library similar to sdl), and allegro does not provide any animation system. So I will have to create an animation system from scratch. It's my first time doing something like this(I've been using sprite-sheets until now) so I don't have any idea on how to do it.

I guess I can create a bone class, and each bone has a child bone. The child bone is rendered at the end of the parent bone and then the rotation is applied. But is this the right/most-efficent approach? Should I somehow "save" my animation instead of re-calculating all of the bone's position each frame?

I'm not asking for all the code I need to implement it in my game, just some advices or techniques that I can use. Thanks!

http://esotericsoftware.com/

No need to build your own when there are libraries like this.

Advertisement

http://esotericsoftware.com/

No need to build your own when there are libraries like this.

actually, spine does not provide a runtime for allegro. And i prefer doing stuff myself instead of using third party technology.(I have the NIH virus)

Quick google tour hinted that there should be runtimes for Allegro too.(unofficials)

NIH virus is dangerous and you should try to cure it.

If you prefer to do thing yourself, i have something for you that you might like. I'll just explain how i did something similar in my game.

With more than 250 weapons sprites, it was out of the question to actually draw each sprite. So what i did was creating my own tool to manage the sprite animations and hitboxes. After that, i added "anchors" to each frame of animation to set where the weapon goes. Good thing is, i can even set anchor point for the weapon when it's sheathed. You need two anchors, one to set where it goes and another to set the angle.

So basically, i'm not using a complexe bone system but only anchor points to tell my game "that weapon goes there" at that frame.

Obviously, this method was very time consuming, but it give you an alternative to Spine.

Check out spriter as well, it's seem very useful.

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

Advertisement


And i prefer doing stuff myself instead of using third party technology.(I have the NIH virus)

So... you're the inventor of Allegro?


And i prefer doing stuff myself instead of using third party technology.(I have the NIH virus)

So... you're the inventor of Allegro?

He's writing it in x86 machine code. NIH indeed!

My Gamedev Journal: 2D Game Making, the Easy Way

---(Old Blog, still has good info): 2dGameMaking
-----
"No one ever posts on that message board; it's too crowded." - Yoga Berra (sorta)

a little old but still good. http://content.gpwiki.org/index.php/OpenGL:Tutorials:Basic_Bones_System#A_simple_skeletal_system_in_2D

This topic is closed to new replies.

Advertisement