RE:NODE
Обзор хостинга

Руководства13 мин чтения

A CS2 competitive match server: config, MatchZy, GOTV

The cvars for an MR12 match, a knife round and warm-up, MatchZy for ready-up and pauses, GOTV demos, and restoring a round after a crash.

Эта статья пока на английском. Мы её переводим.

1 прочтений

A match server is a public server with the fun taken out of it. No vote to change map, no auto team balance quietly moving your entry fragger, no warm-up ending because the timer ran out while one player was still installing an update. What it has instead is a config it goes live with, a way to pause, a demo of everything that happened, and a round-by-round backup so that a crash in round 19 costs five minutes rather than the match.

The short version: put your match rules in a live.cfg that nothing else overwrites, run the evening with MatchZy rather than by hand, record GOTV from the first round, and turn on the engine's own round backups before you need them. The rest of this is the detail, including the practice server the same group will want by the second week.

What a match server has to do that a public server does not#

RequirementHow it is met
Identical rules every timeOne live.cfg, execed at go-live, not scattered across files
Wait for ten peopleWarm-up with a frozen timer and a ready-up system
Decide sides fairlyA knife round, then stay or switch
Stop the clockTactical timeouts and an admin pause
Prove what happenedGOTV recording from round one
Survive a crashRound backups on disk, restored into the live match
Keep strangers outA password, or a plugin whitelist of the ten Steam ids

Nothing on that list is exotic, and most of it exists in the engine. The reason people install a plugin is not capability, it is that doing it by hand means an admin typing eleven commands in the right order while nine people wait, and one typo restarting the game at 12-7.

everyone readyevery roundtv_autorecordWarm-upready up, whitelistKnife roundstay or switchLivelive.cfg, MR12Round backupsone file per roundGOTV demo.dem on disk
A match night, from warm-up to the demo

The match config#

This is the file the server execs the moment it goes live. Keep it as game/csgo/cfg/live.cfg and exec it explicitly; do not rely on server.cfg, because the game mode config runs after server.cfg on every map load and will undo half of it. That ordering trap is explained in CS2 server commands and cvars, and it is the reason match configs exist as separate files at all.

game/csgo/cfg/live.cfg
// Format: MR12 with MR3 overtimemp_maxrounds 24mp_halftime 1mp_halftime_duration 15mp_overtime_enable 1mp_overtime_maxrounds 6mp_overtime_startmoney 12500mp_match_can_clinch 1mp_match_end_restart 0mp_match_restart_delay 15mp_endmatch_votenextmap 0// Economymp_maxmoney 16000mp_startmoney 800mp_afterroundmoney 0mp_playercashawards 1mp_teamcashawards 1// Roundmp_freezetime 15mp_roundtime 1.92mp_roundtime_defuse 1.92mp_roundtime_hostage 1.92mp_buytime 20mp_buy_anywhere 0mp_free_armor 0mp_death_drop_gun 1mp_death_drop_grenade 2mp_death_drop_defuser 1mp_friendlyfire 1mp_solid_teammates 1// No interferencemp_autoteambalance 0mp_limitteams 0mp_autokick 0mp_forcecamera 1mp_timelimit 0mp_team_intro_time 0// Timeoutsmp_team_timeout_time 30mp_team_timeout_max 4mp_team_timeout_ot_add_each 1mp_team_timeout_ot_max 1// Voicesv_full_alltalk 0sv_deadtalk 1// Safetysv_cheats 0mp_warmup_pausetimer 0

A few of those are worth a sentence. mp_maxrounds 24 is MR12, which is what CS2 competitive settled on; a league still running MR15 wants 30 and mp_overtime_maxrounds 6 either way. mp_match_can_clinch 1 ends the match at 13-4 instead of playing out rounds nobody needs. mp_autokick 0 stops the server removing a player for idling during a tactical pause, which is a genuinely bad evening. mp_team_intro_time 0 skips the introduction cinematic CS2 plays before the first round. And mp_forcecamera 1 limits dead players to spectating their own team, which is the difference between a scrim and an honour system.

Team names go in mp_teamname_1 and mp_teamname_2, with two-letter codes in mp_teamflag_1 and mp_teamflag_2. They appear on the scoreboard and, more usefully, in the GOTV demo six months later when you cannot remember who played.

Warm-up, the knife round and going live by hand#

You should let a plugin do this. But you should know what it is doing, because when the plugin misbehaves at 20:55 you will be doing it by hand.

Warm-up first. mp_warmuptime 300 with mp_warmup_pausetimer 1 gives an unlimited warm-up: the clock displays but never runs down, so nobody is rushed and nobody has to keep restarting it. mp_warmup_end ends it when you are ready.

The knife round is a config plus two commands:

game/csgo/cfg/knife.cfg
mp_startmoney 0mp_maxmoney 0mp_free_armor 0mp_give_player_c4 0mp_ct_default_primary ""mp_ct_default_secondary ""mp_ct_default_melee "weapon_knife"mp_t_default_primary ""mp_t_default_secondary ""mp_t_default_melee "weapon_knife"mp_death_drop_gun 0mp_death_drop_grenade 0mp_buytime 0mp_buy_anywhere 0mp_freezetime 10mp_roundtime 5mp_roundtime_defuse 5mp_maxrounds 1mp_warmup_endmp_restartgame 1

The winning team then chooses. If they stay, exec live.cfg and mp_restartgame 3. If they switch, run mp_swapteams first, then the same two steps. Announce it in chat three times so nobody can claim they were reading Discord, because the first round of a live match played by one team who thought it was still knife is the oldest argument in Counter-Strike.

MatchZy: the plugin that runs the evening#

MatchZy is a CounterStrikeSharp plugin, so it needs Metamod:Source and CounterStrikeSharp underneath it - CS2 plugins with Metamod and CounterStrikeSharp is the install. Once it is loaded, the evening runs from chat.

CommandWhoEffect
.ready / .unreadyPlayersReady up. The match starts when enough are ready
.forcereadyAdminStarts anyway
.knife-Knife round, then .stay or .switch from the winner
.pause / .unpausePlayersPause at the end of the round, resume when both agree
.tacPlayersTactical timeout, counted against the team's allowance
.stopPlayersRestore the current round. Both teams must agree
.restore <round>AdminRestore any round from its backup file
.map <name>AdminChange map without leaving match mode
.scoreAnyoneCurrent score and series state

MatchZy ships its own configs under game/csgo/cfg/MatchZy/ - a warm-up config, a knife config and a live config - which means you edit cfg/MatchZy/live.cfg rather than the file you wrote above, and the plugin execs it at the right moment. Its own settings are convars prefixed matchzy_ in the same folder; the one you will change first is the number of ready players required to start. Names do shift between releases, so read the version you downloaded rather than a two-year-old blog post.

For anything more organised than a pickup game, MatchZy loads a match definition as JSON, either from a file on the server or from a URL:

match.json
{  "matchid": "renode-scrim-014",  "num_maps": 1,  "players_per_team": 5,  "skip_veto": true,  "maplist": ["de_mirage"],  "team1": {    "name": "Longship",    "players": { "76561198012345678": "anna" }  },  "team2": {    "name": "Drakkar",    "players": { "76561198087654321": "jan" }  }}

Loading that config puts the server in match mode with the right map, the right team names and a whitelist: only the listed Steam ids can join, and each is placed on their team automatically. For a best-of-three, set num_maps to 3 and list three maps. This is also the hook a Discord bot or a small web page would use to set up matches without anyone touching the console.

GOTV and demos#

GOTV is a spectator relay and a demo recorder in one, and the recorder is the half that matters. Turn it on before the match, not after somebody asks for the clip.

in server.cfg
tv_enable 1tv_port 27020tv_autorecord 1tv_delay 0tv_delaymapchange 1tv_maxclients 8tv_name "Longship GOTV"tv_password ""tv_relaypassword ""tv_snapshotrate 32

tv_autorecord 1 starts a demo on every match and writes it to disk when the map ends; tv_record <name> and tv_stoprecord do it manually. tv_delay is the broadcast delay in seconds, and it is the setting people get wrong in both directions: 0 is right for a demo-only server with nobody watching live, and something like 90 to 120 is right if spectators are connected to GOTV, because a zero-delay spectator is a ghosting accusation waiting to happen. tv_delaymapchange 1 holds the map change until the delayed broadcast has caught up, so the last round is not cut off.

Spectators connect to the GOTV port rather than the game port, which is the reason a CS2 server needs two port allocations rather than one. Demos are written into game/csgo/ with the date and map in the name, and a full MR12 map is a couple of hundred megabytes at 64 tick and more at 128, so a busy scrim server fills its disk in weeks rather than months. Two habits fix that: download the demos you care about, and put a scheduled task on the server that deletes anything older than a month. Scheduled tasks worth having covers the pattern; on RE:NODE the Schedules tab runs a cron expression against a console command, so the cleanup is a job you set once.

Watch a demo by putting it in the client's csgo folder and running playdemo <name>, or by connecting to <address>:27020 while the match is live.

Round backups and restoring after a crash#

The engine writes a full snapshot of the match at the start of every round if you let it, and almost nobody turns it on until the first time they need it.

config
mp_backup_round_auto 1mp_backup_round_file "match"mp_backup_restore_load_file "match_round12.txt"

With mp_backup_round_auto 1 the server writes one small text file per round into game/csgo/, holding the score, the money, the equipment and the sides. mp_backup_restore_load_file <file> loads one back and the match continues from the start of that round with everybody's economy intact. It works after a crash, after a restart, and after a round that has to be replayed because somebody's game closed during the buy.

MatchZy sits on top of this with .stop, which restores the current round when both teams type it, and .restore <round> for an admin. The plugin's files and the engine's files are not the same thing, so if you are running MatchZy use its commands rather than mixing the two.

Round backups also change how you think about crashes. If the container hits its memory limit it is stopped and restarted clean rather than left swapping, which sounds brutal until you compare it with fifteen minutes of a server crawling. With backups on, that restart costs the time it takes to reconnect and type one command. Without them it costs the match. The same argument applies to backups of the server itself - see backups that actually restore, which is about the discipline rather than the button.

A practice server for the same group#

The second thing a team asks for is somewhere to throw smokes. It is the same server software with almost the opposite config, and it needs sv_cheats 1, which is why it must never be the public one.

game/csgo/cfg/prac.cfg
sv_cheats 1mp_limitteams 0mp_autoteambalance 0mp_maxmoney 60000mp_startmoney 60000mp_afterroundmoney 60000mp_buytime 60000mp_buy_anywhere 1mp_freezetime 0mp_roundtime 60mp_roundtime_defuse 60mp_respawn_on_death_t 1mp_respawn_on_death_ct 1mp_death_drop_gun 0mp_death_drop_grenade 0sv_infinite_ammo 1ammo_grenade_limit_total 5mp_ct_default_grenades "weapon_hegrenade weapon_flashbang weapon_smokegrenade weapon_incgrenade weapon_decoy"mp_t_default_grenades "weapon_hegrenade weapon_flashbang weapon_smokegrenade weapon_molotov weapon_decoy"sv_grenade_trajectory_prac_pipreview 1sv_grenade_trajectory_prac_trailtime 8sv_showimpacts 1sv_showimpacts_time 8bot_quota 0bot_stop 1sv_full_alltalk 1mp_warmup_endmp_restartgame 1

The grenade trajectory and impact cvars are the point of the whole file: trajectories draw the line a nade took and leave it there for sv_grenade_trajectory_prac_trailtime seconds, and sv_showimpacts marks where bullets actually landed against where the client thought they did. sv_rethrow_last_grenade re-throws the last grenade from the same spot and is worth binding to a key. noclip needs sv_cheats 1, which it now has.

MatchZy has a practice mode of its own, which is the tidier route if it is already installed: it sets this up, adds spawn and timer commands, and puts the server back afterwards. Running practice and matches on the same server is fine as long as somebody remembers to exec the live config; running them at the same time is not, so if the group is large enough to want both at once, that is two servers.

Sizing, tick rate and the network#

A ten-player CS2 server with GOTV recording is not heavy. What makes it heavy is 128 tick, which roughly doubles CPU per player, and CounterStrikeSharp, which brings a .NET runtime into the process.

SetupMemoryCPU
5v5, 64 tick, vanilla, GOTV1 GB1 core
5v5, 64 tick, MatchZy and one or two plugins2 GB1.5 cores
5v5, 128 tick, MatchZy, GOTV recording2-3 GB2 cores
Practice server, 128 tick, heavy grenade work2 GB2 cores

Tick rate is the argument worth settling early. CS2 timestamps inputs at sub-tick resolution, so hit registration is far less tick-dependent than it was in CS:GO, and the honest case for 128 tick now rests on grenade and movement simulation rather than on whether your shots land - what tick rate actually means has the measurement. If your team practises line-ups at 128 and plays officials at 128, match at 128. Otherwise 64 with headroom beats 128 at the CPU ceiling.

The thing that decides how a scrim feels is not the tick rate, it is the distance between the ten players and the box. Everyone within one region of the server and nobody on wifi beats every config file on this page. Latency, jitter and packet loss is how to tell which of the three is ruining a particular player's evening, and jitter is usually the answer.

Troubleshooting#

The match starts at 0-0 but the money is wrong. The live config was execed after the restart instead of before it. Exec, then mp_restartgame 1.

Rounds end at 1:55 on one map and something else on another. You set mp_roundtime but not mp_roundtime_defuse and mp_roundtime_hostage. The specific ones win on the map types they name.

The server changes map after the match. mp_match_end_restart or mp_endmatch_votenextmap is on. Both should be 0 on a match server.

Nobody can connect to GOTV. The GOTV port is not allocated or not open. It is a separate UDP port from the game port, and on a panel host it must exist as an allocation before tv_port can bind it.

The demo is missing after a crash. GOTV writes the file when recording stops. A hard crash mid-map loses it. This is exactly what round backups are for, and it is an argument for a scheduled restart between sessions rather than one long-lived process.

Players are auto-balanced onto the wrong team. mp_autoteambalance 1 and mp_limitteams are doing it. Both belong at 0 in a match config.

A pause cannot be lifted. Some pause commands need both teams, some need an admin. With MatchZy, .unpause from the other team, or an admin with the right flag.

FAQ#

What is the standard CS2 competitive match format?

MR12: mp_maxrounds 24, first to 13, sides swapped at 12 rounds with mp_halftime 1. Overtime is MR3 with mp_overtime_maxrounds 6 and $12,500 of starting money, repeated until somebody wins.

Do I need MatchZy, or can I run a match with configs?

You can run one with configs. What you lose is the ready-up system, the knife-round automation, timeouts that count themselves, and round restore in one command. For a regular team the plugin pays for itself the first time somebody disconnects in round 19.

Where are GOTV demos saved?

In the game directory, game/csgo/, named with the date and map when tv_autorecord is on. Download them through the file manager or over SFTP. They are large, so delete or archive them on a schedule rather than when the disk fills.

Can I run a practice server and a match server on one plan?

Not at the same time on one server, because practice needs sv_cheats 1 and a match must not have it. You can switch one server between the two with configs, or run two small servers, which is what most teams end up doing.

How do I stop strangers joining a scrim?

Set sv_password and give it to the ten people, or load a MatchZy match config, which whitelists the Steam ids in it and rejects everyone else. The password is simpler; the whitelist also puts people on the correct team.

Does 128 tick make my shots register better in CS2?

Much less than it did in CS:GO. Sub-tick timing means the server evaluates a shot at the moment it was fired rather than at the next tick. Grenade physics and movement still run per tick, which is the remaining real argument for 128.


Комментарии

Полностью анонимно: без аккаунта, без почты, без cookie. Мы храним имя, которое вы ввели, текст и время - больше ничего. Количество ссылок ограничено, разметка не отображается.

0/2000