Spielerando

Crafting System

A crafting system turns items into other items with recipes. Check the whole recipe first: add up each ingredient across all its lines, make sure the result fits, then take and give in one go. A craft either happens exactly as written or changes nothing, so nothing appears from nowhere or gets lost.

Also called: Item crafting, Recipe system, Item combination.

A cheerful green octopus on the sea floor holds a shell, a yellow crystal, a coil of rope and a gear, and glowing threads join them into a brass lantern on a red coral workbench.
Brinewright Deep, an invented undersea workshop game. Invented game, image generated with AI.

Paste this to your AI

Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.

Add "Crafting System" to my game.

What it should do: Crafting gives the things players gather a use, and lets them decide what to make from what they have.

Use these starting values:
- maxStock: 99 items

Watch out for these common mistakes:
- A recipe lists an item twice: Tell your AI: add up the lines for each item before comparing with what the player has.
- A full stock eats the result: Tell your AI: check that the result fits before anything changes, and count the room the ingredients free up.
- Taking ingredients one at a time: Tell your AI: check everything first, then do all of it at once.
- A recipe that gives back what it takes: Tell your AI: work out the room from what the player will have after the ingredients are gone.

Do not change anything else in the game. Do not claim anything without proof: model what it takes, and show me what your solution rests on and how I can see that it works. If you cannot show something, say you do not know. When you are done, tell me in plain words how to try it.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP

What it does

Crafting gives the things players gather a use, and lets them decide what to make from what they have.

Good starting values

ValueStart withWhat it changes
maxStock99 itemsThe most of one item the player can hold. A craft whose result would go over it is refused.

What usually goes wrong

A recipe lists an item twice

Two lines each need 2 of an item, and you have 3. Each line passes on its own, the craft runs, and the second one stops at zero or goes below it, so items are lost or appear from nowhere.

Fix: Tell your AI: add up the lines for each item before comparing with what the player has.

A full stock eats the result

If the ingredients are taken first and the result is then cut off at the limit, the extra result is lost.

Fix: Tell your AI: check that the result fits before anything changes, and count the room the ingredients free up.

Taking ingredients one at a time

The game takes each ingredient in turn and gives up when one is missing, so the player loses part of the ingredients and gets nothing.

Fix: Tell your AI: check everything first, then do all of it at once.

A recipe that gives back what it takes

A recipe that returns part of an ingredient looks wrong when the game checks what goes in and what comes out separately.

Fix: Tell your AI: work out the room from what the player will have after the ingredients are gone.

How to check it works

Works well with

Common questions

how do you make a crafting system

Keep recipes as simple lists of what is taken and what is given. Check the whole recipe against what the player holds, then take and give in one go, so a craft never stops halfway.

how do i check if the player can craft a recipe

Add up each item across all the ingredient lines before comparing it with what the player holds. Checking each line alone lets through a recipe that lists an item twice.

what should happen if the crafted item does not fit

Refuse the craft before anything is taken, and tell the player why. Taking the ingredients first and throwing away the result loses items.

what do i tell my ai to add crafting

Paste this: Add crafting with recipes stored as data, as lists of ingredients and results, so they can be checked, tested and changed and one craft step works for every recipe. Check the whole recipe first, then take and give in one go.

Where it comes from

Earliest example we could find: Dungeons & Dragons, Volume 1: Men & Magic (Gygax and Arneson, Tactical Studies Rules) (1974). Tabletop rules let high-level magic-users make items such as potions and scrolls, for their own use or for sale, with money and game time as the inputs. It has no gathered materials or recipes, so it is item making by spending resources, not crafting in the later video game sense. The rulebook was read in an unofficial copy, which is not linked here.

  1. 1974 Dungeons & Dragons, Volume 1: Men & Magic (Gygax and Arneson, Tactical Studies Rules): Tabletop rules let high-level magic-users make items such as potions and scrolls, for their own use or for sale, with money and game time as the inputs. It has no gathered materials or recipes, so it is item making by spending resources, not crafting in the later video game sense. The rulebook was read in an unofficial copy, which is not linked here. [Dungeons & Dragons (1974), Wikipedia, bibliographic reference]
  2. 1989 Knights of Legend (Origin Systems): Single-player CRPG in which ingots found in play can be turned into forged items, by an NPC according to a reader comment on the blog. The CRPG Addict lists it as the game that opened crafting of weapons or armor, and also judges the feature unimpressive because the player decides almost nothing about the result. [First! (The CRPG Addict, 2012)][Knights of Legend: Final Rating (The CRPG Addict, 2013)][Knights of Legend, Wikipedia]
  3. 1992 Legends of Future Past (CompuServe online game): Text-based online game with resource harvesting (ores, herbs, skins) and item crafting. This is the earliest crafting system in an online game documented here, apart from undated DikuMUD recipes. Wikipedia and a retro magazine are the only sources found. [Legends of Future Past, Wikipedia][The Online Beginning of Gaming (Old School Gamer Magazine, 2023)]
  4. 1997 Ultima Online (Origin Systems): Crafting as a player trade inside a designed economy. Characters become manufacturers through skills such as smithing and tailoring, and turn gathered raw materials into goods other players buy. Raph Koster says the resource idea began in early 1995 as a way to improve MUD crafting: objects carry material labels, so crafting code can ask what something is made of instead of listing item IDs in each recipe. [UO's resource system (Raph Koster, 2006)][The In-game Economics of Ultima Online (Zachary Booth Simpson, 1999)][Ultima Online, Wikipedia]
  5. 1997 Atelier Marie: The Alchemist of Salburg (Gust, PlayStation): Opening game of a series in which making things is the central theme, not a side system: players collect objects and combine them through alchemy recipes. Wikipedia describes the series in general and not this game's specific rules, so the detail for this one game is thin. [Atelier (video game series), Wikipedia]
  6. 2009 Minecraft (Mojang): In the public alpha period players gather natural resources and craft blocks and items, and crafting is the route to almost everything else in the game. Game Developer says it brought crafting to a large new audience. The date is that of the public alpha; the formal release came in 2011. [Minecraft, Wikipedia][7 crafting systems game designers should study (Bryant Francis, Game Developer, 2015)][10 years on, 'Minecraft''s crafting system remains unmatched (Rick Lane, NME, 2022)]

Strength of the sources: Ultima Online is the best documented point, with a designer's own account and a 1999 paper by an Origin researcher. The 1974 rulebook is primary. Knights of Legend rests on one respected blog, Legends of Future Past on Wikipedia and a magazine, Atelier Marie on Wikipedia. Disputed: Raph Koster is quoted in his college's alumni magazine saying 'we invented the crafting system that is in all the video games now'. That is his claim; his own 2006 post says recipe crafting had already worked in earlier Diku-derived MUDs, and Knights of Legend and Legends of Future Past both predate Ultima Online. Source claims of being first: The CRPG Addict names Knights of Legend as 'First to allow crafting of weapons or armor', and Wikipedia says Legends of Future Past introduced 'one of the first (if not the first)' crafting systems in an online game. Old School Gamer says 'one of the earliest video games to include crafting'. None of these settles priority. Could not document: dates for DikuMUD crafting. Koster gives no year, so it is left out of the timeline. Could not document: a specific Ultima Online design link back to Ultima VII or other earlier Ultima games, or claims that King's Quest or Ultima III had crafting (search snippet of a Medium post that returned 403). Later points left out to keep the timeline short: Koster's account of Star Wars Galaxies, where resources disappeared and players ran all shops, and Dragon Quest VIII's Alchemy Pot, which the Dragon Quest fan wiki says began in that game. The 2017 DHQ paper 'Crafting in Games' analyzes crafting systems but gives no history, at least in the part read. The rulebook was read in an unofficial copy with some lines missing, so the rule's sentence is cut off there; that copy is not linked here. Costs and durations are left out on purpose.

Games are named only as references. Names and marks belong to their owners, and nothing here is endorsed by them.

What was checked

This is what separates the blueprint from a catalogue entry: the values on this page come from code that runs.

Your AI gets the code

Tested example code comes through the Spielerando connection, so your AI can use it right away. How to connect it