Multiple WakeUpOnElapsedFrame Behaviours?

Hi, I have made a WakeUpOnElapsedFrame to get the FPS. As my game develops I will need more behaviours that reply on elapsed frames.

Performance wise, readability wise and good practice wise, does it make a difference to have more than one WakeUpOnElapsedFrame behaviours or should I have one that manages them all?

Thanks :smiley:

Hi
It really depends on what the behavior does, i’ve used both techniques with success. I think I ended up with a couple on my last attemp, a shared one that went round and updated all the geometry, and another for rendering the FPS counter and then maybe one more to go off and poll input devices. It really depends if the functionality you wish to group to gether is similar or not. Updateing all geometry was done from one behavior as it’s one class of update, the others are seperated classes of update so were not grouped together, at least that was my thinking at the time :slight_smile:

HTH

Endolf

thanks very much, you have confirmed what I thought, I was specifically wondering whether the geometry updates should be managed from the same behaviour or not… Your way seems sensible, I will have a behaviour for FPS, geometry and input

Thanks again :smiley:

Remember not to use framerate alone - I have had some really weird effects happen where things ran every frame and worked fine on one PC and then turned out really fast or slow when I tried them elsewhere…

Hi
I’m assuming you mean for the geometry updater? Although you don’t use the fact that a frame has been updated to modify the geometry, you do use it to start the process, the amount you update by is not ‘1 frame’, it’s the time since you last did it.

Endolf

[quote]Remember not to use framerate alone
[/quote]
what do you mean? don’t have framerate in its own behaviour?

been working on it today, put the FPS and inputs into spereate behaviours and so far the results are good :stuck_out_tongue:

I meant don’t use elapsed frames for timing your animations and stuff.

Well I have use elapsed frames to handle keyboard control. I want to make a behaviour to make a cannon ball travel on a curved line. I have code that works the curved path out based on time, angle and velocity, what would the best way to do this be? I was going to use WakeupOnElapsedFrames that starts at time 0.0, then for each frame works out the new position by the amount of time that has elapsed since the last frame? Is this not adivsable and what are the alternatives?

Thanks

Hi
as long as you are using elapsed time in your update it’s ok, it’s when you just use a frame counter, rather than a frame rate or elapsed time that things go wrong.

Endolf