Archived

This topic is now archived and is closed to further replies.

MrSandman666

fps independance for complex calculations

Recommended Posts

Hey guys! If you''ve read some of my earlier posts you might recall that I''m working on a demo that''s all about particle systems. Now, my problem is the fps independence. I know how to do it for simple things like linear movement but the calculations for these particles can become pretty involved and there are many factors that change and have an influence on teh particles movement. How do I make THAT fps independant? Do I just put the time factor in wherever I have absolute numerical values? Take for example this line of code, which is from the function that controlls particle behaviour: PHandle.Size = PHandle.Life / 10.0f; How would you make that fps independant? PHandle.Life changes each frame so there is already a time factor in that. Should I put a time factor in the 10.0f, too? Do it like this? PHandle.Life -= 0.02f * timefactor; PHandle.Size = PHandle.Life / (10.0f * timefactor); or like this? PHandle.Life -= 0.02f * timefactor; PHandle.Size = (PHandle.Life / 10.0f) * timefactor; Any advice? Please...? ----------------------------- "Mr Sandman bring me a dream"

Share this post


Link to post
Share on other sites
Yup. Just get the amount of time passed since the last frame, get that to where 1.0 is one second, and multiply your 10.0 by that.



-Deku-chan

DK Art (my site, which has little programming-related stuff on it, but you should go anyway^_^)

Share this post


Link to post
Share on other sites