Game Development Community

Theorical question on gameobjects unique Ids

by Guimo · in Torque Game Engine · 02/26/2008 (3:30 pm) · 2 replies

Hi all,

I was wondering how does the enumeration of objects work in Torque. This may be more a theorethical question so please just hold on.

Consider a dedicated game server runing for days and days and days on a extremely stable server. Players will enter and exit, connections will be created, players will be spawned, etc etc.

Each time an object is created this object gets a unique id so it can be identified. This id is in fact a S32 number (correct me on this please) which will increase and increase. As we also know, a S32 is defined as a (signed) int, so an S32 will only hold about 2 million values before turning into a negative number.

Does anybody knows what will happen in that moment? Will the server continue running without problems? I guess it will do because the value will still be unique but I wonder if everything will run smoothly.

On a more theorethical question, if the server does continue working fine past the 2 million values... what will happen when it reaches the 0xFFFFFFFF (-1) value and increasses again? Will it crash on existing objects? Is there any way to monitor the highest value so I can schedule a server restart?

I know this questions are only theorical because its most probable that the server will be required to restart before anything happens but I just wanted to make sure.

Luck!
Guimo

#1
02/26/2008 (3:52 pm)
Check out this thread which has some discussion around this very question.

ps,
an S32 can represent numbers way larger than two million: 2^31 / one million
#2
02/26/2008 (3:55 pm)
Thank you Orion! I will read that thread.
Yes you are right about the cappacity, I was a little sleepy. But the question is still valid.

Luck!
Guimo