While I'm waiting on my wife's hand surgery, I thought I'd post some insight on how the item system is currently framed:
Base Item <-- Item Instance <--> World/Inventory Item
Base Item: These are data for your standard MS:C item. Each one only contains data and has a small memory footprint. Features:
- Name (e.g., "Volcano Sword")
- Type (Defined by Tags, like "2H", "Sword", "Fire", etc.)
- Mass
- Value, in gold
- Max Stack Size (default: 1)
- Abilities (Slash, Charge1=PowerSlash, Charge2=FireSlash)
- Description/Flavor Text
- Pointer to (unloaded) 2D Icon, client-only
- Pointer to (unloaded) 3D Mesh
- These pointers dynamically load assets only when needed, and are unloaded when done. Example: Another player logs in with a Crossbow equipped, so your client loads the Mesh for their character. When they log out and no other players have a Crossbow, it is unloaded and Garbage Collected/deleted after some time. This allows for large item variety, if desired.
Item Instance: Data about each spawned Base Item (in Inventory and/or World), owned by the server. Each one has a small memory footprint, but there could be thousands on a server (each NPC or Player could have dozens/hundreds of items). Features:
- Exists in a Character/NPC/Container inventory or directly on a spawned World item
- Pointer to the Base Item
- Pointer to a spawned World Item, if one exists.
- Unique ID (prevents duplication, in theory)
- Owner ID (Player or NPC)
- Stats/Abilities/EXP unique to this item (Currently not implemented, but planned... See below).
- NOTE: Players do not control/modify this data; the server does. If you want to Drop an item, you send a Request to the server, and if valid, the server will Drop your item. The only exceptions would be in single-player, or your own (listen)server.
- NOTE 2: My idea for Items is: They can be leveled and evolve unique stats/abilities tied to your Character, but if you drop/trade it, only the Base Item will exist for another Player. You can also use one 1H item in each hand, or quick-use potions and 1H spells if holding a 2H item.
World Item: The 3D mesh visible in the World, whether equipped or by itself. Features:
- Pointer to its unique Item Instance data.
- Mesh is Async-loaded from the Base Item
Inventory Item: The 2D icon/UI widget representing the item in a storage container (includes Equipped, Trade, Loot, etc). Features:
- Pointer to its unique Item Instance data
- Icon is Async-loaded from the Base Item.
- Only exists on the client as a Player UI/HUD widget. The logic behind moving items between containers is handled by the server, but the widgets themselves are owned by the client.
Summary:
- All Base Item data exists on all clients/servers
- All Item Instance data is owned by the server. Each client only knows about their own items and spawned/equipped World Items.
- World Items are the 3D items owned by the server and visible to all clients
- Inventory Items are the 2D UI widgets owned by the client to display item information and allow the client to request actions from the server.
Ideas/Suggestions for changes are welcome. It should be noted that the Item Instance class isn't even needed, but since the Items poll was split on RNG items/mods, I at least supported the potential feature.
Base Item <-- Item Instance <--> World/Inventory Item
Base Item: These are data for your standard MS:C item. Each one only contains data and has a small memory footprint. Features:
- Name (e.g., "Volcano Sword")
- Type (Defined by Tags, like "2H", "Sword", "Fire", etc.)
- Mass
- Value, in gold
- Max Stack Size (default: 1)
- Abilities (Slash, Charge1=PowerSlash, Charge2=FireSlash)
- Description/Flavor Text
- Pointer to (unloaded) 2D Icon, client-only
- Pointer to (unloaded) 3D Mesh
- These pointers dynamically load assets only when needed, and are unloaded when done. Example: Another player logs in with a Crossbow equipped, so your client loads the Mesh for their character. When they log out and no other players have a Crossbow, it is unloaded and Garbage Collected/deleted after some time. This allows for large item variety, if desired.
Item Instance: Data about each spawned Base Item (in Inventory and/or World), owned by the server. Each one has a small memory footprint, but there could be thousands on a server (each NPC or Player could have dozens/hundreds of items). Features:
- Exists in a Character/NPC/Container inventory or directly on a spawned World item
- Pointer to the Base Item
- Pointer to a spawned World Item, if one exists.
- Unique ID (prevents duplication, in theory)
- Owner ID (Player or NPC)
- Stats/Abilities/EXP unique to this item (Currently not implemented, but planned... See below).
- NOTE: Players do not control/modify this data; the server does. If you want to Drop an item, you send a Request to the server, and if valid, the server will Drop your item. The only exceptions would be in single-player, or your own (listen)server.
- NOTE 2: My idea for Items is: They can be leveled and evolve unique stats/abilities tied to your Character, but if you drop/trade it, only the Base Item will exist for another Player. You can also use one 1H item in each hand, or quick-use potions and 1H spells if holding a 2H item.
World Item: The 3D mesh visible in the World, whether equipped or by itself. Features:
- Pointer to its unique Item Instance data.
- Mesh is Async-loaded from the Base Item
Inventory Item: The 2D icon/UI widget representing the item in a storage container (includes Equipped, Trade, Loot, etc). Features:
- Pointer to its unique Item Instance data
- Icon is Async-loaded from the Base Item.
- Only exists on the client as a Player UI/HUD widget. The logic behind moving items between containers is handled by the server, but the widgets themselves are owned by the client.
Summary:
- All Base Item data exists on all clients/servers
- All Item Instance data is owned by the server. Each client only knows about their own items and spawned/equipped World Items.
- World Items are the 3D items owned by the server and visible to all clients
- Inventory Items are the 2D UI widgets owned by the client to display item information and allow the client to request actions from the server.
Ideas/Suggestions for changes are welcome. It should be noted that the Item Instance class isn't even needed, but since the Items poll was split on RNG items/mods, I at least supported the potential feature.
Last edited: