CSGO: Spectator Tools

From Valve Developer Community

Jump to: navigation, search

Contents

Spectator Cameras

Spectator cameras allow a spectator or GOTV viewer to view a selected player from a static camera position within the world.

How do I view a player through a static spectator camera?

Press the number key that corresponds to a living player that you want to view, like normal, but press SHIFT while doing so. So for example, if you would like to watch player "Bob" and "Bob" is in spectator player position 4, you would press "SHIFT-4".

How does the game select a camera position?

When a player is selected to be viewed from a static camera, the game will check all of the camera positions to see which of them can see Bob. It then takes the list of cameras that can see Bob and weights them by a number of factors like distance, how many other players the camera can see, is the bomb in view, etc.

Once a camera has been selected, the spectator view mode switches to ROAMING and moves to the position of the selected camera spot, angling the view to encompass the selected player and any other relevant objects close by.

Since you are in ROAMING, you can still move and rotate the camera freely. The camera angle will not update automatically in this mode. You can force the camera angle to update by selecting the same player again with SHIFT plus the number that corresponds to that player (assuming they are still alive).

Note: if the system does not find a good static camera to switch to, it will fall back to viewing your selected player in first person mode.

How do I exit this static camera mode?

To exit this mode, you can hit SPACE to cycle to the next mode or simply press a number key of a living player to switch to the first person view of that player.

Creating Spectator Cameras

Static camera positions can be defined in a text file for each map. The file is located in the same directory as the bsp and should be called:

<mapname>_cameras.txt

So for example, the camera file for dust2 is:

game\csgo\maps\de_dust2_cameras.txt

What's In a Map Camera File?

If you open an existing map camera file, you see something like this:

"Cameras"
{
	"House"		"5393.2 3802.7 -513.3 15.6 82.6"
	"ASite1"	"5186.8 4401.7 -523.1 23.7 1.1"
	"ASite2"	"5606.2 4857.4 -517.2 16.5 -125.5"
	"CTSpawn"	"5085.5 3924.2 -469.2 16.5 65.3"
	"Roof"		"6395.1 5107.8 -273.7 20.7 -133.0"
	"Front"	        "7017.3 4367.6 -669.7 24.0 142.8"
	"Street"	"6844.8 5314.1 -150.3 56.2 -132.2"
	"Chickens"	"6874.3 6511.8 -236.3 45.2 -136.9"
	"Bathroom"	"4838.3 6611.0 -481.5 41.1 -28.9"
}

In between the {}'s, you have a key and a value. The first part is the key and is just a descriptive word. Use it to help you remember where the position is located in the map. The name doesn't matter, it's not used by the game.

The second part is the actual coordinates of the camera and is used by the game. This line includes 5 numbers separated by a space. The first three numbers are the X Y Z coordinates of where the camera sits. The 4th and 5th numbers are the PITCH and YAW of the cameras angles and is the direction that it points. The angle will not be exactly what you see in the game, it will be the view that the camera originally tests to see if it can "see" your selected player.

How do I Create or Change Positions?

Load up the map that you want to add cameras to and either join team spectator or fly around using noclip. It's also a good idea to kick the bots if you are playing with bots ("bot_kick").

Once you've moved to a position that you would like to have a camera, bring down the console and type"

spec_pos

This spits out the 5 numbers that you need to paste into your "cameras" file. Just copy those and paste them in, making sure you have quotes around them.

That's it! Save your file, reload the map and test them out!

How to Test Spectator Cameras

There are a few ways to test your cameras. The first, is to watch a prerecorded demo of a competitive match (with playdemo). The second is to spectate a match by being on Team Spectator. To spectate a match with bots, just start an offline game (in casual mode), join team Spectators and set “sv_competitive_official_5v5 1” in the console. The third is to watch a live game via GOTV.

Going to static positions via key bindings

You can create manual binds to go to specific predetermined places on the map like so:

bind <KEY> "spec_mode 6; spec_goto X Y Z PITCH YAW"

spec_mode 6 puts you in ROAMING mode, this is important.

Personal tools
Namespaces
Variants
Actions