Hello there!
Your isometric behavior is awesome but when the game have big layouts with lots of objects the game gets really slow.
I've tested with a layout that had about 1000 objects with your iso and the preview was running at ~5 fps
(With the behavior disabled it was running at 60fps)
Then I've made some changes on the runtime.js of the behavior to ignore all objects outside of the canvas completely and creates an array of references to the remaining objects index numbers before looping over and over again.
Now running at 60fps with the same amount of objects without messing the sorting.
behinstProto.tick = function ()
{
//alert(window.rojoList.length);
var refList=[];
var isoList = this.type.isoList;
if(this === isoList[0])
{
for (a=0; a < isoList.length;a++)
{
var isoA = isoList[a];
if(this.IsInstOnScreen(isoA.inst))
{
refList.push(a);
}
else
{
isoList[a].behind.length=0;
}
}
}
if (this === isoList[0] && (this.type.state.enabled || this.type.state.sortOnce)) // only run once
{
this.type.state.sortOnce = false;
var isoA, isoB, a, b, c=0;
// updade positions from isometric positions
for (a=0; a<refList.length; a++)
{
isoA = isoList[refList[a]];
//isoA.updatePosFromIso();
isoA.inst.update_bbox();
isoA.visited=false;
}
// build dependency graph
for (a=0; a<refList.length; a++)
{
isoA = isoList[refList[a]];
// culling
if (!isoA.visited && !isoA.inst.visible && !this.IsInstOnScreen(isoA.inst))
{
isoA.visited=true;
continue;
}
for (b=0; b<refList.length; b++)
{
isoB = isoList[refList[b]];
// culling
/*if (!isoB.visited && !isoB.inst.visible && !this.IsInstOnScreen(isoB.inst))
{
isoB.visited=true;
continue;
}*/
if ( isoA != isoB
&& isoA.inst.bbox.intersects_rect(isoB.inst.bbox) //bounding box check
&& isoA.ix-isoA.sx/2 < isoB.ix+isoB.sx/2 -0.001
&& isoA.iy-isoA.sy/2 < isoB.iy+isoB.sy/2 -0.001
&& isoA.iz-isoA.sz/2 < isoB.iz+isoB.sz/2 -0.001)
{
isoA.behind.push(isoB);
c++;
}
}
}
// topo sort
for (a=0; a<refList.length; a++)
isoList[refList[a]].visitNode();
}
};
[/code:1s0bhs7i]
\o/