Currently the proc is activated on all players by using a for loop containing them. Which would be more efficient, having the global proc run the movement proc once per tick on players through a for loop, or give each player their own movement loop proc that runs independently?
Basically, this?
proc
WorldProc()
var/ticks=0
while(1)
for(var/mob/M in players)
M.StateMachine()
M.LocationUpdate()
M.oppositedir=M.BehindDir()
M.Movement()
if(M.escape)
M.escape-=1
if(M.escape<=0)
Flash(M,rgb(255,255,255))
M.escape=0
if(!(ticks % 5))
M.StaminaDrain()
ticks++
sleep(0.1)
or this?
mob
proc
MovementLoop()
set waitfor=0
while(src)
StateMachine()
LocationUpdate()
oppositedir=BehindDir()
Movement()
if(escape)
escape-=1
if(escape<=0)
Flash(src,rgb(255,255,255))
escape=0
if(!(ticks % 5))
StaminaDrain()
ticks++
sleep(0.1)
In short, I would not use the first loop as it has no ability to scale. I would recommend changing the second loop to run on demand, and also implement this (http://www.byond.com/forum/?post=2055964&first_unread=1). Cannot go wrong.