ID:152164
 
Is it possible to do something like:

uObj
parent_type = /obj


and override the 64k obj limit since datums have a 16m limit?
uObj is a /obj, though, not a datum, and would be counted as such.

At least, I think.
In response to Jp
Jp wrote:
uObj is a /obj, though, not a datum, and would be counted as such.

At least, I think.

uObj is a datum, and he's setting its parent_type to /obj to make it an object.

I don't think this will work, because I believe the limit isn't in the definition, but when the object is created. When uObj is created, it will be spawned as a /obj/uObj, meaning it will add 1 to the 65k obj limit. This is how I believe it'd work, anyway -- someone more informed can feel free to correct me on this issue.
When in doubt, test it out.
I get "BYOND(404.966) ERROR: maximum number of objs exceeded (65535)!" when I attempted it.

uObj
parent_type = /obj
var
anti_garbage
var/uobjs=0
mob/Stat()
stat(uobjs)
mob/verb/test()
for(var/x = 1 to 70000)
var/uObj/U = new()
U.anti_garbage = U
uobjs++
sleep()

In response to Volte
It's hard to tell how the internals work, but I would guess all things based from the /obj type go into a list, which maxes out at ~65k. The only reason I can think of to explain why there's even a limit in the first place is memory, and objects being stored in a static array.
In response to FIREking
Objects are stored in a static array internally, I believe - they've got a reference number that's a 2-byte int. Which gives you - wait for it - 65536 unique identifiers.

mobs use a different static array, turfs and datums use different array and have larger reference numbers - 32-bit and 24-bit respectively, I think.
In response to Jp
Jp wrote:
Objects are stored in a static array internally, I believe - they've got a reference number that's a 2-byte int. Which gives you - wait for it - 65536 unique identifiers.

Since the limit was (IIRC) made because of network limitations when Dan and Tom started, couldn't they just change it to a dynamic array or a vector list template thing.

mobs use a different static array, turfs and datums use different array and have larger reference numbers - 32-bit and 24-bit respectively, I think.

I think you said that backwards. The turf/datum limit is much higher than the mob limit.

George Gough
In response to KodeNerd
I'm pretty sure the limit was more due to a mentality of "Who the hell would need more than 65535 objects?" (True enough), and the difficulty of using resizable arrays in C (I don't think they use C++).

Anyway, for whatever reason it's there, the assumption that obj and mob identifiers are two-bytes long is embedded so deep in the code that it'd be incredibly difficult to change it.

I think you may have misinterpreted my statement regarding turf and datum limits - I meant that turfs have a 4-byte reference and datums a 3-byte reference.
In response to Shadowdarke
Shadowdarke wrote:
When in doubt, test it out.
I get "BYOND(404.966) ERROR: maximum number of objs exceeded (65535)!" when I attempted it.

> uObj
> parent_type = /obj
> var
> anti_garbage
> var/uobjs=0
> mob/Stat()
> stat(uobjs)
> mob/verb/test()
> for(var/x = 1 to 70000)
> var/uObj/U = new()
> U.anti_garbage = U
> uobjs++
> sleep()
>


I think you have an example to solve this issue well if its a var that is :P it's kinda reproducable as well, I remember there a was a topic on this.