Crafting Game: Context
The purpose of this section is to go over the steps to create a “Crafting Game” using some of Economy V2’s functions such as inventories, stores, bundles, and more!This example was done using Visual Studio 2022 as a C# console application connecting directly to the PlayFab API, more specifically, the Economy V2 module.
Game Context
Before starting, we must first establish a set of ground rules and requirements of our game. You’re building a simple text-based crafting game where you must combine various items to make ice cream! You’ll be using the PlayFab Economy V2 system to store information about the various crafting recipes and the contents of the current player’s inventory.Base Items
The game has the following set of items:- Stone
- Cut Stone
- Gold
- Electrical Doodad
- Icebox
- Cream
- Ice Cream
Starting Inventory
Each player should begin the game with the following items and amounts in their inventory.- Three Stone
- One Gold
- One Cream
Locations/Stores
All recipes should be grouped into three separate locations representing a unique store/marketplace that the player should access to perform crafting for those items. Crafting a recipe/item should consume/deduct the number of items required as per the recipe/item price and granting the player whatever item is being crafted. The following list details all the locations and the recipes available in them.Location 1: Science Machine
- Two Stones make one Cut Stone
- One Cut Stone + One Gold make one Electrical Doodad
Location 2: Alchemy Engine
- One Electrical Doodad + One Stone make one Icebox
Location 3: Kitchen
- One Cream + One Icebox make one Ice Cream
In the Kitchen, when crafting an Ice Cream, it takes 1 Icebox, nonetheless, the Icebox should not be consumable. In other words, after the transaction, there must be the same number of Icebox in the inventory as there was before.
