Non-affilié

Accueil Documentation et aide
Documentation Steamworks
Service d'inventaire Steam
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.

Description

Le service d'inventaire peut être utilisé de deux manières : soit sans serveur, soit avec l'ajout d'un serveur de confiance qui connaît l'état du jeu.

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. Au lieu de cela, vous sélectionnez certains items qui peuvent être distribués et vous configurez une fréquence de distribution. At appropriate times, the game client invokes ISteamInventory::TriggerItemDrop. Les serveurs Steam gèrent le temps de jeu et la fréquence de distribution par joueur. Ces API sont appelées à l'aide d'une « clé d'API cliente » interne supposée non fiable.

Si vous avez un serveur approuvé participant, vous pouvez utiliser une clé d'API Steam privilégiée sur le serveur et accorder des items explicites dans les situations appropriées. 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

Présentation de l'implémentation

  1. 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/
  2. 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.
  3. 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.
  4. 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.
  5. Grant Test Items
    Use ISteamInventory::GenerateItems to add specific items to the current players account for development purposes.
  6. 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.
  7. Sell Items (optional)
    To add microtransaction support, define prices in your itemdefs. You can then have people purchase them in a few difference ways:

APIs

Documentation for the Steam Inventory API's is available on the API Reference here: ISteamInventory

Web APIs

Documentation for the Steam Inventory Web API is available on the Web API Reference here: IInventoryService

Web Functions

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.