diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index cb363880fff..c76e04fc9d8 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -607,6 +607,17 @@ if("disable_karma") disable_karma = 1 + if("tick_limit_mc_init") + tick_limit_mc_init = text2num(value) + if("base_mc_tick_rate") + base_mc_tick_rate = text2num(value) + if("high_pop_mc_tick_rate") + high_pop_mc_tick_rate = text2num(value) + if("high_pop_mc_mode_amount") + high_pop_mc_mode_amount = text2num(value) + if("disable_high_pop_mc_mode_amount") + disable_high_pop_mc_mode_amount = text2num(value) + else diary << "Unknown setting in configuration: '[name]'" diff --git a/code/controllers/failsafe.dm b/code/controllers/failsafe.dm index 232a6bd054b..b3a47e3ce22 100644 --- a/code/controllers/failsafe.dm +++ b/code/controllers/failsafe.dm @@ -51,14 +51,14 @@ var/global/datum/controller/failsafe/Failsafe if(4,5) --defcon if(3) - message_admins("Notice: DEFCON [defcon_pretty()]. The Master Controller has not fired in the last [(5-defcon) * processing_interval] ticks.") + message_admins("Notice: DEFCON [defcon_pretty()]. The Master Controller has not fired in the last [(5 - defcon) * processing_interval] ticks.") --defcon if(2) - to_chat(admins, "Warning: DEFCON [defcon_pretty()]. The Master Controller has not fired in the last [(5-defcon) * processing_interval] ticks. Automatic restart in [processing_interval] ticks.") + to_chat(admins, "Warning: DEFCON [defcon_pretty()]. The Master Controller has not fired in the last [(5 - defcon) * processing_interval] ticks. Automatic restart in [processing_interval] ticks.") --defcon if(1) - to_chat(admins, "Warning: DEFCON [defcon_pretty()]. The Master Controller has still not fired within the last [(5-defcon) * processing_interval] ticks. Killing and restarting...") + to_chat(admins, "Warning: DEFCON [defcon_pretty()]. The Master Controller has still not fired within the last [(5 - defcon) * processing_interval] ticks. Killing and restarting...") --defcon var/rtn = Recreate_MC() if(rtn > 0) @@ -79,8 +79,8 @@ var/global/datum/controller/failsafe/Failsafe else defcon = min(defcon + 1,5) master_iteration = Master.iteration - if (defcon <= 1) - sleep(processing_interval*2) + if(defcon <= 1) + sleep(processing_interval * 2) else sleep(processing_interval) else diff --git a/code/controllers/master.dm b/code/controllers/master.dm index 6c094208926..8aa1f1b0873 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -72,8 +72,8 @@ GLOBAL_REAL(Master, /datum/controller/master) = new var/list/_subsystems = list() subsystems = _subsystems - if (Master != src) - if (istype(Master)) + if(Master != src) + if(istype(Master)) Recover() qdel(Master) else @@ -104,9 +104,9 @@ GLOBAL_REAL(Master, /datum/controller/master) = new // -1 if we encountered a runtime trying to recreate it /proc/Recreate_MC() . = -1 //so if we runtime, things know we failed - if (world.time < Master.restart_timeout) + if(world.time < Master.restart_timeout) return 0 - if (world.time < Master.restart_clear) + if(world.time < Master.restart_clear) Master.restart_count *= 0.5 var/delay = 50 * ++Master.restart_count @@ -122,13 +122,13 @@ GLOBAL_REAL(Master, /datum/controller/master) = new /datum/controller/master/Recover() var/msg = "## DEBUG: [time2text(world.timeofday)] MC restarted. Reports:\n" - for (var/varname in Master.vars) + for(var/varname in Master.vars) switch (varname) if("name", "tag", "bestF", "type", "parent_type", "vars", "statclick") // Built-in junk. continue else var/varval = Master.vars[varname] - if (istype(varval, /datum)) // Check if it has a type var. + if(istype(varval, /datum)) // Check if it has a type var. var/datum/D = varval msg += "\t [varname] = [D]([D.type])\n" else @@ -151,7 +151,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new to_chat(admins, "[msg]") log_to_dd(msg) - if (istype(Master.subsystems)) + if(istype(Master.subsystems)) if(FireHim) Master.subsystems += new BadBoy.type //NEW_SS_GLOBAL will remove the old one subsystems = Master.subsystems @@ -181,8 +181,8 @@ GLOBAL_REAL(Master, /datum/controller/master) = new var/start_timeofday = REALTIMEOFDAY // Initialize subsystems. current_ticklimit = config.tick_limit_mc_init - for (var/datum/controller/subsystem/SS in subsystems) - if (SS.flags & SS_NO_INIT) + for(var/datum/controller/subsystem/SS in subsystems) + if(SS.flags & SS_NO_INIT) continue SS.Initialize(REALTIMEOFDAY) CHECK_TICK @@ -193,7 +193,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new to_chat(world, "[msg]") log_to_dd(msg) - if (!current_runlevel) + if(!current_runlevel) SetRunLevel(1) // Sort subsystems by display setting for easy access. @@ -226,13 +226,13 @@ GLOBAL_REAL(Master, /datum/controller/master) = new sleep(delay) testing("Master starting processing") var/rtn = Loop() - if (rtn > 0 || processing < 0) + if(rtn > 0 || processing < 0) return //this was suppose to happen. //loop ended, restart the mc log_game("MC crashed or runtimed, restarting") message_admins("MC crashed or runtimed, restarting") var/rtn2 = Recreate_MC() - if (rtn2 <= 0) + if(rtn2 <= 0) log_game("Failed to recreate MC (Error code: [rtn2]), it's up to the failsafe now") message_admins("Failed to recreate MC (Error code: [rtn2]), it's up to the failsafe now") Failsafe.defcon = 2 @@ -247,15 +247,15 @@ GLOBAL_REAL(Master, /datum/controller/master) = new var/list/tickersubsystems = list() var/list/runlevel_sorted_subsystems = list(list(), list(), list(), list(), list(), list(), list(), list()) //ensure we always have as many runlevels as we need to operate with no subsystems (8 currently) var/timer = world.time - for (var/thing in subsystems) + for(var/thing in subsystems) var/datum/controller/subsystem/SS = thing - if (SS.flags & SS_NO_FIRE) + if(SS.flags & SS_NO_FIRE) continue SS.queued_time = 0 SS.queue_next = null SS.queue_prev = null SS.state = SS_IDLE - if (SS.flags & SS_TICKER) + if(SS.flags & SS_TICKER) tickersubsystems += SS timer += world.tick_lag * rand(1, 5) SS.next_fire = timer @@ -293,10 +293,10 @@ GLOBAL_REAL(Master, /datum/controller/master) = new var/list/subsystems_to_check //the actual loop. - while (1) + while(1) tickdrift = max(0, MC_AVERAGE_FAST(tickdrift, (((REALTIMEOFDAY - init_timeofday) - (world.time - init_time)) / world.tick_lag))) var/starting_tick_usage = TICK_USAGE - if (processing <= 0) + if(processing <= 0) current_ticklimit = TICK_LIMIT_RUNNING sleep(10) continue @@ -304,31 +304,31 @@ GLOBAL_REAL(Master, /datum/controller/master) = new //Anti-tick-contention heuristics: //if there are mutiple sleeping procs running before us hogging the cpu, we have to run later. // (because sleeps are processed in the order received, longer sleeps are more likely to run first) - if (starting_tick_usage > TICK_LIMIT_MC) //if there isn't enough time to bother doing anything this tick, sleep a bit. + if(starting_tick_usage > TICK_LIMIT_MC) //if there isn't enough time to bother doing anything this tick, sleep a bit. sleep_delta *= 2 current_ticklimit = TICK_LIMIT_RUNNING * 0.5 sleep(world.tick_lag * (processing * sleep_delta)) continue //Byond resumed us late. assume it might have to do the same next tick - if (last_run + CEILING(world.tick_lag * (processing * sleep_delta), world.tick_lag) < world.time) + if(last_run + CEILING(world.tick_lag * (processing * sleep_delta), world.tick_lag) < world.time) sleep_delta += 1 sleep_delta = MC_AVERAGE_FAST(sleep_delta, 1) //decay sleep_delta - if (starting_tick_usage > (TICK_LIMIT_MC*0.75)) //we ran 3/4 of the way into the tick + if(starting_tick_usage > (TICK_LIMIT_MC * 0.75)) //we ran 3/4 of the way into the tick sleep_delta += 1 //debug - if (make_runtime) + if(make_runtime) var/datum/controller/subsystem/SS SS.can_fire = 0 - if (!Failsafe || (Failsafe.processing_interval > 0 && (Failsafe.lasttick+(Failsafe.processing_interval*5)) < world.time)) + if(!Failsafe || (Failsafe.processing_interval > 0 && (Failsafe.lasttick + (Failsafe.processing_interval * 5)) < world.time)) new/datum/controller/failsafe() // (re)Start the failsafe. //now do the actual stuff - if (!queue_head || !(iteration % 3)) + if(!queue_head || !(iteration % 3)) var/checking_runlevel = current_runlevel if(cached_runlevel != checking_runlevel) //resechedule subsystems @@ -345,30 +345,30 @@ GLOBAL_REAL(Master, /datum/controller/master) = new else subsystems_to_check = tickersubsystems - if (CheckQueue(subsystems_to_check) <= 0) - if (!SoftReset(tickersubsystems, runlevel_sorted_subsystems)) + if(CheckQueue(subsystems_to_check) <= 0) + if(!SoftReset(tickersubsystems, runlevel_sorted_subsystems)) log_to_dd("MC: SoftReset() failed, crashing") return - if (!error_level) + if(!error_level) iteration++ error_level++ current_ticklimit = TICK_LIMIT_RUNNING sleep(10) continue - if (queue_head) - if (RunQueue() <= 0) - if (!SoftReset(tickersubsystems, runlevel_sorted_subsystems)) + if(queue_head) + if(RunQueue() <= 0) + if(!SoftReset(tickersubsystems, runlevel_sorted_subsystems)) log_to_dd("MC: SoftReset() failed, crashing") return - if (!error_level) + if(!error_level) iteration++ error_level++ current_ticklimit = TICK_LIMIT_RUNNING sleep(10) continue error_level-- - if (!queue_head) //reset the counts if the queue is empty, in the off chance they get out of sync + if(!queue_head) //reset the counts if the queue is empty, in the off chance they get out of sync queue_priority_count = 0 queue_priority_count_bg = 0 @@ -376,7 +376,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new last_run = world.time src.sleep_delta = MC_AVERAGE_FAST(src.sleep_delta, sleep_delta) current_ticklimit = TICK_LIMIT_RUNNING - if (processing * sleep_delta <= world.tick_lag) + if(processing * sleep_delta <= world.tick_lag) current_ticklimit -= (TICK_LIMIT_RUNNING * 0.25) //reserve the tail 1/4 of the next tick for the mc if we plan on running next tick sleep(world.tick_lag * (processing * sleep_delta)) @@ -391,21 +391,21 @@ GLOBAL_REAL(Master, /datum/controller/master) = new var/datum/controller/subsystem/SS var/SS_flags - for (var/thing in subsystemstocheck) - if (!thing) + for(var/thing in subsystemstocheck) + if(!thing) subsystemstocheck -= thing SS = thing - if (SS.state != SS_IDLE) + if(SS.state != SS_IDLE) continue - if (SS.can_fire <= 0) + if(SS.can_fire <= 0) continue - if (SS.next_fire > world.time) + if(SS.next_fire > world.time) continue SS_flags = SS.flags - if (SS_flags & SS_NO_FIRE) + if(SS_flags & SS_NO_FIRE) subsystemstocheck -= SS continue - if (!(SS_flags & SS_TICKER) && (SS_flags & SS_KEEP_TIMING) && SS.last_fire + (SS.wait * 0.75) > world.time) + if(!(SS_flags & SS_TICKER) && (SS_flags & SS_KEEP_TIMING) && SS.last_fire + (SS.wait * 0.75) > world.time) continue SS.enqueue() . = 1 @@ -429,13 +429,13 @@ GLOBAL_REAL(Master, /datum/controller/master) = new //keep running while we have stuff to run and we haven't gone over a tick // this is so subsystems paused eariler can use tick time that later subsystems never used - while (ran && queue_head && TICK_USAGE < TICK_LIMIT_MC) + while(ran && queue_head && TICK_USAGE < TICK_LIMIT_MC) ran = FALSE bg_calc = FALSE current_tick_budget = queue_priority_count queue_node = queue_head - while (queue_node) - if (ran && TICK_USAGE > TICK_LIMIT_RUNNING) + while(queue_node) + if(ran && TICK_USAGE > TICK_LIMIT_RUNNING) break queue_node_flags = queue_node.flags @@ -446,8 +446,8 @@ GLOBAL_REAL(Master, /datum/controller/master) = new //we bump up their priority and attempt to run them next tick //(unless we haven't even ran anything this tick, since its unlikely they will ever be able run // in those cases, so we just let them run) - if (queue_node_flags & SS_NO_TICK_CHECK) - if (queue_node.tick_usage > TICK_LIMIT_RUNNING - TICK_USAGE && ran_non_ticker) + if(queue_node_flags & SS_NO_TICK_CHECK) + if(queue_node.tick_usage > TICK_LIMIT_RUNNING - TICK_USAGE && ran_non_ticker) queue_node.queued_priority += queue_priority_count * 0.1 queue_priority_count -= queue_node_priority queue_priority_count += queue_node.queued_priority @@ -455,22 +455,22 @@ GLOBAL_REAL(Master, /datum/controller/master) = new queue_node = queue_node.queue_next continue - if ((queue_node_flags & SS_BACKGROUND) && !bg_calc) + if((queue_node_flags & SS_BACKGROUND) && !bg_calc) current_tick_budget = queue_priority_count_bg bg_calc = TRUE tick_remaining = TICK_LIMIT_RUNNING - TICK_USAGE - if (current_tick_budget > 0 && queue_node_priority > 0) + if(current_tick_budget > 0 && queue_node_priority > 0) tick_precentage = tick_remaining / (current_tick_budget / queue_node_priority) else tick_precentage = tick_remaining - tick_precentage = max(tick_precentage*0.5, tick_precentage-queue_node.tick_overrun) + tick_precentage = max(tick_precentage*0.5, tick_precentage - queue_node.tick_overrun) current_ticklimit = round(TICK_USAGE + tick_precentage) - if (!(queue_node_flags & SS_TICKER)) + if(!(queue_node_flags & SS_TICKER)) ran_non_ticker = TRUE ran = TRUE @@ -483,17 +483,17 @@ GLOBAL_REAL(Master, /datum/controller/master) = new var/state = queue_node.ignite(queue_node_paused) tick_usage = TICK_USAGE - tick_usage - if (state == SS_RUNNING) + if(state == SS_RUNNING) state = SS_IDLE current_tick_budget -= queue_node_priority - if (tick_usage < 0) + if(tick_usage < 0) tick_usage = 0 - queue_node.tick_overrun = max(0, MC_AVG_FAST_UP_SLOW_DOWN(queue_node.tick_overrun, tick_usage-tick_precentage)) + queue_node.tick_overrun = max(0, MC_AVG_FAST_UP_SLOW_DOWN(queue_node.tick_overrun, tick_usage - tick_precentage)) queue_node.state = state - if (state == SS_PAUSED) + if(state == SS_PAUSED) queue_node.paused_ticks++ queue_node.paused_tick_usage += tick_usage queue_node = queue_node.queue_next @@ -508,7 +508,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new queue_node.paused_ticks = 0 queue_node.paused_tick_usage = 0 - if (queue_node_flags & SS_BACKGROUND) //update our running total + if(queue_node_flags & SS_BACKGROUND) //update our running total queue_priority_count_bg -= queue_node_priority else queue_priority_count -= queue_node_priority @@ -516,14 +516,14 @@ GLOBAL_REAL(Master, /datum/controller/master) = new queue_node.last_fire = world.time queue_node.times_fired++ - if (queue_node_flags & SS_TICKER) + if(queue_node_flags & SS_TICKER) queue_node.next_fire = world.time + (world.tick_lag * queue_node.wait) - else if (queue_node_flags & SS_POST_FIRE_TIMING) - queue_node.next_fire = world.time + queue_node.wait + (world.tick_lag * (queue_node.tick_overrun/100)) - else if (queue_node_flags & SS_KEEP_TIMING) + else if(queue_node_flags & SS_POST_FIRE_TIMING) + queue_node.next_fire = world.time + queue_node.wait + (world.tick_lag * (queue_node.tick_overrun / 100)) + else if(queue_node_flags & SS_KEEP_TIMING) queue_node.next_fire += queue_node.wait else - queue_node.next_fire = queue_node.queued_time + queue_node.wait + (world.tick_lag * (queue_node.tick_overrun/100)) + queue_node.next_fire = queue_node.queued_time + queue_node.wait + (world.tick_lag * (queue_node.tick_overrun / 100)) queue_node.queued_time = 0 @@ -539,16 +539,16 @@ GLOBAL_REAL(Master, /datum/controller/master) = new /datum/controller/master/proc/SoftReset(list/ticker_SS, list/runlevel_SS) . = 0 log_to_dd("MC: SoftReset called, resetting MC queue state.") - if (!istype(subsystems) || !istype(ticker_SS) || !istype(runlevel_SS)) + if(!istype(subsystems) || !istype(ticker_SS) || !istype(runlevel_SS)) log_to_dd("MC: SoftReset: Bad list contents: '[subsystems]' '[ticker_SS]' '[runlevel_SS]'") return var/subsystemstocheck = subsystems + ticker_SS for(var/I in runlevel_SS) subsystemstocheck |= I - for (var/thing in subsystemstocheck) + for(var/thing in subsystemstocheck) var/datum/controller/subsystem/SS = thing - if (!SS || !istype(SS)) + if(!SS || !istype(SS)) //list(SS) is so if a list makes it in the subsystem list, we remove the list, not the contents subsystems -= list(SS) ticker_SS -= list(SS) @@ -556,19 +556,19 @@ GLOBAL_REAL(Master, /datum/controller/master) = new I -= list(SS) log_to_dd("MC: SoftReset: Found bad entry in subsystem list, '[SS]'") continue - if (SS.queue_next && !istype(SS.queue_next)) + if(SS.queue_next && !istype(SS.queue_next)) log_to_dd("MC: SoftReset: Found bad data in subsystem queue, queue_next = '[SS.queue_next]'") SS.queue_next = null - if (SS.queue_prev && !istype(SS.queue_prev)) + if(SS.queue_prev && !istype(SS.queue_prev)) log_to_dd("MC: SoftReset: Found bad data in subsystem queue, queue_prev = '[SS.queue_prev]'") SS.queue_prev = null SS.queued_priority = 0 SS.queued_time = 0 SS.state = SS_IDLE - if (queue_head && !istype(queue_head)) + if(queue_head && !istype(queue_head)) log_to_dd("MC: SoftReset: Found bad data in subsystem queue, queue_head = '[queue_head]'") queue_head = null - if (queue_tail && !istype(queue_tail)) + if(queue_tail && !istype(queue_tail)) log_to_dd("MC: SoftReset: Found bad data in subsystem queue, queue_tail = '[queue_tail]'") queue_tail = null queue_priority_count = 0 @@ -582,9 +582,10 @@ GLOBAL_REAL(Master, /datum/controller/master) = new if(!statclick) statclick = new/obj/effect/statclick/debug(src, "Initializing...") - stat("Byond:", "(FPS:[world.fps]) (TickCount:[world.time/world.tick_lag]) (TickDrift:[round(Master.tickdrift,1)]([round((Master.tickdrift/(world.time/world.tick_lag))*100,0.1)]%))") - stat("Master Controller:", statclick.update("(TickRate:[Master.processing]) (Iteration:[Master.iteration])")) + stat("Byond", "(FPS:[world.fps]) (TickCount:[world.time/world.tick_lag]) (TickDrift:[round(Master.tickdrift,1)]([round((Master.tickdrift/(world.time/world.tick_lag))*100,0.1)]%))") + stat("Master Controller", statclick.update("(TickRate:[Master.processing]) (Iteration:[Master.iteration])")) +// Currently unimplemented /datum/controller/master/StartLoadingMap() //disallow more than one map to load at once, multithreading it will just cause race conditions while(map_loading) @@ -602,10 +603,10 @@ GLOBAL_REAL(Master, /datum/controller/master) = new /datum/controller/master/proc/UpdateTickRate() - if (!processing) + if(!processing) return var/client_count = length(clients) - if (client_count < config.disable_high_pop_mc_mode_amount) + if(client_count < config.disable_high_pop_mc_mode_amount) processing = config.base_mc_tick_rate - else if (client_count > config.high_pop_mc_mode_amount) + else if(client_count > config.high_pop_mc_mode_amount) processing = config.high_pop_mc_tick_rate diff --git a/code/controllers/subsystem.dm b/code/controllers/subsystem.dm index 0ffd9e09d35..a78750bf8d0 100644 --- a/code/controllers/subsystem.dm +++ b/code/controllers/subsystem.dm @@ -50,9 +50,9 @@ . = SS_SLEEPING fire(resumed) . = state - if (state == SS_SLEEPING) + if(state == SS_SLEEPING) state = SS_IDLE - if (state == SS_PAUSING) + if(state == SS_PAUSING) var/QT = queued_time enqueue() state = SS_PAUSED @@ -82,48 +82,48 @@ var/queue_node_priority var/queue_node_flags - for (queue_node = Master.queue_head; queue_node; queue_node = queue_node.queue_next) + for(queue_node = Master.queue_head; queue_node; queue_node = queue_node.queue_next) queue_node_priority = queue_node.queued_priority queue_node_flags = queue_node.flags - if (queue_node_flags & SS_TICKER) - if (!(SS_flags & SS_TICKER)) + if(queue_node_flags & SS_TICKER) + if(!(SS_flags & SS_TICKER)) continue - if (queue_node_priority < SS_priority) + if(queue_node_priority < SS_priority) break - else if (queue_node_flags & SS_BACKGROUND) - if (!(SS_flags & SS_BACKGROUND)) + else if(queue_node_flags & SS_BACKGROUND) + if(!(SS_flags & SS_BACKGROUND)) break - if (queue_node_priority < SS_priority) + if(queue_node_priority < SS_priority) break else - if (SS_flags & SS_BACKGROUND) + if(SS_flags & SS_BACKGROUND) continue - if (SS_flags & SS_TICKER) + if(SS_flags & SS_TICKER) break - if (queue_node_priority < SS_priority) + if(queue_node_priority < SS_priority) break queued_time = world.time queued_priority = SS_priority state = SS_QUEUED - if (SS_flags & SS_BACKGROUND) //update our running total + if(SS_flags & SS_BACKGROUND) //update our running total Master.queue_priority_count_bg += SS_priority else Master.queue_priority_count += SS_priority queue_next = queue_node - if (!queue_node)//we stopped at the end, add to tail + if(!queue_node)//we stopped at the end, add to tail queue_prev = Master.queue_tail - if (Master.queue_tail) + if(Master.queue_tail) Master.queue_tail.queue_next = src else //empty queue, we also need to set the head Master.queue_head = src Master.queue_tail = src - else if (queue_node == Master.queue_head)//insert at start of list + else if(queue_node == Master.queue_head)//insert at start of list Master.queue_head.queue_prev = src Master.queue_head = src queue_prev = null @@ -134,16 +134,16 @@ /datum/controller/subsystem/proc/dequeue() - if (queue_next) + if(queue_next) queue_next.queue_prev = queue_prev - if (queue_prev) + if(queue_prev) queue_prev.queue_next = queue_next - if (src == Master.queue_tail) + if(src == Master.queue_tail) Master.queue_tail = queue_prev - if (src == Master.queue_head) + if(src == Master.queue_head) Master.queue_head = queue_next queued_time = 0 - if (state == SS_QUEUED) + if(state == SS_QUEUED) state = SS_IDLE @@ -171,27 +171,27 @@ statclick = new/obj/effect/statclick/debug(src, "Initializing...") if(can_fire && !(SS_NO_FIRE & flags)) - msg = "[round(cost,1)]ms|[round(tick_usage,1)]%([round(tick_overrun,1)]%)|[round(ticks,0.1)]\t[msg]" + msg = "[round(cost, 1)]ms|[round(tick_usage, 1)]%([round(tick_overrun, 1)]%)|[round(ticks, 0.1)]\t[msg]" else msg = "OFFLINE\t[msg]" var/title = name - if (can_fire) + if(can_fire) title = "\[[state_letter()]][title]" stat(title, statclick.update(msg)) /datum/controller/subsystem/proc/state_letter() - switch (state) - if (SS_RUNNING) + switch(state) + if(SS_RUNNING) . = "R" - if (SS_QUEUED) + if(SS_QUEUED) . = "Q" - if (SS_PAUSED, SS_PAUSING) + if(SS_PAUSED, SS_PAUSING) . = "P" - if (SS_SLEEPING) + if(SS_SLEEPING) . = "S" - if (SS_IDLE) + if(SS_IDLE) . = " " //could be used to postpone a costly subsystem for (default one) var/cycles, cycles @@ -205,11 +205,11 @@ /datum/controller/subsystem/Recover() /datum/controller/subsystem/vv_edit_var(var_name, var_value) - switch (var_name) - if ("can_fire") + switch(var_name) + if("can_fire") //this is so the subsystem doesn't rapid fire to make up missed ticks causing more lag - if (var_value) + if(var_value) next_fire = world.time + wait - if ("queued_priority") //editing this breaks things. + if("queued_priority") //editing this breaks things. return 0 . = ..() diff --git a/config/example/config.txt b/config/example/config.txt index 2dcd5da6573..0f0b1eb57f2 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -347,3 +347,27 @@ DISABLE_SPACE_RUINS ## Uncomment this to disable karma and unlock all karma purchases for players by default #DISABLE_KARMA + +## Defines the ticklimit for subsystem initialization (In percents of a byond tick). Lower makes world start smoother. Higher makes it faster. +##This is currently a testing optimized setting. A good value for production would be 98. +TICK_LIMIT_MC_INIT 500 + +###Master Controller High Pop Mode### + +##The Master Controller(MC) is the primary system controlling timed tasks and events in SS13 (lobby timer, game checks, lighting updates, atmos, etc) +##Default base MC tick rate (1 = process every "byond tick" (see: tick_lag/fps config settings), 2 = process every 2 byond ticks, etc) +## Setting this to 0 will prevent the Master Controller from ticking +BASE_MC_TICK_RATE 1 + +##High population MC tick rate +## Byond rounds timer values UP, but the tick rate is modified with heuristics during lag spites so setting this to something like 2 +## will make it run every 2 byond ticks, but will also double the effect of anti-lag heuristics. You can instead set it to something like +## 1.1 to make it run every 2 byond ticks, but only increase the effect of anti-lag heuristics by 10%. or 1.5 for 50%. +## (As an aside, you could in theory also reduce the effect of anti-lag heuristics in the base tick rate by setting it to something like 0.5) +HIGH_POP_MC_TICK_RATE 1.1 + +##Engage high pop mode if player count raises above this (Player in this context means any connected user. Lobby, ghost or in-game all count) +HIGH_POP_MC_MODE_AMOUNT 65 + +##Disengage high pop mode if player count drops below this +DISABLE_HIGH_POP_MC_MODE_AMOUNT 60 \ No newline at end of file