Odd question but, how big can I make a timer in BGE? (V2.78 if thats important)

sorry if this is the wrong place for this question, wasn’t completely sure.
I was just curious as to how long it’d take before the bge timer decided to overflow.

I don’t know the answer to your question, but I vaguely remember someone saying something about the timer not being particularly accurate anyway.

If you want to deal with longer durations, then you could write your own event system, where you remember time.time() + num_seconds and check occasionally if time.time() > event.

why wouldn’t the timer be accurate? also since you’re curious I just need 9 int placements so nothing drastic and it can definitely do that. and you’re right about the clock but that doesn’t answer the question at hand.

This post from BlendEnzo explains it in more detail. Sounds like it’s a particular configuration that causes the inaccuracy. Still, I would be uncomfortable relying on something counting every tick for long durations.

Simple way to use a integer game-property.
Have a integer game-property named “TIMER” on the object the script is on.


import bge

def cont(cont):
    TIME_GOAL = 60
    if cont.owner["TIMER"] < TIME_GOAL:
        cont.owner["TIMER"] -=1
    elif cont.owner["TIMER"] >= TIME_GOAL:

I guess, but that would be significantly less accurate than the timer. The moment the frame rate changes for whatever reason, your timer will be off.

The Timer game-property uses decimals, like floats.
I guess it’s how you want to set-up your timer :man_shrugging:

can this thread get back on topic please?

Ah, sorry bout that, I saw @TheDave’s answer & assumed it was relevant (I’m not pointing fingers here)

If I understand your question properly, your trying to figure the highest number the “Timer” game-property can go?
The answer I believe, is 10000.0.

If your talking about how long as in time, I think it’s 10000 hours :sweat_smile:

| EDIT |
10000 minutes.


  • the timer’s value represents seconds relative to tic rate
  • -10,000 to 10,000 is the maximum value

assuming 60 tics per second, we could say (10,000/60)/60 = 2.7~ hours give or take. if your force the timer to start at minimum value (-10,000) you get double that. so roughly 5.5~ hours.

but this is still non-realtime as how long it’d actually take depends on framerate. so all in all you can’t reliably predict this value. it’s better to use a regular old float and add to it, 18^308 is a stupidly high number. if your timer goes beyond that you did something wrong.

but if you must do it with timer props and need to count longer than a couple of hours, just split the real number across properties and reset the timer. if x == seconds and y == minutes, then x + (y * 60) is the formula you use to count higher than 10,000. but it seems pretty much redundant when using time module is much better suited for the task.

and rambo, go do your math.

isnt the 10,000 a blender ui limit? what if you add to the timer in python? is it not already a float? type(own["Timer"])

either way, just use the time module, for reasons stated.

It is, upbge has a higher limit

I meant minutes & yeah, I’m not the best at large numbers math obviously :wink:

except that I have personally already surpassed 10k in the bge runtime.

Interesting :thinking:

Daedalus_MDW has answered your question. Internally, the timer is a float.

Therefore, your answer is a trivial Google search away:

It should be easy enough for you to confirm that by setting the timer to various numbers near the limit of a floats size.

1 Like

TL;DR for anyone else, the BGE timer is a normal pythonic floating point number,
which should be about

250738585072014e-308 but could vary depending on your architecture or other limitations.

1 Like