Game Development Community

Is there a DataBlock Instance Limit?

by Nicolai Dutka · in Technical Issues · 07/08/2009 (5:29 pm) · 7 replies

My game started crashing when I try to load it. After hours of debugging, I've come to a point where it seems like I've hit a limit to the number of objects I can have using the same datablock. I pulled ALL the static shapes from the level and started adding them back in bits at a time. I finally reached a point where adding a single object with a particular datablock will crash the game. I can continue adding static shapes with different datablocks, but if I add a single one with that particular datablock, it crashes again. I pull just one instance out, and it works.

So is there a limit to the number of static shapes I can have that use the same datablock?

#1
07/08/2009 (5:47 pm)
How many of these things are all starting on load?
I take it they're animated or something?
#2
07/08/2009 (5:48 pm)
edit - (posted w/o seeing steve's post)

i would be very surprised if that were the case.

try writing a little script to walk through the scene graph counting all the objects which reference a particular datablock.

note, any given datablock is only instanced once.
(well, potentially twice, once on server, once on client).
a staticShapewith a reference to a datablock just references the DB, it doesn't re-instantiate it.

another thing to try would be cloning the datablock with some minor change, and add the N+1'th staticShape referencing that. ie, perhaps it's something about the staticShape.
#3
07/08/2009 (6:08 pm)
None of them are animated. They are a simple fence with low poly that we've been using for months now... It just seems that we have too many in one level...

I tried doing a dump() of 'sceneGraph' and it says sceneGraph does not exist. I am using TGEA 1.8.1...
#4
07/08/2009 (7:39 pm)
So what is the limit you've found? 8, 128, 256, 512, over 9000?

Are you polysouping them? Usually a bad idea for something small.
If no to polysoup, does it have it's collision mesh/es?

Do you really mean "datablock"? As in there is a script file for this object? That's a datablock, an object is just an object.
If it has no animation and doesn't do anything, then it doesn't need a script.

Can you add the same number of any other model without it crashing? Is it just the fence?
#5
07/08/2009 (7:52 pm)
I'm talking about an object derived from a dataBlock. Is there a limit to the number of objects I can create from a single dataBlock?

I don't know the number, I just need it isn't letting me add in any more. We have a lot of the static shapes grouped together in a simGroup, so I can't just echo out the getCount()...
#6
07/08/2009 (10:17 pm)
Quote:
I don't know the number, I just need it isn't letting me add in any more.
Write an onAdd() counter for you object.
function YourObject::onAdd(%this, %obj)
{
   %this.count++;
   echo("YourObjectCount="@ %this.count);
}
Let's see what this number is ;)

Quote:
Do you really mean "datablock"? As in there is a script file for this object? That's a datablock, an object is just an object.
If it has no animation and doesn't do anything, then it doesn't need a script.
I think that what Steve is getting at is whether or not your item needs to be a scripted object, ie. it has a datablock and can do something, or has some sort of interaction possible with it.
Quote:
None of them are animated. They are a simple fence with low poly
Sounds like they don't need datablocks, why not simply add them as TSStatics instead of StaticShapes?


#7
07/08/2009 (10:23 pm)
onAdd() - nice, michael! much easier than walking the sceneGraph.