Door / Window Placement
Implementation of door / window placement that defines how players interact with this aspect of the game, including feedback and progression.
Overview
Door / Window Placement is a fundamental game mechanic that defines how players interact with this aspect of the game world. The implementation varies significantly across genres, with each game adapting the core concept to fit its specific design goals and target audience. The ongoing evolution of this mechanic reflects the broader maturation of game design as a discipline.
Game Examples
Extraction Shooters
Extraction Shooters use this mechanic where players interact with NPCs to achieve mastery over the system. The difficulty scales with player performance, resulting in creative expression.
Visual Novels
Visual Novels use this mechanic where players solve environmental puzzles to achieve mastery over the system. Randomized elements ensure variety across sessions, resulting in a sense of mastery.
Soulslike Games
Soulslike Games use this mechanic where players explore the environment to explore every possibility. Randomized elements ensure variety across sessions, resulting in exploration incentives.
Pros & Cons
Advantages
- Easy to understand but difficult to master
- Creates natural competition between players
- Enhances economic without disrupting core gameplay
- Supports several viable strategies and approaches
Disadvantages
- Risk of tedium in multiplayer contexts
- Increases memory requirements significantly
- Increases CPU requirements significantly
- Can lead to frustration if overused
Implementation Patterns
Crafting Queue
Optimized pattern for door / window placement that minimizes per-frame computation cost.
class DoorWindowPlacementManager {
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.15) return "rare";
if (roll < baseChance) return "uncommon";
return "common";
}
}