Jump to content
  • Advertisement

Archived

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

Xtreme11

Completed Article on frame independent movement

This topic is 5420 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

You can view the article here: Clicky I had some problems attempting to use my first method in a real game i.e TimeDelta = (float)1/CurFps; TimeDelta is a float and CurFps is an int Is it not possible to compute this via this method or am I doing something wrong as TimeDelta always ends up as simply 0? Another concern of mine is the second theorem i use in the article. I first saw that method being used in "Zen of Direct3d Game Programming" by Peter Walsh. 1) Im not sure if this is not the original source. 2) My only worry was am I in breach of anything although I am not using any code he uses in the book I do discuss this same method as well as an algorithm for it. I also mention his book as the original source in the article. Any help on these would be much appreciated as well as any comments and criticism on the article EDIT: clicky [edited by - Xtreme11 on January 12, 2004 1:32:42 PM]

Share this post


Link to post
Share on other sites
Advertisement
quote:
At 10 FPS your deviance will be 10/20 = 0.5
New Movement Value: Desired Movement / Deviance Value:
2/0.5 = 4 units of movement per second


Instead of dividing FPS/NUMBER and then dividing MOVEMENT/DEVIANCE, why don''t you divide NUMBER/FPS and then multiply MOVEMENT*DEVIANCE ? It''ll be faster that way.

Share this post


Link to post
Share on other sites
quote:
Original post by Xtreme11
You can view the article here:
Clicky

I had some problems attempting to use my first method in a real game i.e
TimeDelta = (float)1/CurFps;
TimeDelta is a float and CurFps is an int
Is it not possible to compute this via this method or am I doing something wrong as TimeDelta always ends up as simply 0?



Your problem is integer division is occuring and then that integer is being cast into a float. You need to do either 1.0f/CurFps; or 1/(float)CurFps; to get correct results.

James

Share this post


Link to post
Share on other sites
Thanks James and Holy Fuzz
such a simple solution

Fuzz, good thinking on that, it is faster

Ive fixed up the article with these changes

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!