Raised This Month: $63 Target: $400
 15% 

Variable timing tic for GoldSrc. Auto hibernate to 10k.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DJEarthQuake
Senior Member
Join Date: Jan 2014
Location: Midwest
Old 03-17-2019 , 11:42   Variable timing tic for GoldSrc. Auto hibernate to 10k.
Reply With Quote #1

I started a 3 in 1 script that deals with bot mixing and the server CPU savings. My cheap New York VPS has a hard limit regarding CPU and long running processes. As you can see I got annoyed with the extra sound on map vote time. It at least needs pushed a few seconds later so it does not glob wav files. RTV trigger part needs augmented to some work I began on mapchooser4.sma to make a crash free Gearbox server.

Op4 capture the flag maps require a specific bot and they soak up a lot of CPU so they are only used for capture the flag tasks. In this example the death match JK Botti is loading on to only OP4 map prefixes.

All other maps no bots automatically. Advertisement runs with other plugin to show how to start a vote to add bots.

This is also a timing patch for all op4ctf maps in existence until issue is resolved published on GitHub.
I do not know when I am going to suddenly stop doing all of this or when a hard disk with go so just a bit of a dumping and archival period for now.

So the mop_bot is a alpha crude attempt to run a exec on a list kicking bots by name that tend to get stuck using HPB_BOT. The part I like about this all in one is the timing. I have it so if there is nobody on the server it reduces the CPU by lowering tic to make a quasi-hibernation mode.

Each player who connects the sys_tic gets multiplied by number of players up to 32 players is close to 10,000 fps and adjusts back down automatically.

312*32 = 9984

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "Autoconcom" #define VERSION "C" #define AUTHOR "SPiNX" public plugin_precache() {     {         {         ///precache_sound("buttons/lever3.wav");         }     } } public plugin_init() {     {         {         register_plugin(PLUGIN, VERSION, AUTHOR)         if (task_exists(187) ) return;         set_task_ex(175.0, "read_time", 187, .flags = SetTask_BeforeMapChange);         set_task_ex(40.0, "mop_bot", 185, .flags = SetTask_AfterMapStart);         }     } } public client_putinserver(id) {     {         {         if (is_user_bot(id)) return;         if (is_user_hltv(id)) return;         on_join();         }     } } public client_disconnected(id) {     {               {         if (is_user_bot(id)) return;         if (is_user_hltv(id)) return;         on_exit();         }     } } public read_time() {     {         {         new timeleft = get_timeleft()         server_print("%i",timeleft)         if (timeleft < 185)         {         server_cmd("amx_votenextmap"); ///  new id; ///        emit_sound(id,6,"buttons/lever3.wav",0.7,0.8,0,100);         client_print(0, print_center, "Select a map now...");         message_begin(0,23);         write_byte(TE_TEXTMESSAGE);         write_byte(0);      //(channel)         write_short(500)//(x) -1 = center)         write_short(100)//(y) -1 = center)         write_byte(2)//(effect) 0 = fade in/fade out, 1 is flickery credits, 2 is write out (training room)         write_byte(0)//(red) - text color         write_byte(255)//(green)         write_byte(64)//(blue)         write_byte(200)//(alpha)         write_byte(255)//(red) - effect color         write_byte(0)//(green)         write_byte(0)//(blue)         write_byte(25)//(alpha)         write_short(100)//(fadein time)         write_short(300)//(fadeout time)         write_short(300)//(hold time)         write_short(250); //[optional] write_short(fxtime) time the highlight lags behing the leading text in effect 2         write_string("Thank you for playing on BTEAM..."); //(text message) 512 chars max string size         message_end();         }         else return;         }     } } public bots_dmc() {     {         {         server_cmd("jk_botti min_bots 1; jk_botti max_bots 2; exec bot_mal.cfg");         }     } } public bots_flag() {     {         {         server_cmd("sys_ticrate 35; HPB_Bot min_bots 1; HPB_Bot max_bots 9");         }     } } public on_exit() {     {         {         new numplayers = get_playersnum_ex(GetPlayersFlags:GetPlayers_ExcludeBots)         if (numplayers <= 1)         {         server_cmd("sys_ticrate 35.0");         }         else return;         if ( cstrike_running() ) return;                 server_cmd("jk_botti min_bots 0");         server_cmd("jk_botti max_bots 0");         }     } } public mop_bot() {     {         {         if ( cstrike_running() ) return;         server_cmd("exec bot_mal.cfg");         }     } } public on_join() {     {            new numplayers = get_playersnum_ex(GetPlayersFlags:GetPlayers_ExcludeBots)         if (numplayers > 0)         {         new g_Tic         g_Tic = (numplayers * (312));         server_cmd("sys_ticrate %i", g_Tic);         }         else return;         if ( cstrike_running() ) return;         new mname[32];         get_mapname(mname,31);         if (containi(mname,"op4ctf_") > -1)         {         bots_flag();         }         else if (containi(mname, "op4_") > -1)         {         bots_dmc();         }     } }
__________________
"It's not the actual programming that's interesting. But it's what you can accomplish with the end results that are important." -Dennis Ritchie
"Mathematics, rightly viewed, possesses not only truth, but supreme beauty a beauty cold and austere, like that of sculpture..." -Bertrand Russell

Last edited by DJEarthQuake; 04-01-2019 at 21:10. Reason: typo
DJEarthQuake is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:02.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode