Author Topic: Server Command - /removeHiddenBricks  (Read 831 times)

A nice way to reduce brick count, even if there are only a few.

It would remove bricks that are completely covered on all six sides.

This would be great. I'm sure it's pretty easy too.

The only thing this would affect is brick count; since those bricks aren't rendered, it wouldn't change amounts of lag.

The only thing this would affect is brick count; since those bricks aren't rendered, it wouldn't change amounts of lag.

Weren't the bricks rendered anyhow, because of the engine or something?

Weren't the bricks rendered anyhow, because of the engine or something?
Well probably when all the bricks are ghosting, but you don't continuously render them, otherwise large builds would run a whole lot slower.

I guess I don't know if some sort of collision box still exists in that spot, or how much data a brick takes up even though it isn't being rendered. It could possibly be worth it to delete those bricks in general.

The only thing this would affect is brick count; since those bricks aren't rendered, it wouldn't change amounts of lag.
Removing hidden bricks will actually decrease your framerate in many cases, since now the backsides of bricks that were covered now have to be rendered.

However, it could be useful if you needed to reduce your brick count because you just wanted to build something bigger though.

Not really sure how this would work.

Not really sure how this would work.
It would basically have to call for a "relay" to be fired in each direction on all bricks to check if all six sides respond.
(not literally, just the concept)

This is would be easy to code. Im not sure wether if statements work on TorqueScript or if its a lua thing but you could simply write a script that deletes bricks that have Rendering disabled....if thats what you mean by hidden bricks.

deletes bricks that have Rendering disabled....if thats what you mean by hidden bricks.
It would remove bricks that are completely covered on all six sides.

This is would be easy to code. Im not sure wether if statements work on TorqueScript or if its a lua thing but you could simply write a script that deletes bricks that have Rendering disabled....if thats what you mean by hidden bricks.

what

did you seriously just imply if statements are specific to lua?

This took me like 30 seconds. Untested.

Code: [Select]
function serverCmdRemoveHiddenBricks(%client)
{
%brickgroup = getBrickGroupFromObject(%client);
if(!isObject(%brickgroup))
{
messageClient(%client,'',"ERROR: Unable to find brickgroup.");
return;
}

%count = 0;
for(%i=0; %i < %brickgroup.getCount(); %i++)
{
%br = %brickgroup.getObject(%i);

if(!%br.iloveposed())
{
%br.delete();
%count ++;
}
}

messageClient(%client,'',%count SPC "hidden" SPC (%count == 1 ? "brick was" : "bricks were") SPC "removed.");
}


Pointless.

Removing hidden bricks will actually decrease your framerate in many cases, since now the backsides of bricks that were covered now have to be rendered.

Ah, I didn't think of that. I read Wedge's post completely wrong.

Alright, this is pointless. I'll lock it.