The Steam Inventory Service is a set of features that allow a game to enable persistent player inventories without having to run special servers to manage users or items.
Please leave us feedback or ask questions in the Steam Inventory Discussions
in the Steamworks Developer group.
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.https://www.youtube.com/watch?v=jDfhPTSOLis
- 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. Note that while your item visibility is set to Private, only accounts in your Steamworks Partner group will be able to access your items in-game.
- Set Asset Server Key
First generate a Publisher Web API key for your application (instructions: Crear una clave de Web API para editores) 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.
- Grant Test Items
Use ISteamInventory::GenerateItems to add specific items to the current players account for development purposes.
- Grant User a Playtime Drop (optional)
At appropriate times (typically the end of a match/phase) call ISteamInventory::TriggerItemDrop to see if the user has earned a new drop.
- Sell Items (optional)
To add microtransaction support, define prices in your itemdefs. You can then have people purchase them in a few difference ways:
Documentation for the Steam Inventory API's is available on the API Reference here: ISteamInventory
Documentation for the Steam Inventory Web API is available on the Web API Reference here: IInventoryService
These are structured web pages that you can redirect the user to.
- ItemCart - Can be used to send a cart full of items to be purchased through Steam.
- BuyItem - Can be used to purchase a single item through Steam.