alliedmodders / sourcemod

SourceMod - Source Engine Scripting and Administration
http://www.sourcemod.net/
974 stars 422 forks source link

[TF2] Loading Sourcemod causes incorrect popfiles to load #1834

Closed teeffelen closed 2 years ago

teeffelen commented 2 years ago

Help us help you

Environment

Description

Using the latest Sourcemod release on a stock TF2 MvM server causes the server to load the wrong popfiles during map changes, causing servers to be in a unplayable state.

Example: When changing map to say mvm_coaltown the server will randomly pick mvm_mannworks.pop as the mission population file, which won't work properly and essentially breaks the gamemode.

This does not happen on stock (non-Sourcemod) servers.

This issue has been reported by others (which is why I'm making this report): https://forums.alliedmods.net/showthread.php?t=336457

Note: the issue does not seem to occur when invoking sm_map <other mvm map>, this does load the correct mission file every time.

Problematic Code (or Steps to Reproduce)

  1. Setup a fresh TF2 server configured for mvm (32 playerslots, mvm maps in mapcycle...)
  2. Install latest stable MM and SM
  3. Start server on a mvm map (with nextmap plugin)
  4. Complete the mission or use sv_cheats 1; tf_mvm_force_victory (using sm_map won't cause the issue !!)
  5. On the next map, check if the population file matches the current map, current map should match tf_mvm_popfile

Logs

Tried browsing the Sourcemod logs but could not find any errors or clues about this issue sadly.

Edit; not extension related, removed mentions of it.

asherkin commented 2 years ago

The DHooks extension wouldn't be loaded if you didn't have a plugin using it, and no plugins ship with SM that use it.

What plugins are you running?

teeffelen commented 2 years ago

Here is a more detailed list, with some stock plugins enabled and the mismatch in map/mission:

---- Host_Changelevel ----
SoundEmitter:  removing map sound overrides [5796 to remove, 1979 to restore]
trusted_keys.txt not present; pure server using only base trusted key list
ConVarRef room_type doesn't point to an existing ConVar
Executing dedicated server config file server.cfg
<--- snip --->

host_map
"host_map" = "mvm_coaltown" ( def. "" )
 - Current map name.

tf_mvm_popfile
Current popfile is: scripts/population/mvm_mannworks.pop

sm plugins list
[SM] Listing 14 plugins:
  01 "Basic Commands" (1.11.0.6911) by AlliedModders LLC
  02 "Basic Votes" (1.11.0.6911) by AlliedModders LLC
  03 "MapChooser" (1.11.0.6911) by AlliedModders LLC
  04 "Admin File Reader" (1.10.0.6544) by AlliedModders LLC
  05 "Anti-Flood" (1.11.0.6911) by AlliedModders LLC
  06 "Basic Info Triggers" (1.11.0.6911) by AlliedModders LLC
  07 "Basic Ban Commands" (1.11.0.6911) by AlliedModders LLC
  08 "Basic Comm Control" (1.11.0.6911) by AlliedModders LLC
  09 "Nextmap" (1.11.0.6911) by AlliedModders LLC
  10 "Sound Commands" (1.11.0.6911) by AlliedModders LLC
  11 "Admin Menu" (1.11.0.6911) by AlliedModders LLC
  12 "Basic Chat" (1.11.0.6911) by AlliedModders LLC
  13 "Client Preferences" (1.11.0.6911) by AlliedModders LLC
  14 "Admin Help" (1.11.0.6911) by AlliedModders LLC

sm exts list
[SM] Displaying 9 extensions:
[01] Automatic Updater (1.11.0.6911): Updates SourceMod gamedata files
[02] Webternet (1.11.0.6911): Extension for interacting with URLs
[03] TF2 Tools (1.11.0.6911): TF2 extended functionality
[04] BinTools (1.11.0.6911): Low-level C/C++ Calling API
[05] SDK Hooks (1.11.0.6911): Source SDK Hooks
[06] SDK Tools (1.11.0.6911): Source SDK Tools
[07] Top Menus (1.11.0.6911): Creates sorted nested menus
[08] Client Preferences (1.11.0.6911): Saves client preference settings
[09] MySQL-DBI (1.11.0.6911): MySQL driver implementation for DBI
teeffelen commented 2 years ago

The DHooks extension wouldn't be loaded if you didn't have a plugin using it, and no plugins ship with SM that use it.

What plugins are you running?

You're right, it is not extension related.

I seem to have narrowed it down to having nextmap loaded or not, having it loaded causes the weird mission file issue.

ambaca commented 2 years ago

The DHooks extension wouldn't be loaded if you didn't have a plugin using it, and no plugins ship with SM that use it. What plugins are you running?

You're right, it is not extension related.

I seem to have narrowed it down to having nextmap loaded or not, having it loaded causes the weird mission file issue.

SourceMod have a cvar sm_nextmap If this cvar has a map name set, SourceMod force to that map on every map change.

Some plugins like nextmap.smx, change that cvar.

You can fix by adding in server.cfg (or ...sourcemod/sourcemod.cfg) sm_nextmap " " ...and remove nextmap.smx, mapchooser.smx plugins

teeffelen commented 2 years ago

This is not really a fix as it is a workaround for the problem, but indeed changing the convar sm_nextmap to nothing sm_nextmap "" before the map ends does work properly.

Using this method as a workaround however is not an option, as basically all next map related plugins won't work which is kind of a shame given that 2 of them are loaded by default. (You'd be better of forcing the tf_mvm_popfile command in each map config file - which is what I'm doing currently as a workaround with nextmap and mapchooser still enabled and working fine)

It must be something within Sourcemod that forces the maps when sm_nextmap is set. What is bugging me is the fact that the sm_map command works fine, but Sourcemod forcing the sm_nextmap to load during map changes does not work properly*.

*edit; I should clarify; it does load the correct sm_nextmap, but it messes up how the game loads the correct mission file somehow in the process.

ambaca commented 2 years ago

Yes, good fix is make map config file cfg/mapname.cfg and add tf_mvm_popfile "scripts/population/mapname.pop" -Never know if someone like use custom pop file instead official. dunno how game pick different category... Or not, if we look mvm mapcycle file, it have different pop files to same map. different challenges by players vote

sm_nextmap works like it should, forcing map to next. this has been made to work on most HL2 game mods

nextmap.smx plugin look cvar mapcyclefile and read file from that, keeping map cycle in order. -For example, If you change map manually, on next map end it return back to mapcycle order. -This why sm_nextmap cvar not reset empty by it's own. Unless you set it manually.

TF2 game mode MvM again has own map cycle and it also change level twice to get right pop file. -sm_nextmap with mapname will screw this map cycle order.

This is TF2 MvM mapcycle configure

"tf_mvm_missioncyclefile" = "tf_mvm_missioncycle.res"
 game
 - Name of the .res file used to cycle mvm misisons

and file look like this

Spoiler Click me! tf_mvm_missioncycle.res ```cpp "tf_mvm_missioncycle.res" { "categories" "4" "1" { "count" "6" "1" { "map" "mvm_decoy" "popfile" "mvm_decoy" } "2" { "map" "mvm_coaltown" "popfile" "mvm_coaltown" } "3" { "map" "mvm_mannworks" "popfile" "mvm_mannworks" } "4" { "map" "mvm_bigrock" "popfile" "mvm_bigrock" } "5" { "map" "mvm_mannhattan" "popfile" "mvm_mannhattan" } "6" { "map" "mvm_rottenburg" "popfile" "mvm_rottenburg" } } "2" { "count" "6" "1" { "map" "mvm_decoy" "popfile" "mvm_decoy_intermediate" } "2" { "map" "mvm_coaltown" "popfile" "mvm_coaltown_intermediate" } "3" { "map" "mvm_mannworks" "popfile" "mvm_mannworks_intermediate" } "4" { "map" "mvm_decoy" "popfile" "mvm_decoy_intermediate2" } "5" { "map" "mvm_coaltown" "popfile" "mvm_coaltown_intermediate2" } "6" { "map" "mvm_mannworks" "popfile" "mvm_mannworks_intermediate2" } } "3" { "count" "13" "1" { "map" "mvm_decoy" "popfile" "mvm_decoy_advanced" } "2" { "map" "mvm_coaltown" "popfile" "mvm_coaltown_advanced" } "3" { "map" "mvm_mannworks" "popfile" "mvm_mannworks_advanced" } "4" { "map" "mvm_decoy" "popfile" "mvm_decoy_advanced2" } "5" { "map" "mvm_coaltown" "popfile" "mvm_coaltown_advanced2" } "6" { "map" "mvm_mannworks" "popfile" "mvm_mannworks_ironman" } "7" { "map" "mvm_decoy" "popfile" "mvm_decoy_advanced3" } "8" { "map" "mvm_bigrock" "popfile" "mvm_bigrock_advanced1" } "9" { "map" "mvm_bigrock" "popfile" "mvm_bigrock_advanced2" } "10" { "map" "mvm_mannhattan" "popfile" "mvm_mannhattan_advanced1" } "11" { "map" "mvm_mannhattan" "popfile" "mvm_mannhattan_advanced2" } "12" { "map" "mvm_rottenburg" "popfile" "mvm_rottenburg_advanced1" } "13" { "map" "mvm_rottenburg" "popfile" "mvm_rottenburg_advanced2" } } "4" { "count" "3" "1" { "map" "mvm_decoy" "popfile" "mvm_decoy_expert1" } "2" { "map" "mvm_coaltown" "popfile" "mvm_coaltown_expert1" } "3" { "map" "mvm_mannworks" "popfile" "mvm_mannworks_expert1" } } } ```