Game Development Community

Running out of clock

by Lee Latham · in Torque Game Engine · 02/10/2008 (10:52 pm) · 12 replies

Here's a question: Is it possible for TGE clock to run out of numbers? Like beyond a certiain bit-depth or something?

Reason I ask is because when I let my dedicated server run all the time, after about 20 hours (about 60 level changes), my schedules start wigging out.

Naturally, I just wiped out the error message accidentally, but I'll paste it in here tomorrow if no one has any ideas. Oh! But I know I'm seeing Exponent numbers flying by.

#1
02/11/2008 (3:06 am)
I have a dedicated servers running all the time. Usual uptime is about a week (with approx 10-15 players at every single moment). But in my case it's without level changes, single/persistent mission loaded.
And I've never seen problems with schedule. So, this could be something else... And more - I'm on heavily modified TGE150 base, so lots of stuff changed there from stock.
#2
02/11/2008 (4:17 am)
I haven't actually checked this in code, but I would assume that the functions (Platform::getVirtualMilliseconds () and all those) responsible for returning the time would run into precision issues if your schedules are very long (ie, longer than what the bits in those integers can hold).

But if your schedules are shorter than say 8 hours, I wouldn't worry.
#3
02/11/2008 (6:32 am)
The other thing is that on windows, the time switches the sign all 24.xx days uptime because windows handles overflow like that. When it goes over the maximum it just comes back at the minimum which is a negative number and will remain negative for the next 24.xx days uptime. Don't know how TGE handles that but depending on its handling this might be an issue as well.
#4
02/12/2008 (1:55 pm)
Thanks for the feedback, y'all. Naturally, I'm having trouble reproducing the error, now--I'll post it when I get it like I should have done in the first place.
#5
02/14/2008 (12:53 am)
Ok, finally I got it again--I start getting a bunch of these after almost exactly 24 hours:

singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00021e+006' attempting to call function 'setImageTrigger'
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00024e+006' attempting to call function 'setImageTrigger'
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00023e+006' attempting to call function 'setImageTrigger'
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00022e+006' attempting to call function 'setImageTrigger'
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00023e+006' attempting to call function 'setImageTrigger'
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00021e+006' attempting to call function 'setImageTrigger'
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00024e+006' attempting to call function 'setImageTrigger'
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00023e+006' attempting to call function 'setImageTrigger'
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00022e+006' attempting to call function 'setImageTrigger'
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00023e+006' attempting to call function 'setImageTrigger'
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00021e+006' attempting to call function 'setImageTrigger'
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00024e+006' attempting to call function 'setImageTrigger'

Ok, so I scroll back a bit and I see this starts happening at the beginning of a new mission load, and I'll show you the transition:

singularity/server/scripts/car.cs (1247): Unable to find object: '' attempting to call function 'isAIControlled'
singularity/server/scripts/car.cs (1247): Unable to find object: '' attempting to call function 'isAIControlled'
singularity/server/scripts/car.cs (1127): Unable to find object: '' attempting to call function 'getId'
<input> (0): Unable to find object: '' attempting to call function 'getId'
singularity/server/scripts/player.cs (865): Unable to find object: '' attempting to call function 'setControlObject'
CDROP: 924382 ai:local
CDROP: 954775 ai:local
CDROP: 969913 ai:local
CDROP: 969929 ai:local
CDROP: 985419 ai:local
CDROP: 985426 ai:local
CDROP: 985434 ai:local
CDROP: 985440 ai:local
CDROP: 985449 ai:local
Sending heartbeat to master server [IP:208.109.238.41:28002]
singularity/server/scripts/game.cs (185): Unable to find object: 'AIManager' attempting to call function 'delete'
*** MISSION RESET
*** ENDING MISSION
*** LOADING MISSION: singularity/data/missions/terrarium.mis
*** Stage 1 load
*** Stage 2 load
Executing singularity/data/missions/terrarium.mis.
*** Mission loaded
CADD: 1000188 ai:local
CADD: 1000191 ai:local
CADD: 1000196 ai:local
CADD: 1000199 ai:local
CADD: 1000202 ai:local
CADD: 1000205 ai:local
CADD: 1000208 ai:local
CADD: 1000211 ai:local
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00021e+006' attempting to call function 'setImageTrigger'
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00024e+006' attempting to call function 'setImageTrigger'
singularity/server/scripts/player.cs (865): Unable to find object: '' attempting to call function 'setControlObject'
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00022e+006' attempting to call function 'setImageTrigger'
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00023e+006' attempting to call function 'setImageTrigger'
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00021e+006' attempting to call function 'setImageTrigger'
singularity/server/scripts/aiPlayer.cs (596): Unable to find object: '1.00024e+006' attempting to call function 'setImageTrigger'

At the top you can see the consolespam which I have since gotten rid of. Then I kick all the AI clients and cycle the game. Then the mission loads, the new AI clients are added, and it seems to be interpreting the simID's as exponents! Is that weird or what?

What on earth could I have done to those poor simID's? It starts doing this with every single function call (not just setimagetrigger).

Wow. Any thoughts would be greatly appreciated.
#6
02/14/2008 (2:09 am)
What is it exactly that you're trying to do? And what is it that's filling upp all ID's?

Edit: I thought your issue was about the clock, too. Look at your client ID's, they are far too high to be healthy.
#7
02/14/2008 (12:17 pm)
Sorry Stefan, yes, I was mistaken.

As per this other thread: www.garagegames.com/mg/forums/result.thread.php?qt=72063 I thought you were ok up to about 32 million?

I'm whacking AI clients when they die and creating new ones to try to simplify some issues I was having with them when changing missions (like scoring, playercount, etc.) I also do a considerable about of creating/destroying DTS objects in my game for various different game-related reasons.

Is there a way to "reset" the counter without losing your human client connections?
#8
02/14/2008 (2:02 pm)
Honestly, I was under the impression that Torque would reuse old ID's when they were no longer used.
#9
02/14/2008 (2:28 pm)
I may well have screwed something up. I can't imagine how, though.

It's curious that it's right at one million that it wants to start interpreting them as exponential.

Of course, at this rate, I would hit 32 million in a few days, too.
#10
02/14/2008 (2:48 pm)
IDs in Torque don't get reused, so if you have a server continually going, you are going to get into the high reaches of IDs being generated. Add to that any console-related number functions are going to throw it to scientific notation after you hit 1,000,000

We ended up solving other issues with console math and simTime by adding some functions in the engine that take 2 numbers from script and return them with the proper operation

%number = MathAdd(1000000, 200)
echo(%number) results in 1000200

while

%number = 1000000 + 200
echo(%number) results in 1.0002e+001 (or something)

Most likely, whatever is assigning IDs is doing the math through console operations (which turn to scientific notation) and you'll need to go into the source and change that behavior (or write a system that recycles old deleted IDs)
#11
02/15/2008 (3:39 pm)
@James: Thanks for that, it's good to know it's not likely just me.

You know, when you throw projectiles into the mix, I'm surprised this isn't a more common issue.
#12
02/15/2008 (6:20 pm)
I was under the impression torque already resused old IDs.

There's so much conflicting information about torque.