Basic Crafting System
Mechanic governing basic crafting system behavior, establishing rules for player interaction, feedback, and progression within this system.
Overview
The basic crafting system mechanic provides a framework that provides meaningful choices and consequences for player actions. The implementation varies significantly across genres, with each game adapting the core concept to fit its specific design goals and target audience. Understanding the design principles behind this mechanic helps developers create more engaging and balanced game experiences.
Game Examples
Life Simulators
Life Simulators use this mechanic where players react to emergent situations to maximize their effectiveness. Emergent gameplay arises from simple rules, resulting in risk-reward tension.
City Builders
City Builders use this mechanic where players balance risk and reward to outperform other players. The feedback loop reinforces player engagement, resulting in high replayability.
Pros & Cons
Advantages
- Reduces monotony while maintaining challenge
- Rewards both mechanical skill and mechanical skill
- Creates satisfying audio loops
- Creates natural synergy between players
- Creates natural tension between players
Disadvantages
- Can create confusing when RNG is unfavorable
- Requires significant UI/UX work to implement well
- Can feel repetitive if progression is too slow
- May overwhelm casual players with too many options
Implementation Patterns
Durability Tracker
A modular approach to basic crafting system that separates concerns and enables easy testing.
class BasicCraftingSystemHandler {
recipes: Recipe[] = [];
craft(recipeId: string, inventory: Inventory) {
const recipe = this.recipes.find(r => r.id === recipeId);
if (!recipe) return null;
for (const ingredient of recipe.ingredients) {
if (!inventory.has(ingredient.id, ingredient.amount)) {
return null; // Missing materials
}
}
for (const ingredient of recipe.ingredients) {
inventory.remove(ingredient.id, ingredient.amount);
}
const quality = this.rollQuality(0.2);
return { ...recipe.output, quality };
}
rollQuality(baseChance: number) {
const roll = Math.random();
if (roll < baseChance * 0.05) return "legendary";
if (roll < baseChance * 0.2) return "rare";
if (roll < baseChance) return "uncommon";
return "common";
}
}Crafting Queue
Core implementation pattern for handling basic crafting system logic with clean state management.
class BasicCraftingSystemEngine {
recipes: Recipe[] = [];
craft(recipeId: string, inventory: Inventory) {
const recipe = this.recipes.find(r => r.id === recipeId);
if (!recipe) return null;
for (const ingredient of recipe.ingredients) {
if (!inventory.has(ingredient.id, ingredient.amount)) {
return null; // Missing materials
}
}
for (const ingredient of recipe.ingredients) {
inventory.remove(ingredient.id, ingredient.amount);
}
const quality = this.rollQuality(0.2);
return { ...recipe.output, quality };
}
rollQuality(baseChance: number) {
const roll = Math.random();
if (roll < baseChance * 0.01) return "legendary";
if (roll < baseChance * 0.2) return "rare";
if (roll < baseChance) return "uncommon";
return "common";
}
}