Guide › Headless mode

Headless mode

rookstudio --run TOURNAMENT_FOLDER     # resume a tournament
rookstudio --run SETUP.json            # create one from a setup or template file, with the profile's engines

No window is opened; the version, then the progress, are printed on the console, with the tries of an engine that cannot start, the engine set aside (with its engine log) or back, as in the window, and the standings every 20 games and at the end (a team match: the teams’ scores, then each team’s engines against the other’s), a tournament’s ending with the line of the standings copies (games, draws, time control, book and event). Ctrl+C stops after the running games and the tournament can be resumed later, from the command line or the GUI. Exit codes: 0 finished, 1 error while playing, 2 nothing to run, 3 stopped before the end (by Ctrl+C, or with nothing left to play without an engine that cannot start). The memory budget and the GPUs of the profile’s Settings apply to it too.

--detach plays it in the background instead: the command returns at once, and the tournament goes on without a terminal; the window shows it (it connects to it) when it opens with the same profile, and --attach talks with it:

rookstudio --run FOLDER --detach         # in the background, on a local socket
rookstudio --attach FOLDER               # its control channel on the standard input and output

The window drives each tournament the same way: --run FOLDER --control socket (or --control stdio) plays it without printing, talking JSON lines with the window: the tournament’s events (its state, each journal line, the games in progress move by move, each game recorded, its log, its end) and the window’s commands (pause, resume, stop, changes, the end of a game, its share of the machine with --allowance THREADS:MEMORY_MB:GPUS:ONE). The first line each way is a hello, {"hello": {"protocol": 1, ...}}; a script through --attach gets the tournament’s hello and events, and may send commands such as {"c": "pause"}. One window (or script) at a time talks with a tournament; --attach lets go of it when its standard input ends or its output is no longer read, so that a script keeps its input open while it reads the answers.

The tournament can be broadcast at the same time, as from the Broadcast tab:

rookstudio --run FOLDER --tlcs 16001             # a TLCS server on UDP port 16001
rookstudio --run FOLDER --tlcs 16001 --tlcs-lanes  # one port per game: 16001, 16002…
rookstudio --run FOLDER --web 8080               # the web page on http://<this machine>:8080/
rookstudio --run FOLDER --tunnel                # the web page on the internet (serves it too, --web's port or 8080)
rookstudio --run FOLDER --live-files [DIR]       # live.pgn, standings.html, tournament.json ("live" by default)
rookstudio --run FOLDER --lichess new            # a new lichess broadcast; or --lichess ROUND_URL|ROUND_ID

--lichess takes the token from the FCG_LICHESS_TOKEN environment variable, or the profile’s.

The options can be combined. A setup file saved with broadcasting switched on broadcasts the same way without them. For viewers outside the local network, open the ports in the router: TLCV and node-tlcv connect to the TLCS port. For the web page, a tunnel avoids opening a port (see Putting the web page on the internet).

In RookStudio, F1 opens this guide beside the page, at the section of what is under the mouse.