Browse/Crafting & Building/Ventilation System
Crafting & Building

Ventilation System

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

High complexity
2 examples
3 patterns

Overview

The ventilation system mechanic provides a framework that defines how players interact with this aspect of the game world. Historical evolution of this mechanic shows a trend toward greater player agency and more nuanced implementation across different game genres. Modern implementations often combine this mechanic with procedural elements to increase variety and replayability.

Game Examples

Bullet Hell Games

Bullet Hell Games use this mechanic where players solve environmental puzzles to discover hidden content. The feedback loop reinforces player engagement, resulting in memorable moments.

Third-Person Shooters

Third-Person Shooters use this mechanic where players master complex timing to achieve mastery over the system. The mechanic integrates seamlessly with other systems, resulting in emergent storytelling.

Pros & Cons

Advantages

  • Reduces monotony while maintaining challenge
  • Scales well from beginner to advanced play
  • Adds tension without excessive complexity
  • Creates natural competition between players
  • Supports numerous viable strategies and approaches

Disadvantages

  • May conflict with movement systems in the game
  • May create an entry barrier for new players
  • Increases network requirements significantly

Implementation Patterns

Crafting Queue

Optimized pattern for ventilation system that minimizes per-frame computation cost.

class VentilationSystemProcessor {
  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.15) return "rare";
    if (roll < baseChance) return "uncommon";
    return "common";
  }
}

Quality Calculator

A modular approach to ventilation system that separates concerns and enables easy testing.

class VentilationSystemEngine {
  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";
  }
}

Material Dispatcher

Core implementation pattern for handling ventilation system logic with clean state management.

class VentilationSystemManager {
  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.1);
    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";
  }
}