var/tmp/def = 75 //Default CPU Usage, this is when the CPU reaches a certain maxpowerlevel, and goes into affect.
var/tmp/lagset = 0 //Custom Variable, if it is 0, default will be in affect, if 1 you will need to set the clag variable.
var/tmp/clag = 0 //Custom CPU Usage, this is when you select during you game play at what maxpowerlevel you want to put the Lag Guard into affect.
var/tmp/tick_mem = world.tick_lag //Your default tick lag
world
proc
Lag_Guard()
spawn while(1)
if(lagset == 0)
if(world.cpu >= def)
world.tick_lag += 0
world.tick_lag = round(world.tick_lag)
if(world.cpu < def)
if(world.tick_lag == tick_mem)
..()
else
world.tick_lag -= 0
world.tick_lag = round(world.tick_lag)
else
if(world.cpu >= clag)
world.tick_lag += 0
world.tick_lag = round(world.tick_lag)
if(world.cpu < clag)
if(world.tick_lag == tick_mem)
..()
else
world.tick_lag -= 0
world.tick_lag = round(world.tick_lag)
sleep(50) //Checks every 3 seconds
world
New()
..()
Lag_Guard()
Problem description:So the game I've been trying to run suddenly developed this weird tick tock lag. Server efficiency seems to be running perfectly fine, there is no "lag", so I am assuming it is a programming issue. I had not had this problem before, it just kind of showed up. Whenever you move, the movement seems ticky, like a robot that needs oil. I wouldn't know how else to explain this.
This kind of 'lag guard', and potentially all 'lag guards' are ineffective, and could actually screw up the game. The cause of lag could be a network thing on the side of the server, or the client. There's no real way for the programmer to properly diagnose that. Other than that, it could be an issue somewhere in the program. Check the Profiler to see what's taking up a lot of memory, or taking an extra long time to do.
CPU is not a good determinant for this kind of thing, and tick_lag is an essential part of the engine, changing it can effect loops, movement, and so on. This 'lag guard' also adds an extra process to the world, which could also cause lag.