PDA

View Full Version : 2d animation



darius
21-07-2014, 08:05 PM
Hi all,
I'm investigating the possibility to implement some sort of advanced animation in a game. I'm looking to achieve the same effect as the character in the game LIMBO. Would some sort of IK algorithm need to be implemented to simulate the movement of the head and limbs? I cannot imagine that some sort of a sprite based approach is used. So how would that work in a real life game? Do you need to create a walk/jump/grab cycle and is there some smooth interpolation between the different states? Is IK then used in other cases? Or is the movement of the cycles only described for a minimal set of "nodes" and does IK calculate the position of the remaining nodes? (although this seems to be very impractical)
I would be very thankful if someone could offer some example code or a library that can help me move further on this. So far there seems to be very little available that is usable on the internet. Can anyone explain in simple steps how to code a walk cycle? I know how to create one in let's say blender, but how does this get implemented in a game? Can anyone share their workflow?

Regards, Darius

pitfiend
21-07-2014, 10:18 PM
There is something called 2d skeletal animation. Here is a site (http://kaliko.com/blog/2d-skeletal-animation-tools/) that links three tools that does exactly what you want, for Flash/Action Script 3, there is no Pascal equivalent yet. One of them has a file format that can be used anywhere if you know how.

Edit: I totally forgot about this thread http://www.pascalgamedevelopment.com/showthread.php?2893-2D-Skeletal-Animation-System-Questions-(and-Source)

Vinzvega
22-07-2014, 12:55 PM
Hi Darius,

This kind of animation is time framed : Skeleton and geometric propagation (linear transformation an so on).
A good point to begin : The Spine :)
http://esotericsoftware.com
You will find "runtime" Pascal engine for the file product by spine here : http://esotericsoftware.com/spine-in-depth#Runtimes
Cheers,

P.s. : The Pascal Runtime has been writen by Dan.
http://www.pascalgamedevelopment.com/member.php?564-Dan

User137
22-07-2014, 04:37 PM
With OpenGL it is at least a fairly short code to achieve joint behavior. Some kind of pseudo-code:

character.Transform;
Torso.Transform;
Torso.Render;
PushState;
Head.Transform;
Head.Render;
PopState;
PushState;
LeftShoulder.Transform;
LeftShoulder.Render;
LeftArm.Transform;
LeftArm.Render;
...
PopState
...
RightShoulder...
LeftThigh...
RightThigh...
In basics that's it, but you are better off try make the character in some editor so that you can do the same in a general form

procedure Render(const node: TJoint);
var i: integer;
begin
glPushMatrix;
node.Transform;
node.Render;
for i:=0 to node.Count-1 do
Render(node.child[i]);
glPopMatrix;
end;

Render(character.root);

Carver413
23-07-2014, 12:19 AM
This is the Tutorial I used to figure out the basic Idea hope it helps
http://content.gpwiki.org/index.php/OpenGL:Tutorials:Basic_Bones_System#Basic_Bone_Sys tem