question

Joshua Scott avatar image
Joshua Scott asked

Get Player and Character Inventory

So I am working on an Inventory system similar to the ones in games like Destiny, Division, and Anthem. A players Character has Weapon and Armor slots, along with Cosmetic Items, plus say 9 slots of storage for each Item.

The Character Data will hold the Item Instance Id's in fields and arrays (sorting and assigning will be handled by the game-server or cloud scripts) along with the data for character abilities and other character specific items; while the Player Data holds shared inventory (consumables and any stored Items not on a character).

My flow is such that the Player Controller pulls the Character and Player Data/Inventory and passes it to the Server or Authority. The Server (or Authority) then goes through everything, Matching the Instance Id's from the Fields or Arrays and constructing the Weapons/Armor/Items and everything else, (reading the custom data to apply the items perks/stats) building the Inventory for the Character before passing it on to the Character for Storage, along with giving the character their abilities.

Any time a player wants to change their equipped items or use a consumable, the controller pulls the selected Items from the Character and passes it to the Server, the Server then verifies the Items are correct (the player actually has them/does the usage break any rules) before updating the Character or Player Data and applying the changes in-game.

It is a very rough rundown of what I am working on implementing but I wanted to be sure that there was no easier way do do this, or if I was completly wrong on how these systems work.

Player DataPlayer InventoryCharacter DataCharacters
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Citrus Yan avatar image
Citrus Yan answered

Your flow looks fine with me, however, for the Character part, we have a Character system you might want to use, where each Character has its own inventory, VC, data, etc. This should help you better organize your game logic. For more details about the Character system, please check out this blog: Get in Character with PlayFab.

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Joshua Scott avatar image Joshua Scott commented ·

So my next question would be, could I use Objects in the Character and Player to store these Items instead of Title Data, as that looks like it would get unwieldy quickly.

From what I can see even with the 5 objects of 1000 bytes each would still be enough to split the characters data up (Weapons, Armor, Style, Character Info, Quests). In the Player Objects it could save anything shared and purchased Items, though I might just be able to generate new Item instances from purchase history for some items.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Joshua Scott commented ·

Using Objects is the perfect choice for your case as it's more efficient to maintain and operate, and performs better.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]