Author Topic: "Should never be considering a brick bigger than us here!" -Solved  (Read 2527 times)

Solution: Increase length of time between brick creation. So far 20ms works fine.

So I have a function creating several hundred bricks at one time. Sometimes it works, and sometimes I get this error that pops up and says "octNode::r_insertBrick - should never be considering a brick bigger than us here!"

What could possibly cause this? I'm not messing with scales or anything.

Current buildString function:
Code: [Select]
function buildString(%string,%client,%count)
{
if(!%count)
{
%count = 1;
}
echo("buildString called "@%count@" number of times");

%currString = getRecord(%string,0);
%brickDB = getField(%currString,0);
%bPos = getField(%currString,1);
%bX = getWord(%bPos,0);
%bY = getWord(%bPos,1);
%bZ = getWord(%bPos,2);

%colorID = getField(%currString,2);

%brick = new fxDTSBrick()
{
datablock = %brickDB;
position = %bX SPC %bY SPC %bZ;
rotation = "0 0 1 90";
colorID = %colorID;
angleID = 1;
client = %client;
isPlanted = 1;
};
if(%client.brickGroup)
{
%client.brickGroup.add(%brick);
}
%brick.setTrusted(1);
%brick.plant();

//Remove first record
%newString = removeRecord(%string,0);

if(getRecordCount(%newString) > 0)
{
schedule(1,0,"buildString",%newString,%client,%count++);
}
}

Here was the latest (portion of) string of bricks created:
Code: [Select]
brick4xCubeData TAB -16.8844 83.8705 0.0018 TAB 6
brick4xCubeData TAB -14.8844 83.8705 0.0018 TAB 6
brick4xCubeData TAB -12.8844 83.8705 0.0018 TAB 6
brick4xCubeData TAB -10.8844 83.8705 0.0018 TAB 6
brick4xCubeData TAB -8.8844 83.8705 0.0018 TAB 6
brick4xCubeData TAB -6.8844 83.8705 1.0018 TAB 6
brick4xCubeData TAB -4.8844 83.8705 0.0018 TAB 6
brick4xCubeData TAB -2.8844 83.8705 0.0018 TAB 6
brick4xCubeData TAB -0.884399 83.8705 1.0018 TAB 6
brick4xCubeData TAB 1.1156 83.8705 1.0018 TAB 6
brick4xCubeData TAB 3.1156 83.8705 0.0018 TAB 6
brick4xCubeData TAB 5.1156 83.8705 0.0018 TAB 6
brick4xCubeData TAB 7.1156 83.8705 1.0018 TAB 6
brick4xCubeData TAB 9.1156 83.8705 1.0018 TAB 6
brick4xCubeData TAB 11.1156 83.8705 2.0018 TAB 6
brick4xCubeData TAB 13.1156 83.8705 2.0018 TAB 6
brick4xCubeData TAB 15.1156 83.8705 2.0018 TAB 6
brick4xCubeData TAB 17.1156 83.8705 2.0018 TAB 6
brick4xCubeData TAB 19.1156 83.8705 4.0018 TAB 6
brick4xCubeData TAB 21.1156 83.8705 5.0018 TAB 6
brick4xCubeData TAB 23.1156 83.8705 2.0018 TAB 6
« Last Edit: February 22, 2012, 01:31:53 AM by Jardev »


So I set up a string with all of the data I need for each brick:
(Cut very short to avoid massive string)
Code: [Select]
brick4xCubeData TAB 291.182 157.921 8.24332e-05 TAB 6
brick4xCubeData TAB 293.182 157.921 8.24332e-05 TAB 6
brick4xCubeData TAB 295.182 157.921 8.24332e-05 TAB 6
brick4xCubeData TAB 297.182 157.921 8.24332e-05 TAB 6
brick4xCubeData TAB 299.182 157.921 8.24332e-05 TAB 6
brick4xCubeData TAB 301.182 157.921 8.24332e-05 TAB 6
brick4xCubeData TAB 303.182 157.921 8.24332e-05 TAB 6
brick4xCubeData TAB 305.182 157.921 8.24332e-05 TAB 6
brick4xCubeData TAB 307.182 157.921 1.00008 TAB 6
brick4xCubeData TAB 309.182 157.921 1.00008 TAB 6
brick4xCubeData TAB 311.182 157.921 8.24332e-05 TAB 6
brick4xCubeData TAB 313.182 157.921 8.24332e-05 TAB 6
brick4xCubeData TAB 315.182 157.921 1.00008 TAB 6
brick4xCubeData TAB 317.182 157.921 1.00008 TAB 6
brick4xCubeData TAB 319.182 157.921 2.00008 TAB 6
brick4xCubeData TAB 321.182 157.921 3.00008 TAB 6
brick4xCubeData TAB 323.182 157.921 2.00008 TAB 6
brick4xCubeData TAB 325.182 157.921 2.00008 TAB 6
brick4xCubeData TAB 327.182 157.921 1.00008 TAB 6
brick4xCubeData TAB 329.182 157.921 2.00008 TAB 6
brick4xCubeData TAB 331.182 157.921 4.00008 TAB 6
brick4xCubeData TAB 333.182 157.921 3.00008 TAB 6
brick4xCubeData TAB 335.182 157.921 3.00008 TAB 6
brick4xCubeData TAB 337.182 157.921 4.00008 TAB 6
brick4xCubeData TAB 339.182 157.921 4.00008 TAB 6
brick4xCubeData TAB 341.182 157.921 3.00008 TAB 6
brick4xCubeData TAB 343.182 157.921 1.00008 TAB 6
brick4xCubeData TAB 345.182 157.921 2.00008 TAB 6
brick4xCubeData TAB 347.182 157.921 4.00008 TAB 6
brick4xCubeData TAB 349.182 157.921 3.00008 TAB 6
brick4xCubeData TAB 351.182 157.921 4.00008 TAB 6
brick4xCubeData TAB 353.182 157.921 5.00008 TAB 6
brick4xCubeData TAB 291.182 159.921 8.24332e-05 TAB 6
brick4xCubeData TAB 293.182 159.921 -0.999918 TAB 6

Then I call the function:
Code: [Select]
function buildString(%string,%client)
{
echo("buildString called");
for(%i=0;%i<getRecordCount(%string);%i++)
{
%currString = getRecord(%string,%i);
%brickDB = getField(%currString,0);
%bPos = getField(%currString,1);
%colorID = getField(%currString,2);

%brick = new fxDTSBrick()
{
datablock = %brickDB;
position = %bPos;
rotation = "0 0 1 90";
colorID = %colorID;
scale = "1 1 1";
angleID = 1;
client = %client;
isPlanted = 1;
};
if(%client.brickGroup)
{
%client.brickGroup.add(%brick);
}
%brick.setTrusted(1);
%brick.plant();
}
}

It will work fine the first time I call it, but if I clear the bricks and re-do the process, I get that error.

8.24332e-05

I really don't think .0000824332 is a valid position.

8.24332e-05

I really don't think .0000824332 is a valid position.
Would it not automatically round it to 0 when creating the brick?

Depends if it's read in as a string or not, considering the error, it probably does.

Depends if it's read in as a string or not, considering the error, it probably does.
I clamped those z values to 4 decimal places, but to no avail. I'm now getting the error on the first try.

Code: [Select]
brick4xCubeData TAB -23.5963 78.2299 0.0102 TAB 6
brick4xCubeData TAB -21.5963 78.2299 0.0102 TAB 6
brick4xCubeData TAB -19.5963 78.2299 0.0102 TAB 6
brick4xCubeData TAB -17.5963 78.2299 0.0102 TAB 6
brick4xCubeData TAB -15.5963 78.2299 0.0102 TAB 6
brick4xCubeData TAB -13.5963 78.2299 1.0102 TAB 6
brick4xCubeData TAB -11.5963 78.2299 0.0102 TAB 6
brick4xCubeData TAB -9.5963 78.2299 0.0102 TAB 6
brick4xCubeData TAB -7.5963 78.2299 2.0102 TAB 6
brick4xCubeData TAB -5.5963 78.2299 2.0102 TAB 6
brick4xCubeData TAB -3.5963 78.2299 1.0102 TAB 6
brick4xCubeData TAB -1.5963 78.2299 1.0102 TAB 6
brick4xCubeData TAB 0.4037 78.2299 2.0102 TAB 6
brick4xCubeData TAB 2.4037 78.2299 2.0102 TAB 6
brick4xCubeData TAB 4.4037 78.2299 1.0102 TAB 6
brick4xCubeData TAB 6.4037 78.2299 2.0102 TAB 6
brick4xCubeData TAB 8.4037 78.2299 2.0102 TAB 6
brick4xCubeData TAB 10.4037 78.2299 3.0102 TAB 6
brick4xCubeData TAB 12.4037 78.2299 1.0102 TAB 6
brick4xCubeData TAB 14.4037 78.2299 1.0102 TAB 6
brick4xCubeData TAB 16.4037 78.2299 3.0102 TAB 6
brick4xCubeData TAB 18.4037 78.2299 4.0102 TAB 6
brick4xCubeData TAB 20.4037 78.2299 2.0102 TAB 6
brick4xCubeData TAB 22.4037 78.2299 2.0102 TAB 6
brick4xCubeData TAB 24.4037 78.2299 5.0102 TAB 6
brick4xCubeData TAB 26.4037 78.2299 5.0102 TAB 6
brick4xCubeData TAB 28.4037 78.2299 3.0102 TAB 6
brick4xCubeData TAB 30.4037 78.2299 4.0102 TAB 6

If the error is reading a string, how do I prevent that? Possibly break up the 3 word position into each word, then piece it back together for the field in the created brick?
« Last Edit: February 20, 2012, 11:20:44 PM by Jardev »

Are those even valid positions?

Are those even valid positions?
I'm currently under the impression that creating a brick at the position "-23.5963 78.2299 0.0102" would actually create it at something like (just an example): "-23.5 78 0". I could be totally wrong, but I thought that was how brick creation worked.

I'm not sure if this helps, but in the console, it gives the following before crashing:
Code: [Select]
buildString called
octTree::insertBrick - maxed out re-rooting tree!
octTree::insertBrick - octTree is probably busted now!
octTree::insertBrick - this is really bad!
octTree::insertBrick - maxed out re-rooting tree!
octTree::insertBrick - octTree is probably busted now!
octTree::insertBrick - this is really bad!
octTree::insertBrick - maxed out re-rooting tree!
octTree::insertBrick - octTree is probably busted now!
octTree::insertBrick - this is really bad!
octTree::insertBrick - maxed out re-rooting tree!
octTree::insertBrick - octTree is probably busted now!
octTree::insertBrick - this is really bad!
octTree::insertBrick - maxed out re-rooting tree!
octTree::insertBrick - octTree is probably busted now!
octTree::insertBrick - this is really bad!
octTree::insertBrick - maxed out re-rooting tree!
octTree::insertBrick - octTree is probably busted now!
octTree::insertBrick - this is really bad!
Fatal-ISV: (/Users/erichartman/dev/Blockland/trunk/premake/BlocklandGame/../../engine/bricks/octNode.cpp @ 130) octNode::r_insertBrick - should never be considering a brick bigger than us here!
(It crashes instantly, this is just pulled from console.log)
« Last Edit: February 20, 2012, 11:28:27 PM by Jardev »

Maybe you're simply creating bricks too quickly?

Maybe you're simply creating bricks too quickly?
It's possible. I'll try spacing it out in chunks and see if that helps.

Try rounding the position correctly and ridding those exponential numbers.

There's a finite number of possible positions a brick can be in.

I'm pretty sure it has to be #.0, #.3, or #.6 -- anything else is invalid.

I'm pretty sure it has to be #.0, #.3, or #.6 -- anything else is invalid.
Not true, I created a script to make bezier curves out of 1x1's (Horribly spammy by the way) and it would generate odd positions like 2.69382 and 1.59348, stuff like that. It just rounds it off. It's definetly still valid.

It may round off for the visuals, but it's physical position will definitely forget stuff up.