Cpaz
Member
Recently, I've been putting together a better system of pathfinding. Now that it works, I need it to run well with a decent number of enemies.
The path is defined the the create event of the parent object as so:
The "end step" event handles the use of the path found and detects if the is a path:
Then there is the alarm referenced in the above snippet:
This is all very basic, but in practice, I cannot have 10 enemies on screen and have above ~10FPS (it ranges from 30-120 by manual settings)
Is there something I'm missing in setting this up?
The path is defined the the create event of the parent object as so:
Code:
///collision testing
path=path_add();
Code:
//DEFAULT MOVEMENT
if !custommov{//default movement
if distance_to_object(in)>chdist{ //"Gotta get closer!"
if mp_potential_path_object(path,inx,iny,sp/delta,2,obj_solid){
path_start(path,sp/delta,path_action_stop,true);
can_at=false;
}
else{
if alarm[6]=-1
alarm[6]=(90+irandom(90))*delta;
//basically means 2 second plus a random number between 2 seconds
}
}
if distance_to_object(in)<=chdist{ //"Too close."
path_end();
speed=0;
can_at=true;
}
}
Code:
///set path
path_clear_points(path);
mp_potential_path_object(path,inx,iny,sp/delta,2,obj_solid);
Is there something I'm missing in setting this up?