This article's documentation is for anything that uses the Source engine. Click here for more information.

SourceTV

From Valve Developer Community
Jump to: navigation, search
English (en)Polski (pl)中文 (zh)Translate (Translate)

SourceTV offers the ability to have an unlimited[confirm] number of spectators watching online games based on the Source Source.

SourceTV spectators are invisible to players and can't interact with the running game in any way. The camera view in SourceTV is controlled by an auto-director AI or a human camera man. The broadcast is usually delayed by a certain amount of time. This ensures that the playing teams can't use SourceTV to get any usable information about their opponents. SourceTV can also record server-side demos that contain the whole game with all entities and events.

Providing a SourceTV broadcast for only a few spectators is an easy task and only needs a single variable change on the game server. Installing a larger SourceTV network for thousands of spectators needs more planning time and experience about required bandwidth, CPU and RAM demands.

Note.pngNote:If you follow a player in "First-Person" as a spectator in a game or SourceTV, you don't exactly see what the player sees. Spectators see the game world without lag compensation.

Supported Games

  1. 2004 Counter-Strike: Source Counter-Strike: Source
  2. 2005 Day of Defeat: Source Day of Defeat: Source
  3. 2006 Garry's Mod Garry's Mod
  4. 2007 Team Fortress 2 Team Fortress 2
  5. 2012 Counter-Strike: Global Offensive Counter-Strike: Global Offensive
  6. 2020 Black Mesa Black Mesa

Spectating Games

To watch a game via SourceTV, start Steam, and choose Servers from the Steam menu to open the server browser. Click to select the Spectate tab. You can narrow the list of servers by clicking Change filters and selected a specific game. After the list has been updated, double click on a server in the list you want to spectate and you'll be connected.

If game leagues announce upcoming matches to be broadcast on SourceTV, they often provide IP addresses of their SourceTV servers (IP:Port). Instead of searching them via the server list, you can instead go to the Favorites tab and add the SourceTV address to your server list by pressing the right mouse button and choosing Add server by IP address. Alternatively, you can open the Source console window and use the connect command to spectate a certain game. For example:

connect 192.168.130.42:27020

The default SourceTV port number is 27020, but may be changed. It should always be included in the given SourceTV IP address, since commonly this port number is different from the default game server port number 27015.

When spectating a game that is broadcast via SourceTV, the camera position and camera mode is chosen either by the auto-director or a camera man. Spectators can't switch spectator modes or players to follow as they could do HLTV, this feature was removed to reduce network bandwidth significantly. SourceTV demos still allow to switch modes and free roaming while playback.

Broadcasting Games

SourceTV is fully integrated into the Source Engine and not a separate tool like HLTV anymore. To start broadcasting a game, the game server must enable SourceTV before the map is started by setting tv_enable 1. That will create a SourceTV server instance which can be seen in-game as a bot joining the spectator team. The SourceTV server is living in the same process as the game server and is called the SourceTV master server. The SourceTV master server buffers all game data and events and broadcasts them with a certain delay to prevent cheating. The auto-director is a Mod specific module that chooses the camera mode and position based on interesting game events (like player killed, bomb exploded etc). Additionally a human spectator can become a camera man and override the auto-director camera with his own view. SourceTV spectators then connect to the same IP address as the game server but using a different port for SourceTV, usually 27020. The port number can be changed with the tv_port console variable.

Network topology for direct SourceTV connections

This configuration is pretty simple but only works for a small number of spectators, since a single server host is serving all player and all spectator clients. For larger number of spectators, this will quickly exceed the available CPU/bandwidth capacity on this machine. Therefore it is necessary to distribute the needed bandwidth and CPU demands over a system of multiple hosts, that can be expanded with increasing numbers of spectators. This is done by setting up other SourceTV servers that are connected to the SourceTV master server and relaying its game broadcast. These servers are called SourceTV relay proxies where each proxy can serve up to 255 spectators again. SourceTV proxies can also connect to other SourceTV proxies and build an unlimited network of relay stations.

Network topology for relayed SourceTV connections.

To setup a SourceTV relay proxy, start a Source Dedicated Server process without a running a map. The tv_relay command connects the relay proxy to another SourceTV server/proxy. Here an example how to create a SourceTV relay:

srcds.exe -game cstrike -console +tv_relay 127.0.0.2:27020 +tv_advertise_watchable 1
Warning.pngWarning:+tv_advertise_watchable is only required in CS:GO. If it is not present, clients will be unable to connect. See the update notes here.

The status of your local proxy can always be checked with the tv_status command. Here and example output:

--- SourceTV Status ---
Online 05:08, FPS 253.8, Version 2841 (Win32)
Master "SourceTV", delay 30
Game Time 05:01, Mod "cstrike", Map "de_dust", Players 7
Local IP 255.255.179.38:27020, KB/sec In 0.0, Out 0.0
Local Slots 128, Spectators 8, Proxies 0
Total Slots 128, Spectators 0, Proxies 0

Total slot and spectator numbers are the accumulated numbers from all connected relay proxies. If a relay proxies loses connection to it's server, you can try to reconnect quickly with tv_retry. To stop broadcasting and disconnect all clients, execute tv_stop.

Camera Man

The camera view in SourceTV is usually controlled by the auto-director module. Also a player, who joined the spectator team on the game server can become a camera man by pressing the USE key (usually 'E'). This will turn on his view as camera view for all spectators. The camera man can choose any spectator mode (First Person, Free Roaming etc), switch to any player or move around freely. The camera can be turned off by pressing USE again and the auto-director will take over again. Camera men should have a good knowledge of the general gameplay and practice camera movement before broadcasting live. A Dead player in spectator mode can't become a camera man.

Recording Games

The SourceTV master can record games without any data loss or network delay. All events and entities are recorded and the demo file can be played back just like a normal client demo (use the demoui for playback). To start recording a demo file, SourceTV must be enabled before the map was loaded, then execute tv_record demoname. Demo recording will be stopped next time the map changes or with tv_stoprecord. To automatically record every single game you can set tv_autorecord 1. Automatically recorded demo files will be named after the map and date/time when the recording started (auto-YYYYMMDD-hhmm-map.dem). SourceTV spectators can also record the game using the normal record command, but as in normal client demos, you can't change tracked player or spectator mode during replay.

Sometimes you might use SourceTV only to record demos and not actually broadcast the game. You can disable broadcasting by setting the maximum number of client slots to zero (tv_maxclients 0). To enable auto recording on your server, add these lines in your autoexec.cfg:

tv_enable 1
tv_autorecord 1
tv_maxclients 0

How To ...

Run a Win32 relay proxy without Steam
Install a Windows dedicated server (srcds.exe) using the HldsUpdateTool, you can download here. After the installation process is complete, update the server by following the steps in hldsupdatetool_readme.txt. This might take a lot of disc space, but if you run only a SourceTV relay proxy, you can delete all models, maps, materials and sounds files. Now you can start srcds.exe without running Steam in the background.
Remote control a relay proxy
SourceTV relay proxies support the same remote control commands (RCON) like a normal SRCDS game server. Use "rcon_address <ip:port>" and "rcon_password <password>" to access your target host and issue commands with "rcon <command>", eg "rcon tv_status". Note that the RCON TCP port is the default server port (usually 27015), not the SourceTV port.

Console Commands

tv_enable <0|1>
Activates SourceTV on local game server, SourceTV bot will appear as spectator client after next changelevel (master only).
tv_name <name>
Sets SourceTV name as it appears in server browser and scoreboard (master only).
tv_title <text>
Sets a SourceTV broadcast title shown in the spectator GUI
tv_maxclients <0..255>
Sets maximum client number for local SourceTV server/proxy (default 128).
tv_stop
Stops broadcasting the game via SourceTV.
tv_status
Shows SourceTV specific information.
tv_clients
Shows a list of all spectator clients connect to local SourceTV server
tv_msg <text>
Send a HUD message to all connected SourceTV spectator clients
tv_retry
Reconnects the SourceTV relay proxy to last known address (relay only).
tv_autoretry <0|1>
If enabled, SourceTV relay proxies try to reconnect to last known server after connection was lost.
tv_timeout <seconds>
Sets SourceTV relay proxy connection timeout in seconds. If a connection times out, the relay proxy tries to reconnect automatically.
tv_deltacache <size>
Increases or decreases the "delta cache". Decreases network load.
tv_delay <seconds>
Source TV broadcast delay in seconds (master only).
tv_delaymapchange <0|1>
Delays the map change on game server until rest of buffered game has been broadcasted
tv_port <port>
Set the SourceTV host port (default 27020). Must be set as srcds start parameter.
tv_maxrate <bytes>
Sets the maximum bandwidth spend per client in bytes/second (default 5000)
tv_snapshotrate <n>
Sets world snapshots broadcasted per second by SourceTV (master only).
tv_password <password>
Sets required password for connecting spectators.
tv_relaypassword <password>
Sets required password for connecting relay proxies. The connecting proxies simply use "password <password>" to connect to their counterpart's tv_relaypassword.
tv_relay <IP>
Connects a relay server to another SourceTV server/proxy
tv_record <filename>
Starts a SourceTV demo recording that records all entities & events (master only)
tv_stoprecord
Stops SourceTV demo recording (master only)
tv_autorecord <0|1>
Automatically records every game, demo file name format is auto-YYYYMMDD-hhmm-map.dem
tv_debug <0|1>
Shows additional debugging messages
tv_dispatchmode <0|1|2>
Sets Source client dispatch mode for connecting clients: 0=never, 1=if appropriate, 2=always
When not 0, clients joining this SourceTV server may be redirected to any connected SourceTV relays.
The IP that clients are redirected to can be set with ip_relay on the relay.
tv_overrideroot <0|1>
Overrides the master IP broadcast to spectators with a local IP.
tv_relayvoice <0|1>
If enabled, allow player voice chat if broadcasted (master only)
tv_transmitall <0|1>
By default entities and events outside of the auto-director view are removed from SourceTV broadcasts to save bandwidth. If tv_transmitall is enabled, the whole game is transmitted and spectators can switch their view to any player they want. This option increases bandwidth requirement per spectator client by factor 2 to 3.
tv_chattimelimit <seconds>
Limits spectators to chat only every n seconds
tv_chatgroupsize <n>
Set chat group size to n spectators. Only spectators in the same chat group can speak to each other. Chat groups are turned off with "tv_chatgroupsize 0" and everybody can speak to everybody. Setting chat groups helps reducing chatter noise and saves some bandwidth.
tv_chatgroup <name>
Allows spectators to choose their chat group. If no name if given the current chat group is shown (client only)
tv_nochat <0|1>
Disables other spectators chat lines (client only)
tv_allow_static_shots <0|1>
Allows auto-director to choose fixed camera shots (master only)
tv_allow_camera_man <0|1>
Allows spectator clients on game server to become SourceTV camera men (master only)
ip_relay <ip>
Overrides IP used to redirect TV relay connections for NAT hosts

Command Line Parameters

These command line settings can't be changed via console or rcon. They are useful if you want to restrict SourceTV abilities for rental server.

-nohltv
-tvdisable
Disables all SourceTV features on this game server.
-tvmasteronly
SourceTV can only serve one client and can't be used as relay proxy.

See also