Browse/Crafting & Building/Casting / Molding
Crafting & Building

Casting / Molding

Mechanic governing casting / molding behavior, establishing rules for player interaction, feedback, and progression within this system.

Medium complexity
2 examples
2 patterns

Overview

This mechanic, commonly known as casting / molding, creates a structured experience around this game element. The mechanic interacts with multiple other game systems, creating emergent gameplay that extends beyond its individual components. The ongoing evolution of this mechanic reflects the broader maturation of game design as a discipline.

Game Examples

Deck Builders

Deck Builders use this mechanic where players time their actions precisely to achieve mastery over the system. The system encourages experimentation, resulting in exploration incentives.

Soulslike Games

Soulslike Games use this mechanic where players master complex timing to create unique character builds. Edge cases create memorable moments, resulting in satisfying progression.

Pros & Cons

Advantages

  • Supports diverse viable strategies and approaches
  • Adds depth without excessive complexity
  • Balances temporal against strategic effectively
  • Provides clear immediate feedback on player actions

Disadvantages

  • Creates potential for abuse by experienced players
  • Can feel overwhelming if progression is too slow
  • Risk of griefing in multiplayer contexts

Implementation Patterns

Quality Calculator

A modular approach to casting / molding that separates concerns and enables easy testing.

class CastingMoldingHandler {
  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.05);
    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";
  }
}

Durability Tracker

Optimized pattern for casting / molding that minimizes per-frame computation cost.

class CastingMoldingHandler {
  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.15);
    return { ...recipe.output, quality };
  }

  rollQuality(baseChance: number) {
    const roll = Math.random();
    if (roll < baseChance * 0.01) return "legendary";
    if (roll < baseChance * 0.1) return "rare";
    if (roll < baseChance) return "uncommon";
    return "common";
  }
}