Skip to content

🧩 Crafting — Core / Recipe

📦 Folder Overview

This folder defines the pure recipe domain for the Crafting system.

Types in this folder describe what a craft is — inputs, outputs, optional currency, and metadata — without defining how crafting is executed or which systems are present at runtime.

Recipes are implementation-agnostic, immutable at runtime by convention, and safe to inspect from any layer.


🧩 What Lives Here

RecipeCore

  • RecipeCore ScriptableObject representing a single craft recipe

Contains:

  • item inputs
  • item outputs
  • optional currency cost
  • optional station tag
  • optional metadata (e.g. XP)
  • optional duration

RecipeCore has no dependency on inventory, currency, UI, or services.

At runtime, recipes should be treated as immutable.


Supporting Value Types

  • ItemRef Item identifier and quantity pair

  • ChanceItemRef Probabilistic output definition

  • CurrencyCost Optional currency cost per craft

These are serializable data types with no behaviour.


RecipeResolve

The supported entry point for resolving a recipe.

  • accepts a ScriptableObject
  • attempts to resolve a RecipeCore
  • resolution may fail and should be handled

This isolates callers from optional systems, conversion logic, and caching.


🎯 Purpose

This folder provides a stable data contract for:

  • defining craftable content
  • sharing recipe data across systems
  • decoupling content from runtime behaviour

🧠 Usage Guidance

Content Authors

  • create recipes as RecipeCore assets
  • treat data as immutable at runtime
  • use metadata fields rather than embedding logic

Gameplay Code and UI

  • resolve recipes using RecipeResolve
  • handle resolution failure gracefully
  • do not assume all recipes are available in every build

⚠️ Important Notes

  • recipes do not contain execution logic
  • behaviour is defined by services, validators, and modifiers
  • resolution may depend on optional systems

🚫 Not for Production Use

This folder does not include:

  • inventory or currency logic
  • crafting execution rules
  • progression or unlock systems

  • Crafting Core (runtime behaviour)
  • Crafting Contracts (data structures and results)

🧱 Public API

Supported types:

  • RecipeCore
  • ItemRef
  • ChanceItemRef
  • CurrencyCost
  • RecipeResolve

Internal types (not supported):

  • internal caching helpers

🧠 Design Notes

  • recipes are data, not behaviour
  • behaviour belongs in services and extension seams
  • resolution is explicit and failure-aware

If conditional behaviour is required, use validators or modifiers rather than embedding logic in recipes.