upbge icon indicating copy to clipboard operation
upbge copied to clipboard

Object timer properties and tick rate depend on the framerate

Open Yethiel opened this issue 5 years ago • 4 comments

I recently tried switching my game to UPBGE and most things worked fine, except for the tick rate and timer properties. They seem to depend on the framerate, e.g. if my game runs at 30 fps on my laptop, all timers are also slowed down by half. The countdown takes twice as long, etc. Is there anything that has been changed that I need to adapt my game to? I built the most recent version from git.

Some of my functions already take the rate of logic ticks into account. Adapting more wouldn't be a problem for me, however, I doubt that object timers should depend on the frame rate and slow down.

Maybe I'm missing something, I'd be glad for any clarification.

Yethiel avatar Nov 28 '18 12:11 Yethiel

I thought about making speed variables, which depend on current frame rate. Framerate chages - speed changes according them.

vlad0337187 avatar Dec 02 '18 02:12 vlad0337187

Timer is a timer. Needs to count the seconds and the milliseconds not the frame-rate. It should be completely independent from the frame-rate. You can have variable frame-rate from system to system but you don't want to have a variable timer. Just my 2 cents.

UglinessInTheUI avatar Feb 19 '19 00:02 UglinessInTheUI

In the BGE, there is the concept of "Real Time" vs "Simulation Time". I guess in this case timers must represent the time elapsing in the simulation.

https://pythonapi.upbge.org/bge.logic.html#bge.logic.getRealTime

On the other hand, in modern engines, the delta time between two frame calls is given to the scripts, so that they can adapt whatever they were doing to the call frequency getting slower.

paul-marechal avatar Feb 19 '19 04:02 paul-marechal

I guess i was talking about the real-time timer.

UglinessInTheUI avatar Feb 20 '19 22:02 UglinessInTheUI