Git Product home page Git Product logo

Comments (9)

scriptsengineer avatar scriptsengineer commented on May 27, 2024 1

Well it also needs some adjustments in the networking. I think this would be essential enough that it should be part of the core. Just a dictionary that can be used for any kind of dynamic data and also gets synchronized over the network. Maybe the dictionary could actually just contain all passed data: ID and amount plus custom dynamic variables and gets passed just like that.

Honestly in the case of the network, if there is an item only when there is quality I would optimize to send two ints because of the bandwidth, but this should certainly be an option for whoever is implementing it.
Yes, we can have that in the core, I think it's very valid.

from inventory-system.

levidavidmurray avatar levidavidmurray commented on May 27, 2024 1

I may be off base here, but my gut's telling me that there needs to be a better separation of runtime and config data. In my mind, "dynamic item values" are runtime data, an "inventory slot" is runtime data, InventoryItem is config data, Recipe is config data.

Regarding idea 2
Currently when an inventory is initialized, it creates 32 blank slots (item is null)—meaning an item is inherently transient to a Slot. So, I don't think it makes sense to store item specific information (e.g. durability) within the slot. Those properties are logically tied to the item, not to the slot.

Regarding idea 1
I personally think you're on the right track with SlotItem (I'm not sure the naming is suitable for what it represents). Some kind of intermediary object is required to map to an item template to the game world, and I don't think it should be the slot. If an item is dropped, those custom properties should be dropped with it, which shows that the properties shouldn't exist on the slot.

Below is a rough proposal for how I might go about restructuring the current classes. It's worth noting that this would require stacked items of the same ItemResource to have matching properties (although workarounds could obviously implemented).

image

from inventory-system.

scriptsengineer avatar scriptsengineer commented on May 27, 2024

I am mainly thinking of making something like item durability possible. Maybe a dictionary that is always passed along with the item.

Simple, create a code that extends the slot (SlotWithDurability or SlotWithDynamicInformation) that contains durability information. If you're going to have multiple items in a slot with durability (which I don't recommend as a game design) creating a list can solve it, and that could be part of the core at some point.

Update 26/11 - What's missing

Added SlotItem and integrated

  • Core
  • Editor
  • Network

Custom properties are now missing

  • Core
  • UI
  • Editor
  • Network
  • Demo

from inventory-system.

Lodugh avatar Lodugh commented on May 27, 2024

Well it also needs some adjustments in the networking. I think this would be essential enough that it should be part of the core. Just a dictionary that can be used for any kind of dynamic data and also gets synchronized over the network.
Maybe the dictionary could actually just contain all passed data: ID and amount plus custom dynamic variables and gets passed just like that.

from inventory-system.

scriptsengineer avatar scriptsengineer commented on May 27, 2024

Idea 1 To solve the problem:
In slot instead of having InventoryItem and amount now has a SlotItem and amount
The SlotItem contains an InventoryItem and dynamic properties placed by a dictionary.

Cons:

  • More resource hierarchy here for create inventory
  • Complex editor to understand and manage
  • Less performace

Pros

  • It is possible to have items in the same slot with different property values
  • Easy-to-understand scheme, faithfully represents the objects

Before:

@tool
extends Resource
class_name Slot

@export var item : InventoryItem
@export var amount := 0
@export var max_stack := -1

After

@tool
extends Resource
class_name Slot

@export var item : SlotItem
@export var amount := 0
@export var max_stack := -1

in SlotItem:

@tool
extends Resource
class_name SlotItem

@export var item : InventoryItem
@export var properties : Dictionary

from inventory-system.

scriptsengineer avatar scriptsengineer commented on May 27, 2024

Idea 2 to solve problem
Simply add an additional dictionary to the slot

@tool
extends Resource
class_name Slot

@export var item : InventoryItem
@export var amount := 0
@export var max_stack := -1
@export var properties : Dictionary

from inventory-system.

Lodugh avatar Lodugh commented on May 27, 2024

Well I think understand-ability should always be a very high priority with these kind of plugins so I would go for the first one I think. However I dont really have the whole picture of it before me and how it integrates with the rest so I would mainly rely on your evaluation.

from inventory-system.

scriptsengineer avatar scriptsengineer commented on May 27, 2024

I may be off base here, but my gut's telling me that there needs to be a better separation of runtime and config data. In my mind, "dynamic item values" are runtime data, an "inventory slot" is runtime data, InventoryItem is config data, Recipe is config data.

Regarding idea 2 Currently when an inventory is initialized, it creates 32 blank slots (item is null)—meaning an item is inherently transient to a Slot. So, I don't think it makes sense to store item specific information (e.g. durability) within the slot. Those properties are logically tied to the item, not to the slot.

Regarding idea 1 I personally think you're on the right track with SlotItem (I'm not sure the naming is suitable for what it represents). Some kind of intermediary object is required to map to an item template to the game world, and I don't think it should be the slot. If an item is dropped, those custom properties should be dropped with it, which shows that the properties shouldn't exist on the slot.

Below is a rough proposal for how I might go about restructuring the current classes. It's worth noting that this would require stacked items of the same ItemResource to have matching properties (although workarounds could obviously implemented).

image

I'm following idea 2, but I'm still undecided due to the cons it shows

  • Difficulty for the inspector to create inventory
    Currently I create a slot and place the item inside it, with SlotItem (Which I intend to change the name to Item) ends up creating another configuration step for everything.

  • Performance
    Creating an item slot for each slot seems to create an absurd extra load for all inventories, without saying that unlike the slot resource or Inventory item, this item slot will have the behavior of being created and destroyed many times.

There is still an area of doubt that changes my mind
How should slotItem behave when a slot is empty? Should there be a slotitem with no defined item that will be immobile?

If it must be something moved, when we share the item, should it be duplicated?

from inventory-system.

scriptsengineer avatar scriptsengineer commented on May 27, 2024

I decided to go with solution 2, don't rename anything yet, as I intend to do this in another interaction, (when changing from core to cpp #83)

What's missing: (Put it in the initial message too)

Added SlotItem and integrated

  • Core
  • Editor
  • Network

Custom properties are now missing

  • Core
  • UI
  • Editor
  • Network
  • Demo

from inventory-system.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.