Stacking Policies
1. CommodityDecayAware Use Case: Food, perishables, items that decay over time How It Works:- Groups items into “freshness buckets” based on durability/age
- Bucket width controls granularity
- Bucket 1: 100% - 81% fresh → Stack together
- Bucket 2: 80% - 61% fresh → Stack together
- Bucket 3: 60% - 41% fresh → Stack together
- Bucket 4: 40% - 21% fresh → Stack together
- Bucket 5: 20% - 0% fresh → Stack together
- Similar to CommodityDecayAware but for gear
- Groups by durability percentage
- 100% - 76%: Pristine gear stacks together
- 75% - 51%: Good condition stacks together
- 50% - 26%: Worn gear stacks together
- 25% - 1%: Damaged gear stacks together
- Includes crafter name in stack key
- Items from different crafters don’t stack
- “Iron Sword crafted by Thorin” (5 items)
- “Iron Sword crafted by Elena” (3 items)
- These occupy separate stacks even though they’re the same item
- Each item is completely unique
- Never stacks with anything
- Legendary weapons
- Quest items
- Items with random enchantments
Stack Keys
Stack keys determine if two items can merge. Items with identical stack keys will stack together (up to MaxStackSize). Stack Key Composition:- Item ID
- Item Data reference
-
Rarity (if
bIncludeRarityInStackKeyis true) -
Policy-specific data:
- CommodityDecayAware: Freshness bucket
- GearDurabilityBucket: Durability bucket
- ProvenanceMatters: Crafter name
- FullInstance: Unique instance ID
Choosing the Right Policy
| Item Type | Recommended Policy | Why |
|---|---|---|
| Food | CommodityDecayAware | Track freshness |
| Potions | CommodityDecayAware | Simple commodities |
| Ore/Resources | ProvenanceMatters or Commodity | Stack easily |
| Weapons | GearDurabilityBucket | Separate worn from new |
| Armor | GearDurabilityBucket | Track condition |
| Unique Gear | FullInstance | Never stack |
| Quest Items | FullInstance | One-of-a-kind |
| Ammo | CommodityDecayAware | Simple stacking |
Rarity and Stacking
By default, items of different rarities will stack together unless you enablebIncludeRarityInStackKey.
Example:
- When rarity significantly changes the item
- When you want players to easily identify item quality
- For loot-heavy games with many rarity tiers
- When rarity is cosmetic only
- When you want items to stack regardless of quality
- For simple games with limited rarity impact