From 34e46807e98ba3cb140f25060c69b59d3754b35e Mon Sep 17 00:00:00 2001 From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Date: Mon, 3 May 2021 19:32:16 +0100 Subject: [PATCH] MC Configuration --- .github/DOWNLOADING.md | 9 ++-- code/controllers/configuration.dm | 25 ----------- .../configuration/__config_defines.dm | 4 +- .../configuration/configuration_core.dm | 6 +++ .../sections/afk_configuration.dm | 8 ++-- .../sections/database_configuration.dm | 10 ++--- .../sections/mc_configuration.dm | 23 ++++++++++ code/controllers/master.dm | 12 ++--- code/game/world.dm | 3 -- code/modules/mob/login.dm | 4 -- config/example/config.toml | 44 +++++++++---------- paradise.dme | 1 + 12 files changed, 72 insertions(+), 77 deletions(-) create mode 100644 code/controllers/configuration/sections/mc_configuration.dm diff --git a/.github/DOWNLOADING.md b/.github/DOWNLOADING.md index eaad0dee7f9..27731066cae 100644 --- a/.github/DOWNLOADING.md +++ b/.github/DOWNLOADING.md @@ -41,15 +41,14 @@ something has gone wrong - possibly a corrupt download or the files extracted wr or a code issue on the main repo. Feel free to ask on Discord. Once that's done, open up the config folder. -Firstly, you will want to copy everything from the example folder into the regular config folder. -EG: Move `config/example/config.txt` to `config/config.txt`, and do the same for all the other files. -You'll want to edit `config.txt` to set your server location, +Firstly, you will want to copy `config.toml` from the example folder into the regular config folder. +You'll want to edit the url configuration section of `config.toml` to set your server location, so that all your players don't get disconnected at the end of each round. It's recommended you don't turn on the gamemodes with probability 0, as they have various issues and aren't currently being tested, so they may have unknown and bizarre bugs. -You'll also want to edit admins.txt to remove the default admins and add your own. +You'll also want to edit the admin configuration of `config.toml` to remove the default admins and add your own. If you are connecting from localhost to your own test server, you should automatically be admin. "Host" is the highest level of access, and the other recommended admin levels for now are "Game Admin" and "Moderator". The format is: @@ -60,7 +59,7 @@ If you are connecting from localhost to your own test server, you should automat where the BYOND key must be in lowercase and the admin rank must be properly capitalised. There are a bunch more admin ranks, but these two should be enough for most servers, -assuming you have trustworthy admins. You can define your own ranks in `admin_ranks.txt` +assuming you have trustworthy admins. You can define your own ranks in the admin section of `config.toml` Finally, to start the server, run Dream Daemon and enter the path to your compiled paradise.dmb file. diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 7379c3b3990..22b00949b55 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -34,13 +34,11 @@ var/vote_no_default = 0 // vote does not default to nochange/norestart (tbi) var/vote_no_dead = 0 // dead people can't vote (tbi) // var/enable_authentication = 0 // goon authentication - var/del_new_on_log = 1 // qdel's new players if they log before they spawn in var/traitor_scaling = 0 //if amount of traitors scales based on amount of players var/protect_roles_from_antagonist = 0// If security and such can be tratior/cult/other var/continuous_rounds = 0 // Gamemodes which end instantly will instead keep on going until the round ends by escape shuttle or nuke. var/allow_Metadata = 0 // Metadata is supported. var/popup_admin_pm = 0 //adminPMs to non-admins show in a pop-up 'reply' window when set to 1. - var/Ticklag = 0.5 var/list/resource_urls = null var/antag_hud_allowed = 0 // Ghosts can turn on Antagovision to see a HUD of who is the bad guys this round. var/antag_hud_restricted = 0 // Ghosts that turn on Antagovision cannot rejoin the round. @@ -194,16 +192,6 @@ var/disable_karma = 0 // Disable all karma functions and unlock karma jobs by default - // StonedMC - var/tick_limit_mc_init = TICK_LIMIT_MC_INIT_DEFAULT //SSinitialization throttling - - // Highpop tickrates - var/base_mc_tick_rate = 1 - var/high_pop_mc_tick_rate = 1.1 - - var/high_pop_mc_mode_amount = 65 - var/disable_high_pop_mc_mode_amount = 60 - // Nightshift var/randomize_shift_time = FALSE var/enable_night_shifts = FALSE @@ -542,9 +530,6 @@ if("allow_holidays") config.allow_holidays = 1 - if("ticklag") - Ticklag = text2num(value) - if("allow_antag_hud") config.antag_hud_allowed = 1 @@ -683,16 +668,6 @@ if("start_now_confirmation") config.start_now_confirmation = 1 - if("tick_limit_mc_init") - config.tick_limit_mc_init = text2num(value) - if("base_mc_tick_rate") - config.base_mc_tick_rate = text2num(value) - if("high_pop_mc_tick_rate") - config.high_pop_mc_tick_rate = text2num(value) - if("high_pop_mc_mode_amount") - config.high_pop_mc_mode_amount = text2num(value) - if("disable_high_pop_mc_mode_amount") - config.disable_high_pop_mc_mode_amount = text2num(value) if("developer_express_start") config.developer_express_start = 1 if("enable_gamemode_player_limit") diff --git a/code/controllers/configuration/__config_defines.dm b/code/controllers/configuration/__config_defines.dm index 874fd9160f4..9f34b875a2d 100644 --- a/code/controllers/configuration/__config_defines.dm +++ b/code/controllers/configuration/__config_defines.dm @@ -8,8 +8,8 @@ target = ((input == 1) ? TRUE : FALSE)\ } -/// Wrapper to not overwrite a variable if a list key doesnt exist. Auto casts to int. -#define CONFIG_LOAD_INT(target, input) \ +/// Wrapper to not overwrite a variable if a list key doesnt exist. Auto casts to number. +#define CONFIG_LOAD_NUM(target, input) \ if(!isnull(input)) {\ target = text2num(input)\ } diff --git a/code/controllers/configuration/configuration_core.dm b/code/controllers/configuration/configuration_core.dm index 9398f6aa83a..e12248e65d6 100644 --- a/code/controllers/configuration/configuration_core.dm +++ b/code/controllers/configuration/configuration_core.dm @@ -7,9 +7,14 @@ GLOBAL_DATUM_INIT(configuration, /datum/server_configuration, new()) /datum/server_configuration /// Holder for the admin configuration datum var/datum/configuration_section/admin_configuration/admin + /// Holder for the AFK configuration datum var/datum/configuration_section/afk_configuration/afk + /// Holder for the custom sprites configuration datum var/datum/configuration_section/custom_sprites_configuration/custom_sprites + /// Holder for the DB configuration datum var/datum/configuration_section/database_configuration/database + /// Holder for the MC configuration datum + var/datum/configuration_section/mc_configuration/mc /datum/server_configuration/Destroy(force) SHOULD_CALL_PARENT(FALSE) @@ -27,6 +32,7 @@ GLOBAL_DATUM_INIT(configuration, /datum/server_configuration, new()) afk = new() custom_sprites = new() database = new() + mc = new() // Load our stuff up var/config_file = "config/config.toml" diff --git a/code/controllers/configuration/sections/afk_configuration.dm b/code/controllers/configuration/sections/afk_configuration.dm index 292492e3ca1..90e2c6b7c67 100644 --- a/code/controllers/configuration/sections/afk_configuration.dm +++ b/code/controllers/configuration/sections/afk_configuration.dm @@ -11,7 +11,7 @@ /datum/configuration_section/afk_configuration/load_data(list/data) // Use the load wrappers here. That way the default isnt made 'null' if you comment out the config line - CONFIG_LOAD_INT(warning_minutes, data["afk_warning_minutes"]) - CONFIG_LOAD_INT(auto_cryo_minutes, data["afk_auto_cryo_minutes"]) - CONFIG_LOAD_INT(auto_despawn_minutes, data["afk_auto_despawn_minutes"]) - CONFIG_LOAD_INT(ssd_auto_cryo_minutes, data["ssd_auto_cryo_minutes"]) + CONFIG_LOAD_NUM(warning_minutes, data["afk_warning_minutes"]) + CONFIG_LOAD_NUM(auto_cryo_minutes, data["afk_auto_cryo_minutes"]) + CONFIG_LOAD_NUM(auto_despawn_minutes, data["afk_auto_despawn_minutes"]) + CONFIG_LOAD_NUM(ssd_auto_cryo_minutes, data["ssd_auto_cryo_minutes"]) diff --git a/code/controllers/configuration/sections/database_configuration.dm b/code/controllers/configuration/sections/database_configuration.dm index e71a159777a..8b334226373 100644 --- a/code/controllers/configuration/sections/database_configuration.dm +++ b/code/controllers/configuration/sections/database_configuration.dm @@ -29,19 +29,19 @@ enabled = TRUE table_prefix = "" // This needs to happen in the CI environment to ensure the example SQL version gets updated. - CONFIG_LOAD_INT(version, data["sql_version"]) + CONFIG_LOAD_NUM(version, data["sql_version"]) #else // Load the normal config. Were not in CI mode // Use the load wrappers here. That way the default isnt made 'null' if you comment out the config line CONFIG_LOAD_BOOL(enabled, data["sql_enabled"]) - CONFIG_LOAD_INT(version, data["sql_version"]) + CONFIG_LOAD_NUM(version, data["sql_version"]) CONFIG_LOAD_STR(address, data["sql_address"]) - CONFIG_LOAD_INT(port, data["sql_port"]) + CONFIG_LOAD_NUM(port, data["sql_port"]) CONFIG_LOAD_STR(username, data["sql_username"]) CONFIG_LOAD_STR(password, data["sql_password"]) CONFIG_LOAD_STR(db, data["sql_database"]) CONFIG_LOAD_STR(table_prefix, data["sql_table_prefix"]) - CONFIG_LOAD_INT(async_query_timeout, data["async_query_timeout"]) - CONFIG_LOAD_INT(async_thread_limit, data["async_thread_limit"]) + CONFIG_LOAD_NUM(async_query_timeout, data["async_query_timeout"]) + CONFIG_LOAD_NUM(async_thread_limit, data["async_thread_limit"]) #endif diff --git a/code/controllers/configuration/sections/mc_configuration.dm b/code/controllers/configuration/sections/mc_configuration.dm new file mode 100644 index 00000000000..d8011587b6a --- /dev/null +++ b/code/controllers/configuration/sections/mc_configuration.dm @@ -0,0 +1,23 @@ +/// Config holder for all things regarding the MC +/datum/configuration_section/mc_configuration + /// Server ticklag + var/ticklag = 0.5 + /// Tick limit % during world Init + var/world_init_tick_limit = TICK_LIMIT_MC_INIT_DEFAULT + /// Base MC tick rate + var/mc_base_tickrate = 1 + /// Highpop MC tickrate + var/mc_highpop_tickrate = 1.1 + /// MC Highpop enable threshold + var/mc_highpop_enable_threshold = 65 + /// MC Highpop disable threshold + var/mc_highpop_disable_threshold = 60 + +/datum/configuration_section/mc_configuration/load_data(list/data) + // Use the load wrappers here. That way the default isnt made 'null' if you comment out the config line + CONFIG_LOAD_NUM(ticklag, data["ticklag"]) + CONFIG_LOAD_NUM(world_init_tick_limit, data["world_init_mc_tick_limit"]) + CONFIG_LOAD_NUM(mc_base_tickrate, data["base_mc_tick_rate"]) + CONFIG_LOAD_NUM(mc_highpop_tickrate, data["highpop_mc_tick_rate"]) + CONFIG_LOAD_NUM(mc_highpop_enable_threshold, data["mc_highpop_threshold_enable"]) + CONFIG_LOAD_NUM(mc_highpop_disable_threshold, data["mc_highpop_threshold_disable"]) diff --git a/code/controllers/master.dm b/code/controllers/master.dm index 82e2517823a..6403a77b17f 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -194,7 +194,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new var/start_timeofday = REALTIMEOFDAY // Initialize subsystems. - current_ticklimit = config.tick_limit_mc_init + current_ticklimit = GLOB.configuration.mc.world_init_tick_limit for(var/datum/controller/subsystem/SS in subsystems) if(SS.flags & SS_NO_INIT) continue @@ -216,7 +216,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new sortTim(subsystems, /proc/cmp_subsystem_display) // Set world options. // world.fps = CONFIG_GET(number/fps) // TIGER TODO - world.tick_lag = config.Ticklag + world.tick_lag = GLOB.configuration.mc.ticklag var/initialized_tod = REALTIMEOFDAY if(sleep_offline_after_initializations) @@ -626,10 +626,10 @@ GLOBAL_REAL(Master, /datum/controller/master) = new if(!processing) return var/client_count = length(GLOB.clients) - 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) - processing = config.high_pop_mc_tick_rate + if(client_count < GLOB.configuration.mc.mc_highpop_disable_threshold) + processing = GLOB.configuration.mc.mc_base_tickrate + else if(client_count > GLOB.configuration.mc.mc_highpop_enable_threshold) + processing = GLOB.configuration.mc.mc_highpop_tickrate /datum/controller/master/proc/formatcpu() switch(world.cpu) diff --git a/code/game/world.dm b/code/game/world.dm index f91d9b0f875..02c3001df6a 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -43,9 +43,6 @@ GLOBAL_LIST_INIT(map_transition_config, MAP_TRANSITION_CONFIG) log_world("Unit Tests Are Enabled!") #endif - if(!fexists("config/config.txt") || !fexists("config/game_options.txt")) - stack_trace("The game config files have not been properly set! Please copy ALL files from '/config/example' into the parent folder, '/config'.") - if(byond_version < MIN_COMPILER_VERSION || byond_build < MIN_COMPILER_BUILD) log_world("Your server's byond version does not meet the recommended requirements for this code. Please update BYOND") diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index 81150ac3be5..639f3da7aaf 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -68,9 +68,5 @@ for(var/datum/alternate_appearance/AA in viewing_alternate_appearances) AA.display_to(list(src)) - if(!fexists("config/config.txt") || !fexists("config/game_options.txt")) - to_chat(src, "The game config files have not been properly set!\n Please copy ALL files from '/config/example' into the parent folder, '/config'.") - log_world("The game config files have not been properly set! Please copy ALL files from /config/example into the parent folder, /config.") - update_client_colour(0) update_morgue() diff --git a/config/example/config.toml b/config/example/config.toml index 32c3f748616..2eb07267ba0 100644 --- a/config/example/config.toml +++ b/config/example/config.toml @@ -151,29 +151,6 @@ async_thread_limit = 50 ################################################################ -[debug_configuration] -# This section is settings for debug/backend related things -# Dont change these unless you know what you are doing - -# Disable calling qdel on players if they logout before spawning in -dont_delete_newmob = false -# Defines world tick lag. 0.5 is default for 20 TPS/FPS (10 * ticklag = TPS/FPS) -ticklag = 0.5 -# Tick usage percentage limit for the MC during initialization. -world_init_mc_tick_limit = 500 -# Base MC tick rate. 1 = once per BYOND tick -base_mc_tick_rate = 1 -# Highpop MC tick rate. Increased to account for lag -highpop_mc_tick_rate = 1.1 -# Threshold to enable MC highpop mode -mc_highpop_threshold_enable = 65 -# Threshold to disable MC highpop mode -mc_highpop_threshold_disable = 60 - - -################################################################ - - [discord_configuration] # This section contains all the information related to Discord webhook sending from the code # If you are using webhooks, please fill out this section in full @@ -526,6 +503,27 @@ enable_adminchat_logging = true ################################################################ +[mc_configuration] +# This section is settings for the MC +# Dont change these unless you know what you are doing + +# Defines world tick lag. 0.5 is default for 20 TPS/FPS (10 * ticklag = TPS/FPS) +ticklag = 0.5 +# Tick usage percentage limit for the MC during initialization. +world_init_mc_tick_limit = 500 +# Base MC tick rate. 1 = once per BYOND tick +base_mc_tick_rate = 1 +# Highpop MC tick rate. Increased to account for lag +highpop_mc_tick_rate = 1.1 +# Threshold to enable MC highpop mode +mc_highpop_threshold_enable = 65 +# Threshold to disable MC highpop mode +mc_highpop_threshold_disable = 60 + + +################################################################ + + [movement_configuration] # This section contains values for all mob movement stuff. # We suggest VVing ingame till you get values you like. diff --git a/paradise.dme b/paradise.dme index 3d3b807c1c4..16c494a2dca 100644 --- a/paradise.dme +++ b/paradise.dme @@ -189,6 +189,7 @@ #include "code\controllers\configuration\sections\afk_configuration.dm" #include "code\controllers\configuration\sections\custom_sprites_configuration.dm" #include "code\controllers\configuration\sections\database_configuration.dm" +#include "code\controllers\configuration\sections\mc_configuration.dm" #include "code\controllers\subsystem\acid.dm" #include "code\controllers\subsystem\afk.dm" #include "code\controllers\subsystem\air.dm"