Skip to content

Stack Inventory Documentation

High-performance item & inventory management for Godot 4

Stack Inventory is a professionally crafted inventory system designed for Godot 4 C# projects, featuring interface-based architecture, zero-overhead performance, and comprehensive testing.

Interface-Based Architecture

Work with IItem interface everywhere. Zero overhead between Resources and POCS classes.

// Just a cast - no conversion!
IItem item = itemDefinition;

POCS Design

Plain Old C# Serializable objects for items. Perfect for saves, networking, and procedural generation.

var item = new Item(id, name, value, tags);
// Serialize/deserialize with any library

Performance First

10-100x faster than string-based lookups. Direct property access with interface casts.

  • ✅ 191 comprehensive tests
  • ✅ Zero allocations in hot paths
  • ✅ Cache-friendly data structures

Tag System

Hierarchical tag system for powerful item categorization and filtering.

if (item.HasTag("Weapon.Melee")) {
// Apply melee weapon logic
}
// In Godot Editor: Create ItemDefinition Resource
// Or in code:
var potion = new Item(
id: Guid.NewGuid(),
name: "Health Potion",
value: 50f,
tags: new List<ItemTag> { new("Consumable") },
stackMaximum: 99
);
public void HandleItem(IItem item)
{
GD.Print($"Name: {item.Name}");
GD.Print($"Value: {item.Value}");
GD.Print($"Can stack: {item.StackMaximum}");
if (item.HasTag("Consumable"))
{
UseConsumable(item);
}
}
// Works with BOTH ItemDefinition Resources AND Item POCS!
HandleItem(itemDefinition); // Godot Resource
HandleItem(itemPOCS); // C# class

Item Definitions

Create items as Godot Resources with visual editing in the Inspector.

POCS Support

Or use plain C# classes for runtime creation and serialization.

Pickup System

Built-in Pickup2D and Pickup3D nodes for world items.

Stack Management

Automatic stacking with configurable maximums per item.

Tags & Filters

Hierarchical tags for flexible item categorization.

Fully Tested

191 tests ensure reliability and catch regressions.