UDN
Search public documentation:

Steam
日本語訳
中国翻译
한국어

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

Steam

Document Summary: How to use and implement the Steam Integration in UnrealEngine3.

Document Changelog: Created by John Scott, updated for SteamPipe by Josh Markiewicz.

Using the Steam client

To get the initial game (after setting up the Content Server)

  • Get the latest Steam SDK, and copy sdk/client/Steam.exe and sdk/client/Steam.cfg to a local folder
    • Licensees can copy it from '//depot/UnrealEngine3/Development/External/Steamworks/sdk/client/...'
    • UDK users can register and download from here https://partner.steamgames.com/home
  • SteamPipe content delivery
    • Make 'steam_dev.cfg' in the same directory as the client and add @LocalContentServer "content server ip"
  • ContentTool deprecated
    • Make 'steam.cfg' writable and set the 'SdkContentServerAdrs' to the IP of where you are running your local content server
  • Run 'Steam.exe'
  • Right mouse click on your game (in our case 'Unreal Development Kit') on the 'My games' tab and install
  • After installation is complete, right mouse click and 'Launch game'

To get an update (after setting up the Content Server)

  • Updates are retrieved automatically as long as the Steam client is running
    • Restart the Steam client if you do not wish to wait for the polling interval

Notes (pertains to deprecated ContentTool only)

  • If you get an update, but the local content server has a fresh complete (non iterative) build, then the client will get confused. To fix this, delete all but 'Steam.exe' and 'Steam.cfg' in your local folder and start again.
    • During initial development, this tends to happen a lot.

Using SteamPipe for Content Delivery

SteamPipe is Valve's newer and more efficient means of delivering content to the Steam Client. It consists of two parts; the "Content Builder", an executable SteamCmd.exe and all the config scripts necessary to describe agame and its content, and the "Content Server", a web service that can be run locally to server the game images.

Before getting started, make sure to talk to your Steam Technical Account Manager to get an AppId and set of DepotIds for your game.

All the documentation for SteamPipe can be found at Valve's partner website

  • Follow the directions under "Steam Build Account" to create a build account that will make the game
  • Follow the directions "Initial Setup for New SteamPipe Apps" to configure the metadata related to the game

Steam SDK directory structure and the \sdk\tools\steampipe\ directory

The SteamPipe tool resides under the \ContentBuilder\ directory structure

  • \Builder\ directory contains steamcmd.exe the main tool used to create builds
  • \Scripts\ contains the build scripts for the game depots (this can be changed, Epic stores the script (.vdf) files in the \MyGame\Build\Steam directory for organizational purposes)
  • \Content\ contains all the game files to build into depots (this can be changed, Epic uses a root \SteamContent\ directory on the build machine)
  • \Output\ contains the build logs, depot cache and intermediate files (this can be changed, Epic uses a root \SteamContent\ directory on the build machine)

Creating some local directory structure

Create a \SteamContent\ directory off of the build machine root (although it can technically be anywhere). This folder should contain two additional folders

  • \ContentBuilder\
    • Make a directory called 'output' where the game image cache will reside
    • Contains *.csd and *.csm files which are the actual caches, they are ok to delete from time to time but will make the next build slower
  • \ContentServer\
    • This is part of the directory structure of the Mongoose webserver, contains the actual build image
    • Make a directory called 'htdocs' where the actual game images and the files related to serving content
    • This is the root directory displayed if you go to the webserver via a browser

Run SteamCmd.exe

The first time SteamCmd.exe is run, it will download and populate its directory with all the files it needs, much like the Steam client

NOTE: If the tool errors and complains about proper login, the build account is protected by Steam Guard. Check the email address specified for the build account for a Steam Guard code, and run steamcmd.exe "set_steam_guard_code emailedcodehere", before trying again.

NOTE: If running steamcmd.exe results in the following error: "SteamUpdater: Error: Steam needs to be online to update. Please confirm your network connection and try again." Resolution: Go to Internet Options->Connections->Lan Settings and check Automatically detect settings. (This is on their FAQ but hard to find and bit me personally)

Creating Depot Build Config Files

There are sample scripts in the sdk \ContentBuilder\scripts folder, but it looks something like this:

"DepotBuildConfig"
{
  "DepotID" "<yourdepotid>"

  // include all files recursively
  "FileMapping"
  {
    "LocalPath" "*"
    "DepotPath" "."
    "recursive" "1"
  }

  // but exclude all symbol files
  // "FileExclusion" "*.pdb"
}

Create App Build File

The app build file connects all the depot build configs into one game image and looks something like this:

"appbuild"
{
   "appid"   "<yourappid>"
   "desc" "<descriptive build name>" // description for this build
   "buildoutput" "D:\SteamContent\ContentBuilder\output\MyGame\" // build output folder for .log, .csm & .csd files, relative to location of this file
   "contentroot" "D:\Builds\UE3\" // root content folder, relative to location of this file
   "setlive"   "local" // branch to set live after successful build, none if empty
   "preview" "0" // to enable preview builds
   "nobaseline" "0" // build without using baseline manifest
   "local"   "D:\SteamContent\ContentServer\htdocs"   // set to file path of local content server
   "depotsskipped" "0" // if not partial build, fail if not all depots are included

   "depots"
   {
      "<firstdepotid>" "depot_build_<depotid>.vdf"
   }
}

There are three build types support by SteamPipe:

  • "Preview" builds only output logs and file manifests and are used for rapid iteration when setting up the build
  • "Local" Builds for the Local Content Server (LCS "the Mongoose server") for faster downloads and local storage of the game image
  • "SteamPipe" Builds and uploads to Valve servers for content delivery

Running the App Build File Script

The example below would run the above app build script to create the game image with one depot defined

builder\steamcmd.exe +login account password +run_app_build ..\scripts\app_build.vdf +quit

The first time you may want to run with "preview" set to "1" to ensure the manifest is correct, after that has been verified set it back to "0"

NOTE: If the build errors and complains about proper login, the build account is protected by Steam Guard. Check the email address specified for the build account for a Steam Guard code, and run steamcmd.exe "set_steam_guard_code emailedcodehere", before trying again.

Managing the Build

After a successful run of the app build script, the build can be managed via Valve's admin website (under App Admin, Technical Data, then Builds tabs)

Follow the directions in the SteamPipe documentation to setup the metadata on the backend further

Steam Local Content Server (Mongoose)

The Local Content Server (LCS) is a webserver hosted by the build machine to deliver content to the Steam Client, documented on the Steam partner website here.

The mongoose web server can be found in the \ContentBuilder\ directory of the sdk directory structure

  • Configure the webserver to know where the output files will be hosted via the mongoose.conf file
    • Set the document_root variable to the directory that was created locally on the build machine C:\SteamContent\ContentServer\htdocs\ for example
    • This will match the "local" value specified in the app build file
  • Launch the webserver mongoose-3.1.exe and there will appear an "m" icon in the system tray
    • The executable can be run independently or as a service. To run it as a service, right click the system tray icon once the server has launched and select "Install Service"
  • Connect to 127.0.0.1 and verify the server is up and running, click on the depot directory reference in the webpage to verify it is accessing the right location
  • Once it is running as a service, you can run the executable again to get the system tray icon to appear so that you can "Uninstall Service"

See the SteamPipe content server page on the Steam partner website, for additional information on setting this up.

Deprecated Using the Steam Content Tool

There are two methods, using the GUI and using Steam Script.

Deprecated Using the GUI to create an initial build with solution and project files

  • Copy the build you wish to publish (e.g. 'C:\Builds\UnrealEngine3') locally
  • Run the content tool (part of the Steam SDK) 'sdk/tools/ContentTool.exe'
  • Click the 'New Solution' button
  • Click 'Next'
  • Solution Section: Type in the 'Solution Name' (UTGame) and the location to 'C:\SteamGame'
  • Click 'Next'
  • Application Section: Type in the 'Application Name' ('Unreal Development Kit' - this is what appears in the GUI), File Delivery is 'Loose Files' and 'Application ID' is 13260
  • Click 'Next'
  • Depot Section: Name is 'UTGame', Type is 'Content', 'Project Location' is 'C:\SteamGame', 'Depot Location' to 'C:\SteamGame\Depot', and 'Depot ID' to 13261
  • Click 'Next'
  • Click on the listbox entry to the right of and type 'C:\Builds\UnrealEngine3'
  • Click 'Finish' (It will list files that it found to add to the project - click OK to synchronise the depot)
  • Click on the 'Solution Properties' button near the top left of the GUI; it's just below the text of 'Solution Explorer'
  • Expand out the tree views 'Launch Options -> Label = Default -> Command line = Unreal Development Kit'
  • Right mouse click and change the command line to 'Binaries\Win32\UDKGame.exe'
  • Close that window, save when prompted.
  • Click the 'Build' toolbar button (this will take some time)
  • 'C:\SteamGame\Depot' will now contain '13261_0.dat', '13261_0.blob' and 'UTGame.depot' (this is appid_version.dat and appid_version.blob)
  • From the Publish menu, select 'Publish to Local Testing Server', this will copy '13261_0.dat', '13261_0.blob' and 'ContentDescriptionDB.xml' to the local server.
  • Run the Content Server

Deprecated Using Steam Script to create new versions

  • Spawn a DOS box
  • Run '//depot/UnrealEngine3/Development/External/Steamworks/sdk/tools/ContentTool.com' /verbose /console /filename '//depot/UnrealEngine3/UDKGame/Build/Steam/SteamMakeVersion.smd'
  • Copy the new files from 'C:\SteamGame\Depot' to 'C:\Steam\DepotRoot'
  • Copy 'C:\SteamGame\ContentDescriptionDB.xml' to 'C:\Steam\DepotRoot'
  • Stop then start the content server so it detects the update.

Notes

  • The update process is automated in the build system; check //depot/UnrealEngine3/Development/Builder/Scripts/Build/SteamVersion.build for details
  • Be very careful when editing .sts and .spj files as seemingly innocuous changes can cause problems. Also, don't change the relative paths at all; this also causes problems.

Deprecated Running the Steam Content Server

There are two methods to running the content server; from a command prompt or as a service.

Deprecated From a Command Prompt

  • Spawn a DOS box
  • Run '//depot/UnrealEngine3/Development/External/Steamworks/sdk/tools/contentserver/contentserver.exe' /verbose /DepotPath 'C:\SteamGame\LocalTestServer'
  • Watch lots of debug spew fly by, but you should see mention of 13261_0 right at the end
  • Steam clients can now connect and download this build

Deprecated As a Service

  • Move 'C:\SteamGame\LocalTestServer' to 'C:\Steam\DepotRoot' (unless you're using ContentServerCfg.txt to set the depot path for the service; see below)
  • Spawn a DOS box
  • Run '//depot/UnrealEngine3/Development/External/Steamworks/sdk/tools/contentserver/contentserver.exe' /install (this automatically starts the service)
  • Steam clients can now connect and download this build

Deprecated Notes

  • The content server generally works very well and seamlessly handles a lot of the typical network nightmares.
  • I have found two notable exceptions
    • The content server does not detect new versions, to register a new version you need to restart the service.
    • The depot location when running as a service cannot be set from the commandline. When running as a service, it can only be set via a file named ContentServerCfg.txt located in the same directory as ContentServer.exe. Otherwise the default value of \Steam\DepotRoot is used (the path is relative to the root of the volume). The syntax of this file is similar to UE3 .ini files; so for example, to change the depot location from \Steam\DepotRoot to \LocalContentServer, ContentServerCfg.txt would need to contain the following two lines:

           [ClientContent]
           DepotRootPath = "\LocalContentServer"

Using Steam in Game

Simply having the Steam client running when launching the game will allow you to access all the Steam features. If the Steam client is not running, the networking layer will fall back internally to the common online subsystem (which basically has the functionality of OnlineSubsystemPC).

The authentication system is quite simple; if you don't 'own' the game, you can't play on a server. Ask Valve for your own app id to test network connectivity with your games; the 'Unreal Development Kit' app id is owned by everyone.