From f8c97bfed8b7daba09c57daa1ff04f0380d0a0bf Mon Sep 17 00:00:00 2001 From: kyunkyunkyun <120701975+kyunkyunkyun@users.noreply.github.com> Date: Fri, 8 Aug 2025 01:07:23 +0500 Subject: [PATCH] Bumps max client fps from 120 (125) to 1000 (#29467) * 300 > 120 * ooooh i don't need sql change * same but descending + fix issue about DB * well, i should update bd * default is 100, keep only divisors of 1000 * fuck you byon d!!!! * cleanup --- SQL/paradise_schema.sql | 2 +- SQL/updates/68-69.sql | 4 ++++ code/__DEFINES/misc_defines.dm | 2 +- code/__DEFINES/preferences_defines.dm | 14 ++++++++++++++ .../modules/client/preference/link_processing.dm | 16 ++++++++-------- code/modules/client/preference/preferences.dm | 5 +++-- config/example/config.toml | 2 +- 7 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 SQL/updates/68-69.sql diff --git a/SQL/paradise_schema.sql b/SQL/paradise_schema.sql index 2d02559450a..da78d6a3ca8 100644 --- a/SQL/paradise_schema.sql +++ b/SQL/paradise_schema.sql @@ -289,7 +289,7 @@ CREATE TABLE `player` ( `volume_mixer` LONGTEXT COLLATE utf8mb4_unicode_ci DEFAULT NULL, `lastchangelog` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0', `exp` LONGTEXT COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `clientfps` smallint(4) DEFAULT '63', + `clientfps` smallint(4) DEFAULT '100', `atklog` smallint(4) DEFAULT '0', `fuid` bigint(20) DEFAULT NULL, `fupdate` smallint(4) DEFAULT '0', diff --git a/SQL/updates/68-69.sql b/SQL/updates/68-69.sql new file mode 100644 index 00000000000..ff94e69adde --- /dev/null +++ b/SQL/updates/68-69.sql @@ -0,0 +1,4 @@ +# Updates DB from 68 to 69 +# Changes DB default for clientFPS to 100 + +ALTER TABLE `player` CHANGE COLUMN `clientfps` `clientfps` smallint(4) DEFAULT '100' AFTER `exp`; diff --git a/code/__DEFINES/misc_defines.dm b/code/__DEFINES/misc_defines.dm index b0141cab58b..a46d6ccd65a 100644 --- a/code/__DEFINES/misc_defines.dm +++ b/code/__DEFINES/misc_defines.dm @@ -438,7 +438,7 @@ #define INVESTIGATE_DEATHS "deaths" // The SQL version required by this version of the code -#define SQL_VERSION 68 +#define SQL_VERSION 69 // Vending machine stuff #define CAT_NORMAL (1<<0) diff --git a/code/__DEFINES/preferences_defines.dm b/code/__DEFINES/preferences_defines.dm index 846fe3893b4..54ff7d5142b 100644 --- a/code/__DEFINES/preferences_defines.dm +++ b/code/__DEFINES/preferences_defines.dm @@ -183,3 +183,17 @@ #define COLOURBLIND_MODE_DEUTER "Red-green (green weak, deuteranopia)" #define COLOURBLIND_MODE_PROT "Red-green (red weak, protanopia)" #define COLOURBLIND_MODE_TRIT "Blue-yellow (tritanopia)" + +/// Best FPS options for clients. A regular list that has only divisors of 1000 +GLOBAL_LIST_INIT(client_fps_options, list_fps_options()) + +/proc/list_fps_options() + var/list/options = list() + + for(var/option in 1 to 1000 / world.fps) + if(1000 % option) // Lummox said it works better with divisors of 1000 + continue + + options += 1000 / option + + return options diff --git a/code/modules/client/preference/link_processing.dm b/code/modules/client/preference/link_processing.dm index 100c7e76f40..2f358e18304 100644 --- a/code/modules/client/preference/link_processing.dm +++ b/code/modules/client/preference/link_processing.dm @@ -865,16 +865,16 @@ return active_character.pda_ringtone = ringtone if("clientfps") - var/version_message - if(user.client && user.client.byond_version < 511) - version_message = "\nYou need to be using byond version 511 or later to take advantage of this feature, your version of [user.client.byond_version] is too low" - if(world.byond_version < 511) - version_message += "\nThis server does not currently support client side fps. You can set now for when it does." - var/desiredfps = tgui_input_number(user, "Choose your desired fps.[version_message]\n(Min = synced with server tick rate)", "Character Preference", clientfps, 120, world.fps) + var/desiredfps = tgui_input_list(user, "Choose your desired fps. Listed variants work better than custom", "Character Preference", list("\[CUSTOM\]") + GLOB.client_fps_options, clientfps) if(!isnull(desiredfps)) + if(desiredfps == "\[CUSTOM\]") + desiredfps = tgui_input_number(user, "Set your desired fps. Remember that this value will be converted to one that server can actually work with!", "Character Preference", parent.fps, 1000, world.fps) + if(isnull(desiredfps)) // we closed the window + return + if(round(1000 / floor(1000 / desiredfps), 1) != desiredfps) // don't ask + desiredfps = floor(1000 / round(1000 / desiredfps, 1)) clientfps = desiredfps - if(world.byond_version >= 511 && user.client && user.client.byond_version >= 511) - parent.fps = clientfps + parent.fps = clientfps else switch(href_list["preference"]) diff --git a/code/modules/client/preference/preferences.dm b/code/modules/client/preference/preferences.dm index 3299b3d1cef..5bf6ffcad88 100644 --- a/code/modules/client/preference/preferences.dm +++ b/code/modules/client/preference/preferences.dm @@ -70,7 +70,8 @@ GLOBAL_LIST_INIT(special_role_times, list( var/glowlevel = GLOW_MED var/UI_style_color = "#ffffff" var/UI_style_alpha = 255 - var/clientfps = 63 + /// This value will be converted by BYOND, don't set already converted values there, otherwise it will set client's fps 1 step higher than it should've + var/clientfps = 100 var/atklog = ATKLOG_ALL /// Forum userid var/fuid @@ -420,7 +421,7 @@ GLOBAL_LIST_INIT(special_role_times, list( dat += "Colourblind Mode: [colourblind_mode]
" if(user.client.donator_level > 0) dat += "Donator Publicity: [(toggles & PREFTOGGLE_DONATOR_PUBLIC) ? "Public" : "Hidden"]
" - dat += "FPS: [clientfps]
" + dat += "FPS: [user.client.fps]
" dat += "Ghost Ears: [(toggles & PREFTOGGLE_CHAT_GHOSTEARS) ? "All Speech" : "Nearest Creatures"]
" dat += "Ghost Radio: [(toggles & PREFTOGGLE_CHAT_GHOSTRADIO) ? "All Chatter" : "Nearest Speakers"]
" dat += "Ghost Sight: [(toggles & PREFTOGGLE_CHAT_GHOSTSIGHT) ? "All Emotes" : "Nearest Creatures"]
" diff --git a/config/example/config.toml b/config/example/config.toml index 5af0990e584..5e2a5611f1b 100644 --- a/config/example/config.toml +++ b/config/example/config.toml @@ -173,7 +173,7 @@ ipc_screens = [ # Enable/disable the database on a whole sql_enabled = false # SQL version. If this is a mismatch, round start will be delayed -sql_version = 68 +sql_version = 69 # SQL server address. Can be an IP or DNS name sql_address = "127.0.0.1" # SQL server port