the id of objects increases
by Thomas Bang · in Torque 3D Professional · 12/08/2011 (12:58 pm) · 6 replies
Each time when i load a level (again, again and again), the id-value of the objects increases. I saw this behavior in T3D 1.2/1.1, TGE152 and TGEA182. The last time, the missiongroup-object had a id of over 400.000.
So far i was under the impression, that Torque remembers the id of a deleted object as a *free id-slot*. This way, the id would be as small as possible.
What's the reason? Why does Torque increase the id continuously?
So far i was under the impression, that Torque remembers the id of a deleted object as a *free id-slot*. This way, the id would be as small as possible.
What's the reason? Why does Torque increase the id continuously?
#2
12/09/2011 (12:27 pm)
Id's are all assigned at runtime which is why and objectId is never guaranteed to the be the same every time. As Kevin pointed out with the code snippet above, objectId's are assigned based on a global that incremented with each object as it's added to the scene. If you continually reload levels without restarting the engine then that value will keep incrementing.
#3
12/09/2011 (11:53 pm)
Isn't that bad news for dedicated servers? I suppose there are a lot of object IDs to use up, though. But they said that about fossil fuels, too ;P.Quote:So far i was under the impression, that Torque remembers the id of a deleted object as a *free id-slot*. This way, the id would be as small as possible.I'm not sure if that was ever the practise... as far as I remember, object IDs would always increase for as long as the engine was running. Having a 'pool' of IDs to apply to an object upon creation would be nice, and shouldn't be too significant a hit on performance, since object creation is a relatively uncommon event, depending on things like how many Projectiles are being shot around.
#4
least once a week and the starting point is around 104,683 out of a possible
4,294,967,295.
Altho, thinking about it, if you do an object for every round fired, just maybe
on a very busy server, you could maybe shoot 4 billion bullets? :)
12/10/2011 (2:03 am)
Actually its not a big problem as most dedicated servers get restarted atleast once a week and the starting point is around 104,683 out of a possible
4,294,967,295.
Altho, thinking about it, if you do an object for every round fired, just maybe
on a very busy server, you could maybe shoot 4 billion bullets? :)
#5
Rate of fire
12�15 rounds/min sustained
45�60 rounds/min semi-automatic
so we take 100 players each firing continuously..
say max of 60, so 6000 rnds a min, 6000 id's a min.
1 day = 1440 mins = 8,640,000 object Id's in 24 hrs.
1 week = 60,480,000 object ID's for rounds.
Even at 500 players we only hit: 302,400,000
Nope, I don't thinks its a problem :)
Did I miss anything?
This does mean an issue if you start hitting several 1000 players at once.
Now you can see the fun of an MMO :)
12/10/2011 (2:12 am)
Lets see, real life values M16 (average):Rate of fire
12�15 rounds/min sustained
45�60 rounds/min semi-automatic
so we take 100 players each firing continuously..
say max of 60, so 6000 rnds a min, 6000 id's a min.
1 day = 1440 mins = 8,640,000 object Id's in 24 hrs.
1 week = 60,480,000 object ID's for rounds.
Even at 500 players we only hit: 302,400,000
Nope, I don't thinks its a problem :)
Did I miss anything?
This does mean an issue if you start hitting several 1000 players at once.
Now you can see the fun of an MMO :)
#6
12/10/2011 (4:08 am)
You could always add a support for a 64 bit variable structure.
Torque Owner Kevin Mitchell
12 CatBlack Studios
void SimDataBlock::assignId() { // We don't want the id assigned by the manager, but it may have // already been assigned a correct data block id. if ( isClientOnly() ) setId(sNextObjectId++); }