Assumptions
- Items in world are entities
- Must handle all types of games
- You have slots where items go, certain items can stack
Options for slots
- Slots are entities, referenced from a dynamic buffer
- Slots are dynamic buffer with general meta data
Options for items in slots
- Items in slots are the same entities that would exist in the world)
- Items in slots are custom slot entities
- Items in slots are just data stored in the slot
the question i'm basically trying to figure out is, when an item is in a slot, what should be an entity?
at work we go the full entity approach, slots themselves are entities, items when stored in inventory are just the same entity
but it's been a huge pain but that might be more implementation than design
It gets tricky when you have stacking items, and large stacks of them
One of the flaws of our inventory at work are stacks of items become a single entity so you can no longer track individual item state
Durability is averaged or lost etc
Few more thoughts first though. The biggest question I have been going back and forward about are
Item slots - should they be entities?
Item slot as inventory
Pro
- Versatile you can attach data and do cool things
Cons
- Slower; lookups required to access
- Tiny archetype so 128 limit kind of sucks
- Generally have no logic so does it make sense to be an entity
- State harder to maintain
Then there is the whole, backpacks
How does that play into slots?