Cockatrice 2026-09-01-Development-3.1.0-beta.10
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
GameCommand (Protocol Concept)

Game Commands Reference

This document describes game-level commands (GameCommandType) and how they are handled across the server and client.

Flow overview:

Client → GameCommandServer command handler (Server_Player, Server_AbstractParticipant, or Server_Game) → GameEvent(s) → PlayerEventHandler::event*

Command Mapping

GAME_SAY (1002)

Purpose: Send a chat message during a game.

Server:

Client:


SHUFFLE (1003)

Purpose: Shuffle a card zone (usually library).

Server:

  • Server_Player::cmdShuffle
  • Only allows shuffling the deck zone
  • Rejects if the game has not started or the player has conceded
  • Supports partial-range shuffles (start / end)
  • Emits Event_Shuffle
  • Re-reveals the top card if the deck is being tracked

Client:


ROLL_DIE (1005)

Purpose: Roll one or more dice.

Server:

Client:


DRAW_CARDS (1006)

Purpose: Draw cards from deck.

Server:

  • Server_Player::cmdDrawCards
  • Rejects if the game has not started or the player has conceded
  • Moves cards from deck to hand
  • Sends full card information privately to the drawing player
  • Sends only the draw count to all other players
  • Tracks drawn cards for undo
  • Updates revealed-top-card state when necessary
  • Emits Event_DrawCards

Client:


UNDO_DRAW (1007)

Purpose: Undo a previous draw.

Server:

  • Server_Player::cmdUndoDraw
  • Rejects if the game has not started or the player has conceded
  • Uses the tracked draw history (lastDrawList)
  • Moves the most recently drawable card from hand back to the top of the deck
  • Emits Event_GameLogNotice if undo is no longer possible

Client:

  • Processed as a normal MOVE_CARD
  • Detects Context_UndoDraw
  • Logs the undo draw instead of a normal move

FLIP_CARD (1008)

Purpose: Flip a card face up or face down.

Server:

  • Updates the card's face-down state
  • Reveals identity when turning face up
  • Emits Event_FlipCard

Client:


ATTACH_CARD (1009)

Purpose: Attach one card to another.

Server:

Client:


CREATE_TOKEN (1010)

Purpose: Create a token card.

Server:

Client:


CREATE_ARROW (1011)

Purpose: Create a visual arrow.

Server:

Client:


DELETE_ARROW (1012)

Purpose: Remove a visual arrow.

Server:

Client:


SET_CARD_ATTR (1013)

Purpose: Set a card attribute.

Server:

Client:

  • PlayerEventHandler::eventSetCardAttr
  • Updates tapped state, color, annotation, power/toughness, face-down state, attacking state, and related visuals
  • Logs attribute changes where appropriate

SET_CARD_COUNTER (1014)

Purpose: Set a card counter.

Server:

Client:


INC_CARD_COUNTER (1015)

Purpose: Increment a card counter.

Server:

Client:

  • Processed identically to SET_CARD_COUNTER

READY_START (1016)

Purpose: Mark player as ready.

Server:

  • Marks the player as ready
  • Starts the game once all required players are ready

Client:

  • Reflected through updated game state events

CONCEDE (1017)

Purpose: Concede the game.

Server:

  • Marks the player as conceded
  • Returns borrowed cards where appropriate
  • Ends the game if only one player remains

Client:

  • Reflected through updated game state events

INC_COUNTER (1018)

Purpose: Increment a player counter.

Server:

Client:


CREATE_COUNTER (1019)

Purpose: Create a player counter.

Server:

Client:


SET_COUNTER (1020)

Purpose: Set a player counter value.

Server:

Client:


DEL_COUNTER (1021)

Purpose: Delete a player counter.

Server:

Client:


NEXT_TURN (1022)

Purpose: Advance to the next turn.

Server:

Client:

  • Reflected through subsequent active-player and active-phase events

SET_ACTIVE_PHASE (1023)

Purpose: Set active phase.

Server:

Client:

  • Reflected through updated phase events

DUMP_ZONE (1024)

Purpose: Dump zone contents.

Server:

Client:


REVEAL_CARDS (1026)

Purpose: Reveal specific cards.

Server:

Client:


MOVE_CARD (1027)

Purpose: Move a card between zones.

Server:

  • Moves cards between zones
  • Updates ownership and attachments as needed
  • Emits Event_MoveCard

Client:

  • PlayerEventHandler::eventMoveCard
  • Moves the card between zones
  • Updates ownership, attachments, IDs and revealed information
  • Handles undo-draw context
  • Refreshes menus and zone layouts
  • Logs the move

SET_SIDEBOARD_PLAN (1028)

Purpose: Set sideboard configuration.

Server:

  • Server_Player::cmdSetSideboardPlan
  • Allowed only before readying for the game
  • Requires a loaded deck
  • Requires sideboarding to be unlocked
  • Stores the current sideboard plan

Client:

  • No game event is generated

DECK_SELECT (1029)

Purpose: Select a deck.

Server:

Client:

  • Reflected through updated player properties and command response

SET_SIDEBOARD_LOCK (1030)

Purpose: Lock or unlock sideboarding.

Server:

Client:

  • Reflected through updated player properties

CHANGE_ZONE_PROPERTIES (1031)

Purpose: Change zone properties.

Server:

Client:


UNCONCEDE (1032)

Purpose: Undo a concede.

Server:

  • Restores the player's active status

Client:

  • Reflected through updated game state events

JUDGE (1033)

Purpose: Execute commands on behalf of another player.

Server:

Client:

  • Transparent; resulting events are processed normally

REVERSE_TURN (1034)

Purpose: Reverse turn order.

Server:

Client:

  • Reflected by subsequent active-player progression

Notes