Jump to content
Sign in to follow this  
m0nkey

Performance question - when on each frame or loops should be used

Recommended Posts

Here is another question I've not found a "good enough" answer for.

 

If there is a need to do something like set an objects height/position/direction, and it needs to be done in a fairly small timeframe so a "person" does not see the fact that the object is being "moved", what would the best method be, that would be best in terms of keeping top performance?

 

A tight loop or something like on each frame?

 

In a tight loop, its pretty simple, just spawn it and sleep for example 0.1 then do the function (like setPos). But, you can "see it" at times, perhaps depending on whether you look for it and whether the sleep time is honored or if its in a que.

 

On each frame (which I've hardly used) implies on every frame, as in what, 30 times a second, or more? Seems like that would be overkill, and also not what one wants to "bloat" with code.

 

But I've not found any advice on what to use these, what to watch out for. You know, just some common sense advice from users who have messed with it quite a bit.

 

Anyone got any input on this topic?

 

 

Share this post


Link to post
Share on other sites

You should push the objects around with imaginary explosions, let the game engine do all the boring junk. It is not possible to create an infinite loop that goes fast enough to setPos without making the jumps noticeable unless you sacrifice performance.

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×