Side switching in CS2
Limitations
Sometimes it happens that teams are not on their correct sides, even more often with CS2 update that made cl_spec_swapplayersides
obsolete. This is not so easy thing to mitigate due to two assumptions, that we made to allow for the biggest freedom for the developers:
- HUDs work on raw GSI data
- We don't inject Match data directly
Those two points mean that for LHM HUD is basically a black box: We send raw GSI (not parsed, and not filled with LHM Team / Player entities), and HUD should be figuring out what to display. While this usually shouldn't be an issue, switching sides means that we need to modify Match entity, and LHM makes a few integrity checks to make sure that it actually can be done:
- Is there a match set as "Current"? If no, sides can't be switched. If there is:
- Did game send any data? If no, sides can't be switched (this case never happend IRL). If we have data from the game:
- Is veto empty? If so, switch the teams directly in Match settings. If veto isn't empty:
- Is there a
pick
in veto, withmapName
that corresponds to the map that was sent in the last GSI package? If yes, switch, if no, sides can't be switched.
Switching manually
You can trigger manual switch by clicking Alt+R
, or by sending POST /api/match/reverse
request. The switch is still limited by some factors.
Switching automatically
Currently there are two auto-switch settings (they are not exclusive, so they can both be turned on):
- Auto Switch
- Half Time Behaviour
Auto Switch
Auto Switch works based on the team player list. LHM reads incoming data from the game, reads current Match, finds LHM-based Player Entites based on the in-game SteamID, and tries to decide whether Teams are set correctly or not. Due to the fact that it works based on the LHM's entity associations, Player must have Team specified, for the LHM to make an informed decisions, and if there are players that are not in the LHM database, or have different or empty Team, auto switch will usually decide to not switch, as it's better to have false negative than false positive in this situation.
Auto Switch check loop is triggered every 2.5s.
Half Time Behaviour
Half Time Behaviour is a setting that allow to pick 3 different modes, that define what happens when CS2 match goes to the other half. It only is triggered on the instance between halfs, and not during the game.
None
- Nothing happens, no automated data patch nor side switchSwitch teams (left <-> right)
- This option will automatically switch Team sides between halfs, at both regulation and overtime, to bring down the time with wrong data as low as possible. The limitations still apply.Force keep teams' sides
- This option is mostly dedicated for LAN environment, to keep proper orientation of teams in the HUD in relation to the actual stage. If a Team A starts on the left side of the screen, LHM will patch incoming data so HUDs will still display Team A on the left after half time.
The nature of Force keep teams' sides
solution "fakes" spectator slots, so binds observer press to spectate players will not be correct, compared to the numbers visible in the HUD (To spectate Player 1, observer will have to press 6), however we are working on the solution for this. This is also makes it a "customer-centric" option, to not confuse viewers when teams and players change their position.
Why "Half Time Behaviour" is needed
Half Time Behaviour is a response to Valve removing cl_spec_swapplayersides
and changing default spectating behaviour. Up until May 2024, if Team A was displayed on the left side of the match board, it stayed there (unless cl_spec_swapplayersides
was manually changed), so there was visual and narrative consistency. In May that behaviour was changed, to keep Counter-Terrorists on the left side throughout the match, so if Team A started on the left, after the half it was on the right (which is not the greatest experience on stage, where players will keep their seats, but main screen will show switched teams).