Overview
The Elimination Stage automaton handles Head-to-Head matches (1v1 or Team vs Team) with a sophisticated state machine that manages:- Ban phases (single or double ban rounds)
- Pick phases (turn-based map selection)
- Timeout system (one per team)
- Best-of logic (BO7, BO9, BO11, etc.)
- Tiebreaker enforcement
- Score validation and win condition checking
Match Flow
A typical elimination match follows this sequence:Ban Phase
Teams alternate banning maps from the pool. The team with
firstban privilege goes first.- Each team bans 2 maps (configurable)
- Banned maps cannot be picked
- Tiebreaker (TB1) cannot be banned
Pick Phase
Teams alternate picking maps to play. The team with
firstpick privilege goes first.- Picked maps are loaded and played
- Scores are tallied after each map
- Picking alternates based on last pick (not based on who won)
Playing
When a map is picked:
- Map is loaded with correct mods
- 90-second timer starts
- Match begins when players ready or timer expires
- Scores are extracted via regex when match finishes
- Point awarded to winning team
State Machine
The elimination automaton uses a complex state machine to manage the turn-based flow:State Categories
| Category | States | Description |
|---|---|---|
| Initialization | Idle | Waiting for referee to configure and start |
| Banning Phase | BanPhaseStartWaitingForBanRedWaitingForBanBlue | System enforces map bans based on configured order |
| Picking Phase | PickPhaseStartWaitingForPickRedWaitingForPickBlue | System waits for active team to select a map |
| Gameplay | WaitingForStartPlaying | Map loaded, timer running, or match in progress |
| Resolution | MatchFinished | One team reached win condition |
| Interrupts | OnTimeoutMatchOnHold | Timeout active or panic mode engaged |
Pick and Ban Mechanics
Map Validation
When a player types a map slot (e.g.,NM1, HD2), the system validates:
- Map exists in the current round’s pool
- Map is not already banned
- Map is not already picked
- Map is not TB1 (tiebreaker handled separately)
AutoRefEliminationStage.cs:518-531
Ban Phase Logic
Default configuration: 2 bans per team, alternatingPick Phase Logic
Picking alternates based onlastPick (who picked last, not who won):
- Opponent gets to pick for them
- Picking order is not altered
- Next pick returns to original alternation
AutoRefEliminationStage.cs:607-635
Tiebreaker Enforcement
When both teams reach match point:AutoRefEliminationStage.cs:804-809
Best-Of Logic
Win condition is calculated dynamically:| Best Of | Points to Win | Example Score |
|---|---|---|
| BO7 | 4 | 4-2, 4-3 |
| BO9 | 5 | 5-3, 5-4 |
| BO11 | 6 | 6-4, 6-5 |
| BO13 | 7 | 7-5, 7-6 |
AutoRefEliminationStage.cs:811-826
Score Processing
Scores are extracted using regex when BanchoBot announces results:AutoRefEliminationStage.cs:270-289, 336-364
Double Ban Rounds
For certain rounds (e.g., semifinals, finals), a second ban phase occurs mid-match:- Initial ban phase (2 per team)
- Play 4 maps
- Second ban phase (2 per team)
- Continue picking from remaining maps
AutoRefEliminationStage.cs:655-667, 795-800
Administrative Commands
Commands prefixed with> can be issued by the assigned referee via IRC or Discord.
Configuration Commands
Control Commands
Start Automation
firstpick and firstban to be set.The system will:- Validate configuration
- Enter
BanPhaseStart - Begin the state machine cycle
Stop Automation
Utility Commands
Manually Set Map
HD NF and starts a 90-second timer.Player Commands
Players interact with the automation by typing in IRC chat:Pick and Ban
During their turn, players type the map slot:Timeout Request
Players can request a timeout:- Each team gets one timeout per match
- Can be called during ban phase, pick phase, or while waiting for start
- Timeout lasts for a fixed duration (configurable timer)
- System tracks usage via
redTimeoutRequestandblueTimeoutRequestflags
AutoRefEliminationStage.cs:569-602
Timeout requests are validated against the sender’s team. If a team already used their timeout, subsequent requests are ignored.
Room Settings
Elimination rooms use TeamVs mode with ScoreV2 and 3 slots (1 per team + referee):- TeamMode: 2 (TeamVs)
- WinCondition: 3 (ScoreV2)
- Slots: 3
Safety and Logging
Discord Thread Integration
Every elimination match gets its own Discord thread:- All IRC messages mirrored in real-time
- Pick/ban history logged
- Score updates posted automatically
- Win condition announcements
Manual IRC Access
On match start, the bot provides the IRC join command:- The server disconnects
- Manual intervention is required during panic
- You want to observe the match directly
Panic Protocol
See Panic Protocol for emergency override procedures.Best Practices
Pre-Match Configuration
- Verify both teams are correctly assigned in database
- Confirm map pool is loaded for the round
- Determine first pick/ban (coin flip, higher seed, etc.)
- Set
>firstpickand>firstbanbefore starting
During Match
- Use
>inviteto bring players into lobby - Ensure both teams are in correct slots (Red vs Blue)
- Start automation with
>start - Monitor Discord thread for disputes or technical issues
- Use
!panicif anything goes wrong - Use
>mapsto check current match status
Technical Details
State Transition Logic
The state machine is event-driven, triggered by:- Player chat input (map slot during pick/ban)
- BanchoBot messages (“All players are ready”, “Countdown finished”, “The match has finished”)
- Admin commands (
>start,>stop,>timeout) - Panic triggers (
!panic,>panic_over)
AutoRefEliminationStage.cs:564-845
Data Persistence
On/endref, the following are saved:
AutoRefEliminationStage.cs:174-183