Generating animations at runtime

Started by
4 comments, last by Mussi 12 years, 3 months ago
Hello,

I apologize if this is in the wrong forum. If it is, please feel free to move it.

I am planning a doodle type game for iPad. I have previous experience (including three published apps on the app store in the past and some Windows/Linux stuff as well) in OpenGL (and ES) and have what I believe is a fairly solid grasp of basic 2D concepts (this is not a 3D game as I have not entered into that area yet).

Normally on my games, I have a set of predefined objects, characters, etc... that have predefined animations.

I would like the player to doodle their own character and then, from that single image, generate appropriate animations.

I am not even sure this is possible or feasible. That's why I'm creating this thread.

I know how to draw the doodle but bringing it to life is an entirely different issue.

Some questions that come to mind:

1) How would I animate a single doodle without asking the player to create separate frames themselves?

2) How would I distinguish between body/head/legs/arms/etc... The player could draw a stick figure, meatball, or even a palm tree.

My first instinct is that this is impossible. Am I right?

I think I could have easier success if I constrained the player. For example, by forcing them to draw legs and everything and do so separately then attach them myself. This limits the player greatly though in the type of shapes they could draw but would make it somewhat easier to do crude animations.

I feel it would not make it fun though or accomplish my goals.

I would like to stress this is only in the planning/research phase so if you feel the idea itself is impossible as-is, please state so but if you feel it is possible but I am not qualified please provide suggestions but don't discourage.

If I cannot plan the idea out with a clear and concise method within a reasonable amount of time, the project will be dropped and I will move on to one of the other ideas.
Advertisement
In 3D games creatures of different shapes and sizes often share the same skeleton, allowing one skeletal animation to be applied to different models. This works because the models are, so to speak, mapped to the skeleton.
I think you could something similar in 2D: create a 2D skeleton with animations and map the doodle to the skeleton and then deform it accordingly during animation. Mapping the doodle could be done manually or by some algorithm.
Thanks for that idea! I've never done anything with 3D or skeletons and am fairly new to physics but i'll check it out and see how and if I can apply it to 2D.

It does sound promising but would there be an issue if, for example, the creature has no legs?
You could map the creature partially to the skeleton, ignoring the leg bones or you could map it fully and it'll look...weird I guess. You could also allow the user to set how much the bones actually influence the doodle.
Now that's a thought!

If I created a 2D skeletal animation system (as there doesn't seem to be support built in to cocos2d for it and I can't find a drop in library), I could allow the player to specify the skeletal structure starting from a root bone.

The question then becomes how best to approach the actual animation creation; IE, the key frames. Would it be best to let the player set the key frames themselves? This may make the game too difficult for the player and drive them away. Or, should I somehow generate key frames based on the skeleton created by the player?

From what I understand, once the skeleton and key frames are created the actual animation is fairly straight forward: attach sprite parts to the bones and interpolate between key frames to generate fluid animation.

So it sounds like two challenges:

1) Creating key frames: Let player do it or generate procedurally?

2) Accurately attaching sprite parts (in this case, the doodle) to the appropriate bones as defined by the player.
I wouldn't let the player create the key frames, that just wouldn't be as much fun imo.

As for attaching sprite parts to the appropriate bones algorithmically, I'd just go with a nearest distance type of thing. Check what the nearest bone is, and use the distance to assign a value for how much the bone actually influences the pixel/region/sprite.

I think you have two options for generating animations and both options have several ways of going about it, they both include having an animated skeleton ready. The first option is that you only have the predefined skeleton, you use an algorithm to map the doodle to the skeleton or you allow the player to select regions to map to specific bones.
The second option is to allow the player to create a skeleton for his doodle, this skeleton is then mapped to the animated skeleton. Again, this can be done using algorithms or manually. You could also allow the player to modify the auto generated mapping.

I'd personally start of with the first option and use an algorithm to map the sprite to the skeleton. I think deforming the sprite is going to be the most challenging part to get right.

This topic is closed to new replies.

Advertisement