Synchronized Animations.. [prob=null]


Has one of you guys experiance with JGN and JME's AnimationController?

I'm currently try to add an avatar for each client to my scene.

Importing the model (incl. Skin, Bones, Animations and AnimationController) is no issue, and neither synchronizing its Position/Rotation-Data.

But i'm stuck, if i want try to activate their animations by using their AnimationControllers.

So, each Client has its scene, including his own avatar which is properly animated in his scene. (MyAvatar)

I connect to the server… and registers my avatar to the SyncObjManager.

In the scene of another client a new avatar appears, representing myAvatar. (having all icluded… Anims,Controller,Bones)

If i move myAvatar in my scene, i send a synchronizeAnimationMessage, telling the others to start/stop a certain animation on my ambassador. (e.g. walk).

Recieving this message, the others check which of the "guestAvatars belongs" to my clientID, and call startAnimation (walk) on the avatar's animationController… everything seems to be fine… but nothing happens.

I guess its some kind of update issue… because the AnimationController needs to be updated frequently. But this should happen if i call updateWorldData() on the corresponding rootNode… Huh

Maybe one of you had this prob before…

hi again…

darkfrog gave me a hint, that this could be caused by calling the startAnimation() method from another thread.

He suggested to use the GameTaskQueueManager to proceed…

So now i could give some more information:

Each client's JGN SynchronizationManager runs in a seperate Thread.

And each client's App runns in a seperate Thread. (it's extending SimplePassGame, not StandardGame  )

If a Client moves his avatar in his local game, the avatar moves and is animated.

So the client sends a Sync3dMessage and a SyncAnimMessage to inform all other clients of his movement and animation. (a animMessage is only sent when the animation is started or stoped. Meanwhile the animation should run)

Both Information reach the JGN SynchronizationManagers of the other clients.

The position/rotation information are passed to the corresponding GraphicalController and are applied properly, so "myAvatar" moves synchronized in other client's scenes.

So my client's ambassador is attached in the other clients root node, and a reference is available in the syncObjectManager.

so what would u suggest now?

public void messageReceived(Message message) {
                else if (message instanceof SynchronizeAnimationMessage)
         System.out.println("SYNC-MANAGER:379 - Recieved a  SyncAnimMessage from: "+message.getPlayerId());
         for (SyncWrapper wrapper : queue)
            if(wrapper.getOwnerPlayerId()== message.getPlayerId())
               System.out.println("Wanna' inform the AnimController of wrapper/syncObject: " +wrapper.getId());
               final AbstractAvatar av = (AbstractAvatar)wrapper.getObject();
               //check execute wether animation should start or stop
--Pseudo information here
                  //inform the animationController to start the animation
                  //have this to happen in the openGL-Thread?
                  //than i should use a Callable, add it to the GameTaskQueueManager using update(Callable?)
                  //is it called only once or serveral times? is a GameTaskQueue called several times?
                                                av.startAnimation("walk", true);
                                                update the controller frequently until
                                                av.stopAnimations() is called
                  //or should/could it be started from here and the OpenGL-Thread
                  //is responsible to update the AnimationController by calling of updateWorldData.
                  //But because the avatar (including his AnimController) are attached to the rootNode
                  //the animController should be updated without any additional call of updateWorldData?
                  //beacause maybe its called twice per cycle than?!

Hope u get the core of my question :|

Push it into GameTaskQueue and add support to your Game to work with it…or switch to StandardGame. :o

you mean i have to get the queues from the Manager manually?

Debuging shows that there is a instance of GameTaskQueueManager when i call GTQM.getManager()… so i thought it is initiated by SimplePassGame.

So GTQM isn't processed during the updateRoutine?

ok, got it… at least how to use the GameTaskQueueManager work within BaseGame… quite easy Issue calling it's update() and render() methods within BaseGame's  :roll:

Did that fix your problem?

not yet…

but it seems that my approach within the syncManager, to get the corresponding syncObject of a Client, is wrong.

I'm confused about the playerID's and SyncObjectID's, because the server and the first client have both playerID 0.

has none of u guys ever synchronized animations over a Network?

They haven't to be absolutely sysnchronized, just be started and stoped, and meanwhile updated.

Using the GameTaskQueuemanager helped to get rid of some probs adding and removing ambassadors.

And i achieved a laggy solution adding the currentFrame of my localAnimation to the Synchronize3DMessage.

So everytime the Syncmanager updates the position/rotation, i set the currentFrame to the AnimationController of my ambassador.

but i can't achieve an automatical update …

Tell me if i'm totally wrong, but i think this should be possible.

if the Skin,Bone and AnimationController of my Ambassador is attached to a remote scene, everything should be updated within the cycle?

Where do you think is the best point to update the AnimationController?

To clarify here, this is not a JGN issue…this is a threading issue.  Your controller should probably be attached to what it is controlling so it gets updated when the spatial does?

it is… thats the confusing part…  :?

The skeleton (com.jme.Animation.Bones) has its AnimationController attached.

And itself is attached to the RootNode, as well as the skinMesh and its CollisionBox.

So it should be updated within the updatecycle… doesn't it?

And of course: … this is not a JGN issue …

Perhaps you'd be better off re-posting your message as the subject line is perhaps scaring people away from assisting since it is assumed that JGN is part of the issue and that it's not simply a threading issue.  Also, you might post a code sample of how you're doing this to give people a better idea of what you're doing to venture why it's broken.

emp - did you resolve the issue ??


yesterday night :wink:

isn't a bug… it was stupidity

applying my SyncAnimMessage, the boolean for "repeat" was set to false everytime… so he did only one step and then stoped.

I thought this is depending on the updatecycle…

sorry guys, but thanks for the effford!!

I still get in touch with the prototyp here…

greetz Imm0

everything is hard…until its easy