CS:GO Workshop For Server Operators
CSGO might let you host workshop maps on your dedicated servers.
Getting your web api authorization key
To download maps from the workshop, your server needs access to the steam web api. To allow this you'll need an authorization key which you can generate here:[1].
Once you have your key, you can either put your key in a text file named 'webapi_authkey.txt' in the game/csgo folder, or run your server with the commandline parameter '-authkey XXXXXXX' where XXXXXXX is your key.
Hosting workshop maps
The console command for hosting a workshop map is
host_workshop_map <file id>
You can find the file id for a workshop map in its workshop page url.
This command will download the latest version of the map, create a mapgroup with that map as a single entry and host it.
You can also host workshop collections the same way. Use the command
host_workshop_collection <collectionid>
where collectionid is the number found the same way as above but in the collection page's url. This command will then download all maps in the collection and create a mapgroup out of them, then host it.
Map updates
When changing level to a workshop map, your server will first check if a newer version is available and download it if needed. Clients will be notified with chat messages of the download and its progress. You can control these messages and their frequency with these convars:
sv_broadcast_ugc_downloads <0|1> sv_broadcast_ugc_download_progress_interval <seconds>
Connecting clients will download the latest version of the hosted workshop map as a part of the connection process.
Troubleshooting
To enable verbose spew, set
sv_debug_ugc_downloads 1 developer 1
With these set, your server will spew the results it gets from steam. When working, you'll see output like this:
Fetched 1076 bytes via HTTP: response { result int( 1 = 0x1 ) resultcount int( 1 = 0x1 ) publishedfiledetails { 0 { publishedfileid int( 123868347 = 0x76214BB ) result int( 1 = 0x1 ) creator 76561197975050072 creator_app_id int( 745 = 0x2E9 ) consumer_app_id int( 730 = 0x2DA ) filename mymaps/de_aztec_proper.bsp file_size int( 26420720 = 0x19325F0 ) file_url http://cloud-2.steampowered.com/ugc/XXX/XXXXXXX/ hcontent_file 884098750744150125 preview_url http://cloud-2.steampowered.com/ugc/XXX/XXXXXX/ hcontent_preview 884098750744170633 title De_Aztec_Proper description Aztec with adjusted visibility. A rebalanced underpass area,two new routes and many other changes remove the map's CT bias. time_created int( 1359545920 = 0x51090640 ) time_updated int( 1359545920 = 0x51090640 ) visibility int( 0 = 0x0 ) banned int( 0 = 0x0 ) ban_reason subscriptions int( 3 = 0x3 ) favorited int( 1 = 0x1 ) lifetime_subscriptions int( 3 = 0x3 ) lifetime_favorited int( 1 = 0x1 ) views int( 13 = 0xD ) tags { 0 { tag Classic } } } } }
When an error occurs, you may see something like the below:
host_workshop_map 122439431 Fetched 140 bytes via HTTP: response { result int( 1 = 0x1 ) resultcount int( 0 = 0x0 ) publishedfiledetails { 0 { publishedfileid int( 122439431 = 0x74C4707 ) result int( 9 = 0x9 ) } } } Failed to parse file details KV for id 122439431. Result enum: 9 File id 122439431 not found. Probably removed from workshop
This is a common error (result 9, file not found) which can occur if a file is removed from workshop, or if the permissions are changed to friends-only or private. This error will also occur if there is a problem with your auth key.