#### Archived

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

# 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.

## 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 on other sites
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 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 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

1. 1
Rutin
22
2. 2
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633307
• Total Posts
3011289
• ### Who's Online (See full list)

There are no registered users currently online

×