Procedural Content Generation
Generate items, quests, names, loot, and narrative elements that feel hand-crafted while providing endless variety through algorithmic rules.
Procedural Item Generation
Games like Diablo and Borderlands generate millions of unique items by combining base types, modifiers, and rarity tiers.
import random class ItemGenerator: PREFIXES = { "common": ["Worn", "Simple", "Old"], "rare": ["Enchanted", "Gleaming", "Ancient"], "legendary": ["Mythical", "Celestial", "Eternal"] } BASES = ["Sword", "Shield", "Bow", "Staff", "Dagger"] SUFFIXES = ["of Flames", "of Frost", "of the Wind", "of Shadows", "of Might"] def generate(self, level, rarity="common"): prefix = random.choice(self.PREFIXES[rarity]) base = random.choice(self.BASES) suffix = random.choice(self.SUFFIXES) # Scale stats by level and rarity multiplier = {"common": 1, "rare": 1.5, "legendary": 2.5} damage = int(level * 5 * multiplier[rarity] * random.uniform(0.8, 1.2)) return { "name": f"{prefix} {base} {suffix}", "rarity": rarity, "damage": damage, "level": level } gen = ItemGenerator() item = gen.generate(level=15, rarity="rare") # "Enchanted Sword of Flames" - damage: 112
Loot Tables
| Rarity | Drop Chance | Stat Multiplier |
|---|---|---|
| Common | 60% | 1.0x |
| Uncommon | 25% | 1.25x |
| Rare | 10% | 1.5x |
| Epic | 4% | 2.0x |
| Legendary | 1% | 2.5x |
Procedural Quests
Quests can be generated from templates with variable parameters:
- Fetch quests: "Bring [item] to [NPC]" — vary the item, NPC, location, and reward.
- Kill quests: "Defeat [N] [enemies] in [location]" — scale difficulty by enemy type and count.
- Escort quests: "Escort [NPC] from [A] to [B]" — vary routes and threats.
- Narrative chains: Connect related quests into storylines using graph-based dependency systems.
Name Generation
Generate plausible names using Markov chains trained on real-world name data. The model learns character transition probabilities from training data and generates new names that sound similar but are unique.
- Character names: Train on fantasy name lists for elven, dwarven, or human-sounding names.
- Place names: Combine syllable patterns with suffixes (-heim, -ford, -vale, -reach).
- Item names: Template-based: [Adjective] [Material] [Weapon] of [Element].
AI-Powered Content
Modern games are beginning to use large language models for dynamic content generation: NPC dialogue, quest descriptions, lore text, and item flavor text. This is still emerging but shows enormous potential for creating unique, context-aware narrative content.
Lilly Tech Systems