I’m wondering if there isn’t a setting somewhere in visual .net that will effect the speeds of animations. I run one program at school and the speed seems perfectly fine, and i run the same program at home and it moves so fast that it’s distorted. Any ideas?
Seems like your program is CPU/GPU speed dependent:)
Any program that wants to be run at the same speed on every computer should make use of time variable.
Yep. I agree. Have any code to show us?
Thanks, this isn’t my code but it’s code from a class I’m taking, and it’s awfully long. What it is is a car that goes around and around a race track, so I’m guessing I’d have to put the time variable in the idle function.
how exactly does the time variable work?
you can idle it, but that is very inefficient for fast computers. One way to fix it is to change the amout the animation moves each rendering. you can use timeGetTime() to get current time, then use a ratio (like 40/fps if your target fps is 40) then multiply it by what you are adding to the distance change. This allows the animations to be lots smoother on faster computers, while keeping the speed the same on slower ones.
oh, to get the fps, you take the current timeGetTime and subtract it from the last one to get how many milliseconds have passed. Then you take that number, say milli, and divide it into 1000 (1000/milli) to get the fps (make sure it is a float) Then you can use that as a ratio multiplier in your animation.
Try enabling vsync. If you have an ATI card it is in display properties->settings->advanced->3d->opengl
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.