diff --git a/aurorastation.dme b/aurorastation.dme index fa1c193f35f..a61aa340c3e 100644 --- a/aurorastation.dme +++ b/aurorastation.dme @@ -1414,6 +1414,7 @@ #include "code\modules\admin\verbs\debug.dm" #include "code\modules\admin\verbs\diagnostics.dm" #include "code\modules\admin\verbs\dice.dm" +#include "code\modules\admin\verbs\fps.dm" #include "code\modules\admin\verbs\getlogs.dm" #include "code\modules\admin\verbs\map_template_loadverb.dm" #include "code\modules\admin\verbs\mapping.dm" @@ -1427,7 +1428,6 @@ #include "code\modules\admin\verbs\SDQL.dm" #include "code\modules\admin\verbs\SDQL_2.dm" #include "code\modules\admin\verbs\SDQL_2_parser.dm" -#include "code\modules\admin\verbs\ticklag.dm" #include "code\modules\admin\verbs\tripAI.dm" #include "code\modules\admin\verbs\viewlist.dm" #include "code\modules\admin\verbs\warning.dm" diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 03dceb45498..c450d991c2f 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -157,7 +157,7 @@ var/list/gamemode_cache = list() var/protect_roles_from_antagonist = 0// If security and such can be traitor/cult/other 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.4 + var/Ticklag = 0.33 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. var/list/mode_names = list() diff --git a/code/controllers/master/master.dm b/code/controllers/master/master.dm index 0abc65114f2..951cd110eb7 100644 --- a/code/controllers/master/master.dm +++ b/code/controllers/master/master.dm @@ -225,7 +225,7 @@ var/CURRENT_TICKLIMIT = TICK_LIMIT_RUNNING #endif world.TgsInitializationComplete() - world.tick_lag = config.Ticklag + world.change_tick_lag(config.Ticklag) var/initialized_tod = REALTIMEOFDAY diff --git a/code/modules/admin/verbs/fps.dm b/code/modules/admin/verbs/fps.dm new file mode 100644 index 00000000000..8d9b5f41bc5 --- /dev/null +++ b/code/modules/admin/verbs/fps.dm @@ -0,0 +1,24 @@ +//replaces the old Ticklag verb, fps is easier to understand +/client/proc/set_server_fps() + set category = "Debug" + set name = "Set Server FPS" + set desc = "Sets game speed in frames-per-second. Can potentially break the game" + + if(!check_rights(R_DEBUG|R_DEV)) + return + + var/cfg_fps = (10 / config.Ticklag) + var/new_fps = round(input("Sets game frames-per-second. Can potentially break the game (default: [cfg_fps])","FPS", world.fps) as num|null) + + if(new_fps <= 0) + to_chat(src, SPAN_DANGER("Error: set_server_fps(): Invalid world.fps value. No changes made."), confidential = TRUE) + return + if(new_fps > cfg_fps * 1.5) + if(tgui_alert(usr, "You are setting fps to a high value:\n\t[new_fps] frames-per-second\n\tconfig.fps = [cfg_fps]","Warning!",list("Confirm","ABORT-ABORT-ABORT")) != "Confirm") + return + + var/msg = "[key_name(src)] has modified world.fps to [new_fps]" + log_admin(msg, 0) + message_admins(msg, 0) + + world.change_fps(new_fps) diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm index a8ede5895e5..18a828c637b 100644 --- a/code/modules/admin/verbs/mapping.dm +++ b/code/modules/admin/verbs/mapping.dm @@ -136,7 +136,7 @@ var/list/debug_verbs = list ( ,/client/proc/count_objects_all ,/client/proc/cmd_assume_direct_control ,/client/proc/jump_to_dead_group - ,/client/proc/ticklag + ,/client/proc/set_server_fps ,/client/proc/cmd_admin_grantfullaccess ,/client/proc/kaboom ,/client/proc/splash diff --git a/code/modules/admin/verbs/ticklag.dm b/code/modules/admin/verbs/ticklag.dm deleted file mode 100644 index eaed465be6c..00000000000 --- a/code/modules/admin/verbs/ticklag.dm +++ /dev/null @@ -1,18 +0,0 @@ -//Merged Doohl's and the existing ticklag as they both had good elements about them ~Carn - -/client/proc/ticklag() - set category = "Debug" - set name = "Set Ticklag" - set desc = "Sets a new tick lag. Recommend you don't mess with this too much! Stable, time-tested ticklag value is 0.9" - - if(!check_rights(R_DEBUG|R_DEV)) return - - var/newtick = input("Sets a new tick lag. Please don't mess with this too much! The stable, time-tested ticklag value is 0.9","Lag of Tick", world.tick_lag) as num|null - //I've used ticks of 2 before to help with serious singulo lags - if(newtick && newtick <= 2 && newtick > 0) - log_admin("[key_name(src)] has modified world.tick_lag to [newtick]", admin_key=key_name(src)) - message_admins("[key_name(src)] has modified world.tick_lag to [newtick]", 0) - world.tick_lag = newtick - feedback_add_details("admin_verb","TICKLAG") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! - else - to_chat(src, "Error: ticklag(): Invalid world.ticklag value. No changes made.") diff --git a/code/modules/client/preference_setup/global/01_ui.dm b/code/modules/client/preference_setup/global/01_ui.dm index 4ef5e1b6fa1..d0126786021 100644 --- a/code/modules/client/preference_setup/global/01_ui.dm +++ b/code/modules/client/preference_setup/global/01_ui.dm @@ -196,7 +196,7 @@ if("ooc") pref.ooccolor = initial(pref.ooccolor) if("fps") - pref.clientfps = 0 + pref.clientfps = initial(pref.clientfps) return TOPIC_REFRESH return ..() diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 3fddab735ef..5f6f2fac6e9 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -159,7 +159,7 @@ var/list/preferences_datums = list() // SPAAAACE var/toggles_secondary = PROGRESS_BARS | FLOATING_MESSAGES | HOTKEY_DEFAULT - var/clientfps = 40 + var/clientfps = 100 var/floating_chat_color var/speech_bubble_type = "default" diff --git a/code/world.dm b/code/world.dm index 5d5caae79dd..dcf18686b3d 100644 --- a/code/world.dm +++ b/code/world.dm @@ -56,7 +56,7 @@ var/global/datum/global_init/init = new () cache_lifespan = 0 //stops player uploaded stuff from being kept in the rsc past the current session maxx = WORLD_MIN_SIZE // So that we don't get map-window-popin at boot. DMMS will expand this. maxy = WORLD_MIN_SIZE - fps = 30 + fps = 20 #ifdef FIND_REF_NO_CHECK_TICK loop_checks = FALSE #endif @@ -458,4 +458,26 @@ var/list/world_api_rate_limit = list() else return TRUE + +/world/proc/change_fps(new_value = 20) + if(new_value <= 0) + CRASH("change_fps() called with [new_value] new_value.") + if(fps == new_value) + return //No change required. + + fps = new_value + on_tickrate_change() + +/world/proc/change_tick_lag(new_value = 0.5) + if(new_value <= 0) + CRASH("change_tick_lag() called with [new_value] new_value.") + if(tick_lag == new_value) + return //No change required. + + tick_lag = new_value + on_tickrate_change() + +/world/proc/on_tickrate_change() + SStimer?.reset_buckets() + #undef FAILED_DB_CONNECTION_CUTOFF diff --git a/config/example/config.txt b/config/example/config.txt index 9617c08bdcd..9bdaa5eceb1 100644 --- a/config/example/config.txt +++ b/config/example/config.txt @@ -254,7 +254,10 @@ GUEST_BAN ## Remove the # to allow special 'Easter-egg' events on special holidays such as seasonal holidays and stuff like 'Talk Like a Pirate Day' :3 YAARRR ALLOW_HOLIDAYS -##Defines the ticklag for the world. 0.33 (30 FPS) is the normal one, though you can go as low as 0.2 (50 FPS) for low-load servers. + +##Defines the ticklag for the world. Ticklag is the amount of time between game ticks (aka byond ticks) (in 1/10ths of a second). +##0.33 (30 FPS) is the normal one, though you can go as low as 0.2 (50 FPS) for low-load servers. +## This also controls the client network update rate, as well as the client fps if the preference is set to 0 TICKLAG 0.33 ## Uncomment this to activate the five day from character creation timelock on modifying IPC tags diff --git a/html/changelogs/fluffyghost-fpsadjustment.yml b/html/changelogs/fluffyghost-fpsadjustment.yml new file mode 100644 index 00000000000..8750d67dca5 --- /dev/null +++ b/html/changelogs/fluffyghost-fpsadjustment.yml @@ -0,0 +1,46 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: FluffyGhost + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - refactor: "Refactored the old set tick lag verb to the modern set fps one." + - backend: "Added two functions to set the fps/ticklag, and reset the SStimer bucket to account for the rate change." + - backend: "The world now starts at 20fps, should slightly speed up the lobby init until the configuration is loaded." + - backend: "At lobby runlevel, the FPS from the config are loaded resetting the bucket, in theory this should make them consistent with the configured tickrate/time ratio." + - rscadd: "Clients are now defaulted at 100fps refresh rate, disconnected from the server (world) refresh rate." + - rscadd: "Some additional insight in the comment above the ticklag configuration."