Description

The Inventory Service can be used in two ways - either server-less or with the addition of a trusted server that knows game state.

Without a game server, the game client can communicate directly to the steam service to retrieve users inventory contents, consume and exchange items, and receive new items granted as an effect of playtime. Users can also purchase items directly from the Item Store, or trade and exchange markets in the Steam community.

However because the client can't be trusted (and the keys in a client can always be captured by an attacker) you can't give users specific items in this scheme. Rather you select certain items that can be dropped, and configure a drop frequency. At appropriate times, the game client invokes ISteamInventory::TriggerItemDrop. Steam servers manage the playtime and drop frequency per-player. These APIs are called using an internal "Client API Key" that is assumed to be untrusted.

If you have a participating trusted server then you can use a privileged Steam API key on the server and grant explicit items for appropriate situations. It is still important to keep in mind that you can't trust your own clients so you can only do this when the server is the master of the state of the game.

Finally in conjunction with the Inventory Service you can sell an individual item or a cart of items, in-game or through a web-based storefront.

Check out this presentation from Steam Dev Days 2016 for an implementation overview, details on the specific problems that the Inventory Service solves for developers, and demonstration on how partners are already using the system to serve their customers.

Implementation Overview

Create Item Definitions You'll need to start by creating and uploading some item definitions (ItemDefs). These describe the possible set of items in your game. You don't need to use these from your game itself but Steam needs them to display inventory correctly. To create ItemDefs, go to the Steam Inventory section of your Steamworks configuration area. You can get there from here: https://partner.steamgames.com/apps/inventoryservice/

Enable Inventory Service Once you have item definitions, turn on the Inventory Service by checking "Enable Inventory Service" on the page you uploaded your item definitions.

Set Asset Server Key First generate a Publisher Web API key for your application (instructions: Creating a Publisher Web API Key) and put it into the Asset Server Key field in the Steam Economy Settings.

Download Users Inventory Have your game client download the users inventory by calling ISteamInventory::GetAllItems. Its usually good to do this periodically in case the user has added more items via trading or purchase. Depending on your game, a check at the beginning of each game or level might be appropriate.