Page 1 of 1

Making Player/Monster with Unlimited Animation Abilities

Posted: 04 Jan 2010, 05:43
by iamWayne
just a sugestions :
i'm putting some thaughts on paper which i have in mind for a long time.
i'm thinking of making a dynamic class which expand to capabilities of the Being Class:
example an object on a map can be taught or forget a skill.

example:
teaching a player how to dance;

below i tried to simplified with an example of making a male player adapts a new skill by teaching him an action Sprite when ingrav is activated.



in this example, i'll be registering a new animation to ingrav spell when a player uses the spell, rather than the default attack being display or none at all.
without changing much to the system, just adding a few images and telling the computer what to do with them.

ok, here begin:

within the Player Class , it contains

sample algorithm // demo in c++

Animated_Sprite *sprite = new Animated_Sprite();
...// adding appropriate image to each animated sprite
..// setting delay per frames

..//declare a state being manager, which can assign new state animation for all beings
..// now add animated sprite to the Static State_Being_Manager and reference

state_id = ACTION_DEFINED & 1;


STATEMANAGER::RegisterNewState("male_walk_sprite" , sprite ,state_id );
STATEMANAGER::RegisterNewState("male_front_arrow_sprite" , sprite , state_id++ );
STATEMANAGER::RegisterNewState("male_walk_left_sprite" , sprite , ACTION_DEFINED & 3 );
STATEMANAGER::RegisterNewState("male_walk_north" , sprite , ACTION_DEFINED & 4 );
..... /// rather to avoid overwritten of other states STATEMANAGER::GetNextInt();
STATEMANAGER::RegisterNewState("male_magic_ingrav" , sprite , id );

//deciding which state to choose
//if predefine state is not found then

...
if( ! iStateFound && (being->getAction() & ACTION_DEFINED) )
{
Animated_Sprite *sprite = STATEMANAGER::getState( being->getAction() );
if( sprite)
{
//make this sprite play as animation
}
}

Re: Making Player/Monster with Unlimited Animation Abilities

Posted: 04 Jan 2010, 09:27
by Crush
I believe it's better to keep the animations soft-coded in the animation files for each sprite. But I agree that the system needs more flexibility to allow arbitary animations for special attacks, for example.

I would rather look into ways to define new animations with arbitary action names in the animation xml files and look into ways to call them server-sided.