Page 1 of 1

Timer minimum length

PostPosted: Wed Dec 31, 2014 3:25 pm
by lcl
Hi!

Is there any specific reason why the minimum timer length is limited to 12 milliseconds?

I'm trying to write a system that would allow making games run with the highest possible frame rate the computer can reach, up to the built-in Game Editor fps limit of 512. For this to be useful, all movement and other changing values have to be balanced to the real_fps, so that all actors movements and all variables that change over time would happen at approximately the same speed regardless of if the real_fps is 30, 152, 12, ..., anything.

So far I have it working for variables that change in a linear manner over time, like basic x += 5 movement. The problems begin when the type of movement isn't linear, like in case for velocity.
When using yvelocity ++ in draw actor, simply balancing it so that instead of adding 1 it always adds (1 * the fps rate for which to balance to, for example, the basic 30) / real_fps doesn't work correctly, since the actor's position still gets updated every frame and despite balancing the amount of yvelocity increasing per second so that the velocity changes in 1 second the same amount with every fps, the amount of times the velocity updates the actor's position is not balanced to the real_fps and thus the actor will move more with higher fps and less with lower fps.

So, I started thinking I'd get around this problem by making a system that utilizes timers for when the yvelocity should get updated, and only update it n times per second, n being the fps rate for which to balance to, for example, the basic 30, again. This would work, but that's where the minimum timer length of 12 milliseconds starts making things difficult. Let's say we're balancing the velocity to fps 30, and that our current real_fps is the maximum, 512, now, for getting the yvelocity to update only 30 times per second, the timer length should be real_fps/balanceFpsTo = 512/30 = ca. 17. All good. But if the real_fps goes to a lower value, let's say 120 (which still is a lot higher than the worst case if the game really lacks, and also a lot higher than even the basic cases, it's rare for a Game Editor game to run over 100 fps), the math would become 120/30 = 4, and because of the limit, a timer that short can't be made.

Well, most of that was not important for the question, I just explained why I'd find shorter timers useful. I'm interested in why the limit 12 was chosen in the first place.
What comes to my fps balancing system, I guess I'll have to try to find some other way around the problem, or then just to limit it to only be used in games where all movement to be balanced is linear.

Thanks for taking the time to read.

Re: Timer minimum length

PostPosted: Fri Aug 21, 2015 6:14 am
by Indess
I have read the whole post but still i could not understand what you are trying to ask from the members here?

Re: Timer minimum length

PostPosted: Fri Aug 21, 2015 7:49 am
by knucklecrunchgames
Indess wrote:I have read the whole post but still i could not understand what you are trying to ask from the members here?


Some advanced code that I'm sure only the creator knows the answer to.

P.s, welcome to the forums.

Re: Timer minimum length

PostPosted: Wed Jun 14, 2017 8:52 pm
by hindax
Yes, this post was really illegible. What did you want to ask about the game editor?

Re: Timer minimum length

PostPosted: Thu Jun 15, 2017 9:54 am
by lcl
hindax wrote:Yes, this post was really illegible. What did you want to ask about the game editor?

Hello, and welcome to the Game Editor forum.

This is a very old topic in which I tried to ask the creator of the program why Game Editor's minimum allowed length for a timer is 12 milliseconds, as I was programming something I thought would be solved by shorter timers. But, as this is a years old topic, I think you'd figured out that the relevance of any of this is nearing 0 by now. :P