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?
So is there a limit to the number of static shapes I can have that use the same datablock?
#2
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.
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
I tried doing a dump() of 'sceneGraph' and it says sceneGraph does not exist. I am using TGEA 1.8.1...
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
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?
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
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()...
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:Write an onAdd() counter for you object.
I don't know the number, I just need it isn't letting me add in any more.
function YourObject::onAdd(%this, %obj)
{
%this.count++;
echo("YourObjectCount="@ %this.count);
}Let's see what this number is ;)Quote: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.
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.
Quote:Sounds like they don't need datablocks, why not simply add them as TSStatics instead of StaticShapes?
None of them are animated. They are a simple fence with low poly
#7
07/08/2009 (10:23 pm)
onAdd() - nice, michael! much easier than walking the sceneGraph.
Associate Steve Acaster
[YorkshireRifles.com]
I take it they're animated or something?