Skip to content

Commit

Permalink
Initialize repository
Browse files Browse the repository at this point in the history
  • Loading branch information
Katsute committed Oct 31, 2023
1 parent 344c8f6 commit f205223
Show file tree
Hide file tree
Showing 7 changed files with 1,329 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: SourcePawn CI
on:
push:
branches: [main]
pull_request:
branches: [main]
types: [opened, reopened, synchronize]

jobs:
ci:
name: SourcePawn CI
uses: KatsuteTF/Workflows/.github/workflows/ci.yml@main
with:
file: TF100.sp
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Release
on:
release:
types: [published]

jobs:
release:
name: Release Plugin
uses: KatsuteTF/Workflows/.github/workflows/release.yml@main
with:
file: TF100.sp
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
437 changes: 437 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# TF100
### [TF2] TF100

100 player server optimization plugin

[![Creative Commons License](https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png)](http://creativecommons.org/licenses/by-nc-sa/4.0/)

Licensed under [CC BY-NC-SA 4.0](https://github.com/KatsuteTF/TF100/blob/main/LICENSE)
139 changes: 139 additions & 0 deletions TF100.sp
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
// Copyright (C) 2023 Katsute | Licensed under CC BY-NC-SA 4.0

#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <memorypatch>

public Plugin myinfo = {
name = "TF100",
author = "Katsute",
description = "Optimizations for 100 player servers",
version = "1.0",
url = "https://github.com/KatsuteTF/TF100"
}

public void OnPluginStart(){
// Entities
FindConVar("tf_dropped_weapon_lifetime").SetInt(0);

// Physics
FindConVar("sv_turbophysics").SetBool(true);
FindConVar("tf_resolve_stuck_players").SetBool(false);
FindConVar("tf_avoidteammates_pushaway").SetBool(false);

// Network
FindConVar("sv_parallel_sendsnapshot").SetBool(true);
FindConVar("net_queued_packet_thread").SetInt(581304);
FindConVar("net_splitrate").SetInt(200000);
FindConVar("sv_master_share_game_socket").SetBool(false);

FindConVar("net_compresspackets").SetBool(true);
FindConVar("net_compresspackets_minsize").SetInt(1261);

FindConVar("sv_allowupload").SetBool(false);
FindConVar("sv_allowdownload").SetBool(false);
FindConVar("net_maxfilesize").SetInt(0);

FindConVar("sv_clockcorrection_msecs").SetInt(130);
FindConVar("sv_playerperfhistorycount").SetInt(0);

FindConVar("sv_minrate").SetInt(1048576);
FindConVar("sv_maxrate").SetInt(1048576);
FindConVar("net_splitpacket_maxrate").SetInt(1048576);
FindConVar("net_maxcleartime").SetFloat(0.001);

FindConVar("sv_maxroutable").SetInt(1260);
FindConVar("net_maxfragments").SetInt(1260);
FindConVar("net_maxroutable").SetInt(1260);

// Edicts
FindConVar("sv_lowedict_action").SetInt(4);
FindConVar("sv_lowedict_threshold").SetInt(32);

// MvM
FindConVar("tf_mvm_defenders_team_size").SetInt(78);
FindConVar("tf_mvm_max_connected_players").SetInt(78);

// Client
FindConVar("breakable_multiplayer").SetBool(false);
FindConVar("func_break_max_pieces").SetInt(0);

FindConVar("prop_active_gib_limit").SetInt(0);
FindConVar("props_break_max_pieces_perframe").SetInt(0);

FindConVar("g_ragdoll_important_maxcount").SetInt(0);
FindConVar("g_ragdoll_maxcount").SetInt(0);

FindConVar("tf_spawn_glows_duration").SetInt(0);
FindConVar("tf_spec_xray").SetBool(false);

FindConVar("anim_3wayblend").SetBool(false);

FindConVar("tf_tournament_hide_domination_icons").SetBool(true);
FindConVar("mp_show_voice_icons").SetBool(false);

FindConVar("sv_allow_voice_from_file").SetBool(false);

FindConVar("sv_client_cmdrate_difference").SetBool(false);
FindConVar("sv_mincmdrate").SetInt(20);
FindConVar("sv_maxcmdrate").SetInt(20);
FindConVar("sv_minupdaterate").SetInt(15);
FindConVar("sv_maxupdaterate").SetInt(15);
FindConVar("sv_maxusrcmdprocessticks").SetInt(29);

FindConVar("sv_client_predict").SetBool(true);

FindConVar("sv_client_max_interp_ratio").SetInt(2);
FindConVar("sv_client_min_interp_ratio").SetInt(1);

// Map Edicts
DeleteEntities("keyframe_rope");
DeleteEntities("move_rope");
DeleteEntities("prop_physics");
DeleteEntities("prop_physics_override");
DeleteEntities("info_particle_system");
DeleteEntities("point_spotlight");

// // mp_tournament_whitelist patch https://github.com/sapphonie/tf2rue
// GameData gd = LoadGameConfigFile("TF100"); // https://github.com/sapphonie/tf2rue/blob/main/gamedata/tf2.rue.txt
// if(gd == null){
// SetFailState("Failed to load TF100 gamedata");
// }else{
// MemoryPatch tmpatch = MemoryPatch.CreateFromConf(gd, "CEconItemSystem::ReloadWhitelist::nopnop");
// if(!tmpatch.Validate())
// ThrowError("Failed to verify CEconItemSystem::ReloadWhitelist::nopnop");
// tmpatch.Enable();
// }
}

public void OnEntityCreated(int entity, const char[] classname){
if(
StrEqual(classname, "tf_ragdoll") || StrEqual(classname, "prop_ragdoll") ||
StrEqual(classname, "keyframe_rope") || StrEqual(classname, "move_rope") ||
StrEqual(classname, "entity_bird") ||
((StrEqual(classname, "tf_ammo_pack") || StrEqual(classname, "item_healthkit_small")) && HasEntProp(entity, Prop_Send, "m_hOwnerEntity")) ||
StrEqual(classname, "prop_physics") || StrEqual(classname, "prop_physics_override") ||
StrEqual(classname, "info_particle_system") ||
StrEqual(classname, "point_spotlight")
)
DeleteEntity(entity);
// else if(StrEqual(classname, "prop_physics_override") && HasEntProp(entity, Prop_Data, "m_ModelName")){
// char model[64];
// GetEntPropString(entity, Prop_Data, "m_ModelName", model, 64);
// if(strncmp(model, "c_bread_", 8))
// DeleteEntity(entity);
// }
}

public void DeleteEntity(const int entity){
if(IsValidEntity(entity))
AcceptEntityInput(entity, "Kill");
}

public void DeleteEntities(const char[] classname){
int entity;
while((entity = FindEntityByClassname(entity, "classname")) != -1)
DeleteEntity(entity);
}
38 changes: 38 additions & 0 deletions TF100.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"Games"
{
"tf"
{
"Signatures"
{
"CEconItemSystem::ReloadWhitelist"
{
"library" "server"
"linux" "@_ZN15CEconItemSystem15ReloadWhitelistEv"
"windows" "\x55\x8B\xEC\x83\xEC\x0C\x53\x56\x57\x8B\xD9\xC6\x45\xFF\x01"
}
}
"MemPatches"
{
"CEconItemSystem::ReloadWhitelist::nopnop"
{
"signature" "CEconItemSystem::ReloadWhitelist"
"linux"
{
"offset" "34h"
// jnz
"verify" "\x74\x53"
// nop nop
"patch" "\x90\x90"
}
"windows"
{
"offset" "45h"
// jz
"verify" "\x74\x6C"
// nop nop
"patch" "\x90\x90"
}
}
}
}
}
Loading

0 comments on commit f205223

Please sign in to comment.