How to design an inventory system: data structures and player-friendly UX
Inventories look simple but quickly grow complex: stacking, equipment, crafting, saving, sorting. Planning the data and the interface together saves a lot of rework.
Data structure basics
- Item definitions: shared, static data like name, icon, max stack and type. Store these once, often as data assets or JSON.
- Item instances: a reference to a definition plus per-item data like quantity, durability or enchantments.
- Inventory container: a list or grid of slots that hold instances.
Separating definitions from instances keeps saves small and makes balancing easy.
Common inventory styles
- List-based: simple and accessible, common in RPGs.
- Grid with sizes: items take up space, like a tactical survival game.
- Weight-based: a carrying limit rather than slots.
- Hotbar: fast access for crafting and survival games.
UX considerations
- Sorting and filtering options
- Clear tooltips comparing stats with equipped items
- Controller-friendly navigation, not just drag and drop
- Quick-stack or "deposit all" for storage
- Avoid making inventory management the main challenge unless it's the point
Saving Save item IDs and instance data, not references to scene objects.
What inventory style do you prefer as a player? Have you ever had to rebuild an inventory system halfway through development?
Comments · 3
Separate item definitions from item instances. Store an ID plus quantity and look up properties in a shared table, so changing one sword's stats doesn't mean editing every copy.
Please, please add a sort button and a quick-stack. Nothing ruins an otherwise great game like a hundred unsorted items.
If you're new to this, start with a simple list of item IDs before building grids. You can always upgrade the structure later.