Animation queue

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Animation queue

Post by Tyn »

Hey

It seems the engine suffers from the same thing which I have been tearing my hair out in work for the whole of today :) Sequencial movements aren't built in which makes my job ( very ) hard. I've been trying to program a drive to make a two axis movement, but because we went for the cheapo option, the drive tries to make every movement at the same time, rather than the more expensive types that queue moves up for you. This has been a pain in the arse all day.

So, I get home an work on my pathfinding algorithm, hoping to relax by seeing my mesh make it's way across the map, avoiding the building I put in. What do I find? I got the algorithm to produce a movement list ( in position2d<int> format if anyone is interested ) but when I try to make a for loop to make the movements I find that the animation doesn't wait for the move to finish before making the next move. Has anyone got a way around this?

The solution I had to the problem at work which we agreed on would be that you throw moves at the drive and it would store them in a buffer type system, meaning you could throw 20 moves at the drive in a milli second and let it make all of those moves one after the other ( sometimes taking 10 minutes, they move slow :) ).

I would very much like to see the same system in Irrlicht. Does someone know of a way I could hack the engine to do this?
Manakel

Post by Manakel »

There is a user made extensions to irrlicht that create sequenced or parallel jobs with synchronisation trigger .;

I found it at random last week but i can't remenber the name since i had no use of it.
try google or links page
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Did you happen to see how it worked? Nothing with Google.

It will actually be something you will all run into ( most of you anyway ) as you get into AI, as you will need to know when the last move is complete in order to give the AI the next move. I.E a patrolling AI script. Even the most basic FPS will need this so it would be nice to see this code :)
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Hmm, it seems you were right if this is what you mean:

Code: Select all

createFollowSplineAnimator  s32    startTime,  
  const core::array< core::vector3df > &    points,  
  f32    speed = 1.0f,  
  f32    tightness = 0.5f 
 ) 
If I make the tightness to 1.0f then it should work correctly and follow the centre of the tiles. Cheers m8 :)

The biggest problem with using this is that I need to be able to stop the animation at each point, to basically confirm that the next move should go ahead, prehaps by a bool. So, it would run through the moves as long as the bool for the next move is false then it would perform the next move.

The reason for this is basically that the situation may change ( in the AI ) when it gets to a certain point. I'd imagine this also would be something that most people would want as the situation in an FPS would change upon the critter seeing the player and would need to stop the animation to perform the player attack moves. I might have to create my own animator to do this, which I am not crazy about since I'm not totally confortable with doing it.

Prehaps an event in the event receiver saying that the move is done would be better, say like you give the animation an ID and when it is complete it would send a pulse to the event receiver to say that the animation is complete.
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

I just read your problem quickly Tyn, so I could be misunderstanding you, but I've already made something that could be what you want. http://irrlicht.sourceforge.net/phpBB2/ ... php?t=2511
It allows you to define a callback that will be called when an animation finishes, and it will pass the callback a pointer to the scene node.
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Not really what I needed, but it is something that should be in the engine. I think a bool in the scene node for when the node is moving should be included.

I've worked out a way of doing it and it works ( yay me :) ). Basically, I have a function to add a path to a path buffer and a function that maintains the path buffer inside the drawing loop. The code will be released in the 0.0.3 release that is coming very soon ( much sooner now I have overcome this little problem ).

The combination of this and me finishing pathfinding has advanced the project a lot further than the previous two releases. It's actually resembling a game ( although a lot of work is still needed ).

The code is in my forums for anyone who wishes to see it:

http://www.eve-corp.com/2080/modules.ph ... 6087fe1#75
Post Reply