Game Development Community

Constructor speedup

by Brian Lisbon · in Constructor · 12/07/2011 (4:07 pm) · 1 replies

Most of the slowness of Constructor comes from the script side, so here are some script hacks to patch it.

(no warranties whatsoever for the below scripts or how you decide to use them)

------------------------------------------

Brush / Entity tree:

If you have over 1000 brushes in your map, you know Constructor can be terribly slow to work with. The tree view, which lists entities, brushes, and their faces, is updated each time you make a brush selection.

To delete it, add the following script to Constructor's main.cs:

function scanforEx(%group)
{
  if (%group $= "")
    %group = RootGroup;
  for (%i = 0; %i < %group.getCount(); %i++)
  {
    %obj = %group.getObject(%i);
    if (%obj.getClassName() $= "GuiTreeViewCtrlEx" && %obj.getName() $= "")
    {
	    echo("DELETING GuiTreeViewCtrlEx " @ %obj.getID() @ ", which resides in group " @ %group.getID());
      %obj.delete();
    }
    else if (%obj.isMemberOfClass("SimGroup"))
	    scanforEx(%obj, %destroy);
  }
}
schedule(10000, 0, "scanforEx");

(it's reversable by removing the script; this won't mess with your layout form content)

------------------------------------------

Face values update:

When selecting faces, the selection routine iterates through each face you've selected and updates the face texturing values to reflect the selection's data.

This becomes a problem when you select MANY faces, especially by box select.

To make the update more logical (makes it run only once after everything has been selected), add the following script to Constructor's main.cs:

package nope {

function FacePropertiesForm::updateFaces(%this, %a, %b, %c, %d, %e, %f, %fromschedule)
{
  //ECHO("UPDATE FACES OVERRIDE!");
  if (!%fromschedule)
  {
    ///ECHO("NOT FROM SCHEDULE!");
    cancel(%this.cancelme);
    %this.cancelme = %this.schedule(25, "updateFaces", %a, %b, %c, %d, %e, %f, 1);
    return 1;
  }
  //ECHO("COMING FROM SCHEDULE!");
  deactivatePackage(nope);
  %this.updateFaces(%this, %a, %b, %c, %d, %e, %f);
  activatePackage(nope);
}
};
activatePackage(nope);

About the author

Recent Threads


#1
12/09/2011 (9:34 am)
Thanx, what a briljant ide!

Hopefully there will be some updates to this great tool. It's realy easy to start to work with compared to many other tools. (At least in my opinion due to the fact that i use it only when i have some spare time, so it means that it feels like starting over everytime :-)

Best regards
Kaj