Spaces
Spaces in Forge serve as structured storage areas where item instances are stored and managed within your game. Each space defines a specific area designated for organizing items based on their usage or category. This document outlines how spaces function as storage compartments and their role in facilitating item management.
Defining Spaces
Spaces are defined during the setup of a user’s account, providing dedicated areas for storing item instances. Game designers can customize spaces to suit various game needs, such as character inventories, stash compartments, or mailboxes for item deliveries.
Example of Defining Spaces
When a user account is created, spaces can be configured with specific dimensions, typically represented by rows and columns. Here’s an example of defining spaces:
POST /spaces
{
"userId": "user123",
"spaces": [
{ "name": "Character Inventory", "rows": 2, "columns": 5 },
{ "name": "Stash", "rows": 3, "columns": 5 },
{ "name": "Mailbox", "rows": 1, "columns": 5 }
]
}
Using Spaces
Once spaces are defined, item instances can be stored within them. Users can interact with their spaces through various operations, such as adding new items, moving items between spaces, or retrieving items from specific locations within a space.
Example of Storing an Item Instance
POST /item-instances
{
"itemId": "sword_of_power",
"userId": "user123",
"spaceId": "spaceCharacterInventory456",
"position": { "row": 0, "column": 1 }
}
Summary
Spaces in Forge provide structured compartments for organizing and managing item instances within your game. By defining spaces with specific dimensions, game designers can tailor storage areas to fit different game mechanics and user interactions. For more details on how to interact with spaces and manage item instances, refer to the API documentation for each relevant API call.