Host commands

Contract shared by the client menu and the server. Anyone working on this must follow the ids, layout and semantics below exactly.

Status: the ids and layouts below are the 0.75 packets, which only the client still speaks (to vanilla-compatible servers). Our server speaks protocol 1.0 only, so the same contract travels as 1.0 GenericCommands (docs/protocol-1.0.md 10), with the fields as decimal strings in the order given here:

  • client -> server: host <command> <arg1> <arg2> (player_id is dropped: the sender is authoritative). The client’s proto10_send_075() turns the menu’s PACKET_HOSTCMD into it; the server’s bridge hands it to hostcmd_apply, the same queue the console uses.

  • server -> client: host-status <bots> <humans> <autofill> <flags> <difficulty> (the difficulty is the 1.0-only fifth field), sent by Proto10/Bridge.c as a per-tick diff per player (so autofill, joins and console commands reach the menu too). The client replays it into read_PacketHostStatus.

  • server -> client: host-bots <team1> <team2>, each team’s bots (1.0 only, its own command: a client keeps six parts of a command), sent on a change with host-status; the Bots menu shows them.

Without host-status the menu says “Servidor sem suporte a bots.”: that is what a 1.0 server without this support (or a vanilla one) looks like.

Why a dedicated packet

The host (the player who started the local/listen server, or an admin of a remote one) manages bots from the ESC menu. Reusing chat would pollute the chat and expose commands to everyone. A dedicated packet keeps the vanilla 0.75/0.76 clients compatible: unknown packet ids are ignored by vanilla clients and by vanilla servers, so both directions keep working.

Ids

sideidname
client -> server63PACKET_HOSTCMD
server -> client64PACKET_HOSTSTATUS

50 is deliberately avoided: it is the master/statistics callback id used by SpadesX, so the 60-79 range is used for our extensions.

PACKET_HOSTCMD (client -> server)

u8  player_id   (ignored by the server, the sender is authoritative)
u8  command     see the table below
u8  arg1        (meaning depends on the command, 0 when unused)
u8  arg2        (meaning depends on the command, 0 when unused)
commandnamearg1arg2
0ADD_BOTScount (1..64, a whole team)team: 0 = blue, 1 = green, 2 = balance
1KICK_BOTS00 (removes every bot)
2SET_AUTOFILLtarget player count (0 = off)0
3KICK_BOTbot player id0
4FILLfill to arg1 players per team0
5DIFFICULTY0 = easy, 1 = normal, 2 = hard0
6TUTORIAL_BOTteam of the bot (0 = blue, 1 = green)0 (one dummy bot on the other team’s spawn area: it never moves or fires)
7TEAM_BOTScount (0..64)team (0 = blue, 1 = green): that team gets exactly count bots, added or the newest removed (the Bots menu’s row)

Permissions are checked server side: only the player who owns the listen server (or a console/admin command) may use it. Unauthorised commands are answered with HOSTSTATUS reason NOT_ALLOWED and change nothing.

PACKET_HOSTSTATUS (server -> client)

Sent to a player right after they spawn/join, and after every host command, so the menu can show live numbers.

u8  bot_count
u8  player_count      (humans, excluding bots)
u8  autofill_target   (0 = disabled)
u8  flags             bit 0: sender may manage bots (host/admin),
                      bit 1: bots are enabled on this server,
                      bit 2: autofill is enabled

Server semantics

Client semantics