Crafting, Recipes & Item Graph
5.1 Structure
Directed acyclic graph (detect cycles at content build time):
Node = ItemTemplate
Edge = Recipe (output → inputs)
soul_bind_scroll ──► blank_scroll, spirit_ink, bound_salt
spirit_ink ──► ghost_mushroom, distilled_oil
distilled_oil ──► wild_herb, glass_vial
glass_vial ──► sand, furnace_fuel...
5.2 Runtime services
| Service | Role |
|---|---|
| Recipe resolver | Given target item, expand full BOM tree |
| Craft validator | Inventory + station + tools + skills |
| Craft executor | Atomic consume → mint output (central audit) |
| Discovery | Recipes learned by book, trainer, experiment |
5.3 Spells as craft outputs
Soul-bind scroll (and similar) are crafted consumables, not vendor buttons:
Recipe: soul_bind_scroll
inputs: blank_scroll, spirit_ink, silver_dust
station: inscription_table
skill: arcane_inscription ≥ 20
output: soul_bind_scroll × 1
Using the scroll on an eligible item triggers bind ritual (07 §4.3, §6).
6.1 Requirements
| Requirement | Detail |
|---|---|
| Target item | can_soul_bind: true on template |
| Consumable | Crafted soul-bind scroll (or higher tier spell item) |
| Caster | Character uses scroll on item (or station ritual) |
| Location | Optional shrine bonus; wilderness allowed at higher scroll cost |
| Cost | Scroll consumed + optional coin offering + mana/stamina |
6.2 Flow
1. Player crafts soul_bind_scroll (crafting graph)
2. Player targets eligible item in inventory
3. Server validates: not already bound, scroll present, fees paid
4. Set item_instance.soul_bound = true
5. Audit log + bind timestamp; scroll consumed
Higher-tier binds (multi-slot gear) may require greater soul-bind elixir — deeper recipe chain.
6.3 Economy tie-in
Soul-bind consumables are tradeable until used — crafters supply bind services (10).
7.1 Portable tools
Items in inventory/hands: hammer, cooking pot, knife, inscription stylus.
May have durability; craft recipes can wear them down.
Heavy workshop tools (e.g. kiln) may also be placeable furniture: place and relocate like a chest. Standing within container interact range of a placed tool satisfies required_tools — materials still come from inventory only. Placed stations are shared (anyone nearby can use them); privacy is door locks / access control on the building.
7.2 World stations
| Station | Used for |
|---|---|
| Forge | smelting, weapons, armor |
| Kitchen / fire | food, some alchemy |
| Loom | cloth, bags |
| Alchemy table | potions, inks, soul reagents, essence prep (17) |
| Inscription table | scrolls, spells, maps, dispel / transfer enchants (17) |
| Enchantment altar | Apply enchants to item instances (17) |
Stations can be Area fixtures (town forge), building tags (enter a kitchen), or player-placed placeable tools / fixtures (20 §9.2).
7.3 Tool crafting
Tools are normal graph nodes — e.g. cooking_pot requires iron_ingot, clay, smelting + pottery skills.
8. Crafting execution (server)
- Player submits
CraftIntent { recipe_id, qty, station_id } - Region worker validates local station/tools
- Central confirms inventory debit + mints unique instance(s) with quality/stat rolls (
18) - Skill XP granted; failure rolls per recipe
- Client receives inventory delta + craft result event
Batch queue for long crafts (food simmer, sword forge) — progress tick, interrupt rules.
Interrupt rules. Inputs and stamina for a craft are spent when that batch's channel begins. Esc in the craft menu (n) cancels the live channel and drops every queued batch: the interrupted craft yields nothing and its inputs are not returned, while queued batches never started and keep their materials. The craft channel also ends on death.
8.1 Factory automation (workers)
Players automate multi-step production via hired workers, craft residences, devices, and job cycles — see 13-workers-and-automation.html. Workers execute the same recipes and stations as players; devices are the world anchor for worker craft steps.
9. the terminal client / agent
flatland craft list --station forgeflatland craft plan longsword→ full BOM tree with missing nodesflatland craft start <recipe> --qty 1flatland soulbind use <scroll> <item>flatland enchant start <recipe> --item <instance>(17)
Agent JSON: recipe graph export for planning bots; enchant defs + margin planning.
10. Phasing
| Phase | Scope |
|---|---|
| 3 | Tier 0 harvest + tier 1 smelt/cure; single-step recipes |
| 4 | Multi-hop graph; tool requirements; food + forge |
| 5 | Soul-bind scroll chain; inscription station; enchanting schema + altar (17) |
| 6 | Player-placed stations in buildings (20); recipe discovery; craft residences + devices (13); on-hit enchant procs (17) |
| 7 | Schematic blueprints trade; phased construction (20) |
| 7 | Market stall kit craft (10); hire workers, job cycles (13) |
12. Content pipeline
assets/
items/*.yaml # templates, mass, volume, packable, can_soul_bind, enchantable
recipes/*.yaml # recipe definitions
enchantments/*.yaml # enchant defs (`17`)
enchant_recipes/*.yaml
stations/*.yaml # station kinds per Area manifest
tools/
validate-recipe-graph.mjs # cycle detect, orphan check
validate-enchant-graph.mjs
Economy, stalls, brokers: 10-economy-and-markets.html