There is absolutely no reason you couldnt do a few simple optimizations to make it much faster.. for instance..

change this:
wait(1);

to something like this:
wait(5+random(10));

there are some otehr things to improve too.. but in general, the key is to spread out complex operations over time.. this is how you speed up all functions...so you only check every so often, with a random interval so all the loops dont run on the same frame..

as for other improvments..you would want to find out, whether a model is the wrong LOD for its distance...therefore, you have a skill set to 1,2,3 or something, and if its distance is in LOD range 3 ands its skill is set to 2, you need to morph it then and only then... so it doesnt do it every frame.


for instance:
Code:
 
define _LOD,skill1;
var LOD_dist_1=100;
var LOD_dist_2=300;
var LOD_dist_3=800;

function lod()
{
while(me)
{
temp=vec_dist(my.x,camera.x); //call vec_dist once per loop and store

if temp<LOD_dist_1 && my._LOD!=1
{
//morph to lod 1
my._LOD=1; //update the skill
wait(5+random(10); //make sure it doesnt run the loop for all entities on the same frame
continue; //end the loop early for speed reasons
}

if temp>LOD_dist_1 && temp<LOD_dist_2 && my._LOD!=2
{
//morph to lod 2
my._LOD=2; //update the skill
wait(5+random(10); //make sure it doesnt run the loop for all entities on the same frame
continue; //end the loop early for speed reasons
}

if temp>LOD_dist_2 && my._LOD!=3
{
//morph to lod 3
my._LOD=3; //update the skill
wait(5+random(10); //make sure it doesnt run the loop for all entities on the same frame
continue; //break the loop early for speed reasons
}
wait(5+random(10); //make sure it doesnt run the loop for all entities on the same frame

}

} [/ code]


Sphere Engine--the premier A6 graphics plugin.