Skip to content

BeepIsla/tf2-casual

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TF2 Casual

Implementing the TF2 matchmaker for community servers. So mappers can test their VScripts in a Casual-like environment.

Note

This extension does not work on 32bit servers due to Valve not providing binaries.

How does this work?

Valve server binaries and community server binaries are the same, this means all the functionality used for Casual mode exists on community server as well, we just have to enable it.

The best way to enable it is to fake a matchmaker backend for our community server, resulting in it acting like a Valve Casual server. This is the most hands-off approach causing the server to handle everything the exact same way a Valve server would.

Some UI elements on the client will be wrong, this is because the server doesn't have full control over what the client sees, instead the client uses some GC data to set things like competitive high skill door texture, etc. This has no impact on server functionality but keep that in mind if you see things slightly different compared to regular matches.

Using this extension I was able to replicate the original Afterlife bug causing the round to never end, a Casual server exclusive bug, nobody was able to replicate it on a Community server.

Usage

  1. Install MetaMod and SourceMod
  2. Build the extension or download it from the Releases/Actions tab and put it into the SourceMod extensions folder together with the gamedata
  3. Start the server with the following autoexec.cfg as a base
  4. Create a match definition see the cfg/casual_example.txt file
  5. Start a match using sm_casual_match_create cfg/casual_example.txt
  6. Connect using connect IP:PORT

Important

Setting sv_password will forcefully reset tf_mm_servermode!

Meaning you cannot set a password for the server.

Build

(I don't like AMBuild)

  1. cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release
  2. cmake --build ./build -j 24 --config Release

ConVars & Commands

  • sm_casual_gc_debug 0: If non-zero will log server GC behaviour
  • sm_casual_gc_delay 500: Fake delay in milliseconds to simulate network latency
  • sm_casual_gc_fake_down 0: If non-zero we will tell the server the GC is down
  • sm_casual_mm_debug 0: If non-zero will log matchmaking behaviour
  • sm_casual_mm_force_connection_source matchmaking: Forcefully sets the connection source, ignored if empty. In regular matchmaking players connect using 'connect IP:PORT matchmaking'.

  • sm_casual_gc_test: Sends a test GC message to the server, you should see a 'GC sent malformed CGCUpdateItemSchema message' log
  • sm_casual_itemschema_test_next_maps: Test the next maps algorithm
  • sm_casual_itemschema_add_custom_map: Adds support for a custom map
  • sm_casual_kick_client: Admin remove a client from a match by their SteamID
  • sm_casual_match_create: Creates a new match, see 'cfg/casual_example.txt' for details
  • sm_casual_match_add_player: Add a player to a match
  • sm_casual_match_remove_player: Remove a player from a match, this implies the user has disconnected and abandoned the match

Custom Maps

In order to support custom maps you have to first run the sm_casual_itemschema_add_custom_map command. For example sm_casual_itemschema_add_custom_map plr_highertower. You can then use plr_highertower in the sm_casual_match_create file.

If you are using a Steam workshop map, you can also use the workshop ID, for example sm_casual_itemschema_add_custom_map workshop/899335714.

Note

Players will not see the map name or map image in the map voting screen, they will also not be able to vote. This is because the map definition is missing on the client. You can safely ignore this, the server will simply reload the map at the end of the vote.

SourceMod Scripting

Currently this extension only provides commands for the server console, a future release will add SourceMod functions so you can write simple plugins to control the match.

About

Implementing the TF2 matchmaker for community servers. So mappers can test their VScripts in a Casual-like environment.

Resources

Stars

Watchers

Forks

Contributors