diff --git a/CLAUDE.md b/CLAUDE.md index 916f5de..b4d4689 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -16,9 +16,29 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co **ALWAYS CHECK**: `TODO.md` at project root for current implementation roadmap and tasks. -**Current Phase**: **PRODUCTION-READY** Hot-Reload System - **0.4ms average reload time achieved!** +**Current Phase**: World Generation System - Geological and resource foundation complete -## 🎯 **Recent Major Achievements - UI Interface System** +## 🎯 **Recent Major Achievements - World Generation System** + +### ✅ **Complete Geological Simulation (COMPLETED)** +- **7-Phase Pipeline**: 4.6 billion year geological evolution simulation +- **Physics-Based Tectonics**: Collision detection, plate movement, mountain formation +- **Scientific Climate Model**: WindRegions, ITCZ, and realistic weather patterns +- **Biome Classification**: 18 distinct biomes with elevation and generation parameters + +### 🗺️ **Resource Distribution System (COMPLETED)** +- **70+ Natural Features**: Geologically accurate formation patterns +- **Smart Biome Integration**: Blacklist + frequent biomes for scalable compatibility +- **Mass-Based Quality**: Region strength determines available resource grades +- **Cross-Referenced Resources**: All features map to actual game resource definitions + +### ⚙️ **Spatial Distribution Patterns (COMPLETED)** +- **5 Pattern Types**: Concentrated, uniform, ring, clustered, gradient distributions +- **Random Assignment**: Each region gets unpredictable density patterns +- **Biome-Aware Placement**: Local environment determines compatible features +- **Phase 8 Ready**: System prepared for integration with world generation pipeline + +## 🎯 **Previous Major Achievements - UI Interface System** ### ✅ **Complete IUI Interface Architecture (COMPLETED)** - **Data-Agnostic Design**: Generic `IUI` interface supporting all content types diff --git a/docs/00-overview/vue-ensemble.md b/docs/00-overview/vue-ensemble.md index 7be4d7f..0430913 100644 --- a/docs/00-overview/vue-ensemble.md +++ b/docs/00-overview/vue-ensemble.md @@ -1,55 +1,268 @@ -# Vue d'ensemble du projet +# Warfactory : Vue d'Ensemble du Projet -## Vision et objectifs +## Vision Globale -- **Concept général** : Jeu d'usine avec une composante militaire forte -- **Inspiration** : Factorio-like avec dimension stratégique militaire -- **Principe clé** : L'importance du choix à tous les niveaux -- **Progression** : De PMC vers opérations conventionnelles, impact du joueur grandit avec le temps +**Warfactory** est un RTS/4X révolutionnaire fusionnant la profondeur industrielle de Factorio avec une simulation militaire réaliste et une économie mondiale dynamique. Le projet allie l'hommage moral à l'Ukraine avec une architecture technique modulaire ultra-innovante, optimisée pour le développement assisté par IA. -## Philosophie de design +**Innovation Centrale** : Un système économique où TOUS les acteurs (joueur, IA, États) suivent exactement les mêmes règles économiques, créant une simulation authentique et éducative des marchés mondiaux. -### Clarté et simplicité -- Interface claire avec pictogrammes simples pour éviter la fausse complexité -- Jeu déjà complexe nécessitant une présentation accessible +## Concept de Jeu et Progression -### Aspect usine -- La ligne d'assemblage soit le cœur -- La doctrine militaire que le joueur s'est trouvée indique les besoins industriels -- L'énergie c'est facile à gérer -- L'extraction c'est facile +### De PMC à Géant Industriel +**Progression naturelle** : +- **Phase PMC** : Opérations irrégulières limitées, contrats d'État +- **Phase Industrielle** : Production civile/militaire, expansion géographique +- **Phase Géopolitique** : Influence mondiale, doctrines militaires, crises planétaires -### Aspect militaire -- Le joueur doit se trouver sa propre doctrine et créer son gameplay -- Mettre en avant le concept de doctrine d'emploi -- La contemplation du combat -- IA qui donne du feedback de sa compétence ou de sa médiocrité -- Bien que le contrôle direct soit important, il n'est pas le cœur +**Liberté d'échelle** : Philosophie bac à sable permettant au joueur de rester artisan local ou de défier Lockheed Martin selon ses ambitions. -### Progression militaire -- Dans un premier temps on se cantonner à des opérations irrégulières -- L'impact du joueur grandit avec le temps +### Principe "Skip vs Optimize" +**Design fondamental** : Tous les systèmes peuvent être automatisés ou micro-gérés +- **Skip** : Solutions automatisées, efficacité réduite mais accessibles +- **Optimize** : Contrôle manuel complet, efficacité maximale +- **Hybride** : Mix selon préférences et contexte -### Égalité économique (RÈGLE FONDAMENTALE) -**Principe core** : Le player n'a AUCUN privilège économique artificiel +Exemples concrets : +- **Production** : Usines tout-en-un vs layouts Factorio optimisés +- **Combat** : IA tactique vs commande directe +- **Commerce** : Auto-trade vs négociation manuelle -- **Same rules for all** : Player, AI companies, AI states suivent EXACTEMENT les mêmes règles économiques -- **No artificial advantages** : Aucun bonus coût, aucun discount, aucun traitement spécial -- **Success via insight** : Réussite basée sur compréhension économique réelle, pas privilèges -- **Educational integrity** : Players apprennent vrais principes économiques applicables -- **Competitive fairness** : AI opponents économiquement crédibles et rationnels +## Systèmes Industriels Intégrés + +### Architecture Factorio-like Avancée +**Cœur productif** : +- **Production modulaire** : Belts, inserters, factories avec évolution progressive +- **4 phases de complexité** : Mono → Multi-lanes → Bidirectionnel → Full Factorio +- **Qualité d'assemblage** : Placement optimal vs automatique avec pénalités réalistes + +**Innovation : Dual Production System** : +- **Production brute** : Transformation ressources primaires (minerai → plaques) +- **Assemblage précis** : Placement composants selon grilles vehicules + +### Flexibilité de Reconversion Industrielle +**Mécaniques réalistes** basées sur similarité des processus : +- **Facile** : Tables fer → Blindages (même matériaux, processus similaires) +- **Complexe** : Tables → Canons (précision usinage, alliages spéciaux) +- **Impossible** : Menuiserie → Production hydrogène (zéro overlap technologique) + +## Système Militaire Révolutionnaire + +### Conception de Véhicules par Grilles +**Innovation gameplay** : Design sur châssis irréguliers avec zones spécialisées + +**Interface intuitive** : +- **Pick & Place** : Drag & drop composants avec rotations A/E +- **Snap toggle** : R pour alignement grille +- **Validation temps réel** : Contraintes poids/énergie vérifiées durant placement + +**Diversité massive** : +- **Châssis nommés** : "Griffon" (chenillé), "Viper" (modulaire), "Fennec" (ultra-léger) +- **3 layers** : Châssis → Systèmes → Armes & Capteurs +- **1000+ composants** : Formes uniques, jamais carrées ni 1x1 + +### Système d'Amélioration Générique +**Améliorations universelles** stackables avec rendements décroissants : +- **High ROF** : +20% cadence, +40% chaleur (stack 1), puis +10%/+40% (stack 2) +- **Efficiency** : -20% consommation, -15% performance +- **Reliability** : +30% durabilité, -10% performance + +**Coût exponentiel** : 1.25^n per stack avec malus cumulatifs linéaires + +## Économie Mondiale Simulée + +### Égalité Économique Fondamentale +**RÈGLE NON-NÉGOCIABLE** : Le joueur n'a AUCUN privilège économique artificiel -**Implementation requirement** : ```cpp -// INTERDIT - Player privilege +// INTERDIT - Avantage joueur if(agent.isPlayer()) order.cost *= 0.9f; -// OBLIGATOIRE - Equal treatment +// OBLIGATOIRE - Traitement égal float cost = calculateRealTransportCost(order); agent.processOrder(order, cost); ``` -Cette règle est **NON-NÉGOCIABLE** pour l'intégrité de la simulation économique. +**Résultat** : Réussite basée sur compréhension économique réelle, pas sur privilèges artificiels. -## Inspiration Undertale -- S'inspirer d'Undertale pour la partie choix géopolitique \ No newline at end of file +### Système de Companies avec Features +**Chaque IA company** a 2-4 features définissant ses capacités : +- **Domaines** : Metal, Electronic, Tank, Plane, Wood, Food, Engine, Cannon, Missile +- **Modificateurs** : Quality, Quantity, Speed, Cost, Modularity, Innovation + +**Exemple** : Company "Metal + Plane + Quantity + Electronic" excelle en avions métalliques de masse avec électronique embarquée, mais manque raffinement vs spécialistes Quality. + +### Transport Multi-Modal Réaliste +**Hiérarchie des coûts** (indicative) : +- **Maritime** : ~0.10€/kg (volume massif, ultra-économique) +- **Ferroviaire** : ~0.50€/kg (grandes quantités, infrastructure) +- **Aérien** : ~2.00€/kg (rapide, coûteux) +- **Routier** : ~5.00€/kg (flexible, dernier kilomètre) + +**Impact stratégique** : Localisation côtière = avantage économique 50x + +### Marchés Segmentés et Restrictions +**Types de marchés** : +- **Nationaux** : Par pays avec politiques douanières +- **Companies privés** : Accords bilatéraux +- **Blocs multinationaux** : UE, OTAN avec préférences +- **Mondial** : Marché libre avec sanctions possibles + +**Doubles verrous** : Companies ET États peuvent bloquer accès + +## Architecture Technique Révolutionnaire + +### Modularité Claude Code Optimisée +**Innovation développement** : Architecture modulaire révolutionnaire pour développement IA + +**Contraintes strictes** : +- **200-300 lignes max** par module (EXCEPTION : ProductionModule 500-800) +- **Build autonome** : `cd modules/tank/ && cmake .` - zéro dépendance parent +- **Hot-reload 0.4ms** : Modifications instantanées sans restart +- **Développement parallèle** : 3+ instances Claude Code simultanées + +### Interface System IMMUTABLE +**5 interfaces fondamentales** (JAMAIS modifiées une fois finalisées) : +```cpp +ICoordinationModule → Orchestrateur global système +IEngine → Coordination locale (Debug → HighPerf → DataOriented) +IModuleSystem → Stratégie d'exécution (Sequential → Threaded → Cluster) +IModule → Logique métier pure (TankModule.so, EconomyModule.so) +IIO → Communication (IntraIO → LocalIO → NetworkIO) +``` + +### Évolution Progressive Sans Régression +```cpp +// Phase 1 : Prototype +DebugEngine + SequentialModuleSystem + IntraIO + +// Phase 2 : Optimization +DebugEngine + ThreadedModuleSystem + IntraIO + +// Phase 3 : Production +HighPerfEngine + MultithreadedModuleSystem + LocalIO + +// Phase 4 : MMO Scale +DataOrientedEngine + ClusterModuleSystem + NetworkIO +``` + +**Avantage révolutionnaire** : Modules métier inchangés à travers toutes les phases ! + +## Carte et Exploration + +### Architecture Multi-Échelles +**2 niveaux discrets** : +- **Large Map** : Carte mondiale éditable, navigation node-based +- **Local Map** : Tiles 1m×1m, chunks 64×64, style Factorio précis + +### Génération Procédurale par Budget de Points +**Innovation système** : Chaque tile reçoit score (-10 à +10) équilibrant automatiquement risques/récompenses + +**218+ éléments** avec tendances régionales : +- **Bassins pétroliers** : Pétrole ×5 probabilité, terrains marécageux ×2 +- **Zones ex-minières** : Fer/charbon ×3-4, teritons ×8, pollution héritée ×3 +- **Régions forestières** : Forêt dense ×3-4, grottes ×2-3, pentes abruptes ×2 + +**Découverte stratifiée** : +- **Visible** : Relief, végétation, structures surface +- **Caché niveau 1** : Prospection géologique (gisements souterrains) +- **Caché niveau 2** : Magnétométrie (anomalies, structures enfouies) +- **Caché niveau 3** : Analyse NRBC (contaminations invisibles) + +## Arbre Technologique Massif + +### 3000+ Technologies pour Rejouabilité Infinie +**Principe découverte** : Player ne recherche PAS toutes les technologies ! +- **Discovery organique** : Breakthrough via gameplay naturel +- **10-50 techs éligibles** simultanément (jamais 3000) +- **Système de passerelles** : Expertise dans un domaine débloque prototypes dans autres + +**Exemple passerelles Châssis** : +``` +Métallurgie Avancée → [PROTOTYPE] Châssis Composite +Électronique → [PROTOTYPE] Châssis Smart +Moteur → [PROTOTYPE] Châssis Performance +``` + +## Contexte Narratif et Éthique + +### Hommage à l'Ukraine +**Motivation morale fondamentale** : "L'Ukraine parce qu'ils sont des héros, parce qu'ils meurent pour leur liberté et pour la nôtre." + +**Intégration authentique** : +- **Géographie réelle** : Ukraine, Europe sur carte mondiale +- **Contexte historique** : Zones post-industrielles, vestiges soviétiques +- **Enjeux géopolitiques** : Résistance démocratique vs autoritarisme + +### Crises Endgame +**3 scénarios apocalyptiques** avec mécaniques distinctes : +- **Zombie Apocalypse** : Vitesse de réaction, lignes de défense +- **Invasion ET** : Technologie supérieure aérienne, survie planétaire +- **Demon Portal** : Portails imprévisibles, course contre extermination + +## Interface Utilisateur Révolutionnaire + +### Système IUI Data-Agnostic +**Architecture générique** supportant tous types de contenu : +- **Enums type-safe** : `DataType::ECONOMY`, `RequestType::GET_PRICES` +- **Windowing hiérarchique** : Parent → Dock → Split → Tab → Window +- **Hybrid Sizing System** : Cibles pourcentage avec contraintes pixels + +**Layout professionnel** : Topbar économique + panel companies + carte stratégique + console + +## Performance et Scalabilité + +### Fréquences Modulaires Optimisées +- **ProductionModule** : 60Hz (frame-perfect factory) +- **TankModule Targeting** : 60Hz (combat réactif) +- **TankModule Movement** : 30Hz (positions) +- **TankModule Tactical** : 1Hz (décisions stratégiques) +- **EconomyModule** : 0.01-0.1Hz (cycles économiques) + +### Targets Performance +- **V1 Client** : 30+ fps, 10+ joueurs serveur +- **V2 Client** : 60+ fps, 100+ joueurs serveur avec prédiction locale + +## Philosophie de Design Avancée + +### "Complexity through Simplicity" +**Complexité AAA** émergeant de modules simples Claude-friendly : +- **Modules 200 lignes** = compréhension IA parfaite +- **Interactions complexes** = gameplay émergent sophistiqué +- **Testing granulaire** = fiabilité et débug facilités + +### Configuration vs Modding +**Philosophy YAGNI** : Configuration JSON couvre 90% besoins modding +```json +{ + "tank_mk2_custom": { + "health": 150, "speed": 30, + "weapons": ["cannon_105mm", "mg_coaxial"] + }, + "aggressive_ai": { + "engagement_range": 1000, + "retreat_threshold": 20 + } +} +``` + +## État Actuel et Roadmap + +### PRODUCTION-READY Achievements +- ✅ **Core Interfaces COMPLETE** : Architecture modulaire immutable finalisée +- ✅ **UI System COMPLETE** : IUI + ImGuiUI avec hybrid sizing révolutionnaire +- ✅ **Hot-Reload 0.4ms** : Workflow développement révolutionné +- ✅ **Configuration System** : IDataTree avec validation SHA256 +- ✅ **Cross-Platform Pipeline** : Linux dev → Windows .exe automatisé + +### Next Phases +1. **Phase 2** : Implémentations concrètes (DebugEngine, JSONDataTree) +2. **Phase 3** : Modules gameplay (ProductionModule, TankModule) +3. **Phase 4** : Integration économique et multijoueur + +## Conclusion : Une Vision Révolutionnaire + +Warfactory transcende les genres traditionnels en unifiant industrie, stratégie militaire et simulation économique authentique dans une architecture technique révolutionnaire. + +Le projet honore l'héroïsme ukrainien tout en repoussant les limites du développement assisté par IA, créant un gameplay émergent d'une profondeur inégalée où chaque choix - industriel, militaire, économique - résonne à travers un système interconnecté d'une complexité et d'un réalisme saisissants. + +**Slava Ukraini !** \ No newline at end of file diff --git a/docs/02-systems/CLIMATE_SIMULATION_SYSTEM.md b/docs/02-systems/CLIMATE_SIMULATION_SYSTEM.md new file mode 100644 index 0000000..3712d86 --- /dev/null +++ b/docs/02-systems/CLIMATE_SIMULATION_SYSTEM.md @@ -0,0 +1,488 @@ +# Climate Simulation System + +**Status**: Designed - Ready for Implementation +**Scope**: Realistic climate patterns through mobile wind regions and convergence zones +**Integration**: Uses existing TectonicRegions framework + +## System Overview + +Revolutionary climate simulation using **mobile wind regions** that spawn, evolve, and interact to create emergent weather patterns. Solves the "Sahara vs Congo" problem through **Inter-Tropical Convergence Zones (ITCZ)** and **planetary rotation bands** without complex 3D atmospheric physics. + +### Key Innovations +- **Mobile WindRegions** with token-based distribution system +- **ITCZ gravitational zones** based on continental mass +- **Planetary rotation bands** for realistic circulation patterns +- **Emergent storm evolution** from simple wind interactions +- **Destruction token system** for persistent terrain effects + +## Core Concepts + +### WindRegion Mobile Entities +```json +"wind_region": { + "position": [x, y], + "wind_strength": 1.0, // Base intensity (decays over time) + "wetness": 0.0, // Moisture content (gained over ocean) + "velocity": [vx, vy], // Movement vector + "wind_tokens": 100, // Distributed to tiles + "decay_per_move": 0.02, // -2% strength per movement + "decay_per_tile": 0.01 // -1% strength per tile crossed +} +``` + +### ITCZ Convergence Zones +```json +"itcz_zone": { + "center": [x, y], + "gravitational_range": "sqrt(landmass_area) * 50", + "aspiration_strength": "landmass_mass / distance^2", + "amplification_factor": 3.0, // Wind strength multiplier at center + "latitude_requirement": [0.45, 0.55] // Equatorial band only +} +``` + +## Simulation Architecture + +### Phase 1: Landmass Analysis and ITCZ Generation + +**Uses Existing TectonicRegions:** +```cpp +// Analyze continental masses from existing tectonic data +std::vector continents = groupTectonicRegions(); + +// Generate water masses by inverse analysis +std::vector oceans = detectOceanBasins(continents); + +// Place ITCZ zones on qualifying equatorial landmasses +for (auto& continent : continents) { + if (continent.latitude >= 0.45 && continent.latitude <= 0.55 && + continent.area > MIN_LANDMASS_SIZE) { + createITCZ(continent.center, sqrt(continent.area)); + } +} +``` + +**ITCZ Requirements:** +- **Latitude Band**: 45-55% of map height (equatorial) +- **Minimum Landmass**: 10,000+ tiles +- **Ocean Proximity**: Within 800km for moisture source +- **Continental Heating**: Large thermal mass for convection + +### Phase 2: WindRegion Spawning System + +**Procedural Spawn Rules:** +```json +"wind_spawn_system": { + "spawn_locations": "ocean_masses_only", + "spawn_frequency": "water_mass_size / 1000", + "initial_strength": "water_temperature * evaporation_factor", + "region_size": "sqrt(water_mass_area) / 10", + "tokens_per_region": "base_tokens * size_factor", + "spawn_distribution": "random_within_water_region_biased_toward_center" +} +``` + +**Note**: WindRegions spawn aléatoirement dans le rayon de la waterRegion avec une distribution de spawn plutôt vers le centre pour éviter les spawns en bordure systématiques. + +**Spawn Distribution:** +- **Large Oceans** (Pacific): Big regions, high frequency +- **Medium Seas** (Mediterranean): Medium regions, moderate frequency +- **Small Bays**: Small regions, low frequency +- **No Land Spawning**: All weather originates from water bodies + +### Phase 3: Movement and Planetary Circulation + +**Planetary Rotation Bands** (based on real 10hPa atmospheric data): +```json +"planetary_circulation": { + "polar_jet_north": { + "latitude_range": [0.10, 0.25], + "direction": "west_to_east", + "strength": 1.8 + }, + "calm_transition_1": { + "latitude_range": [0.25, 0.40], + "movement": "chaos_plus_procedural" + }, + "equatorial_trades": { + "latitude_range": [0.40, 0.60], + "direction": "east_to_west", + "strength": 1.5 + }, + "calm_transition_2": { + "latitude_range": [0.60, 0.75], + "movement": "chaos_plus_procedural" + }, + "polar_jet_south": { + "latitude_range": [0.75, 0.95], + "direction": "west_to_east", + "strength": 1.8 + } +} +``` + +**Movement Calculation:** +```cpp +Vector2 movement = + planetary_rotation_band * 0.6 + // 60% planetary circulation + equator_to_pole_bias * 0.2 + // 20% thermal circulation + terrain_deflection * 0.1 + // 10% topographic influence + random_variation * 0.1; // 10% chaos +``` + +### Phase 4: WindRegion Evolution and Interactions + +**Dynamic Evolution:** +```cpp +void updateWindRegion(WindRegion& region) { + // Gain moisture over water + if (currentTile.isOcean()) { + region.wetness += OCEAN_MOISTURE_GAIN; + } + + // Repulsion from other regions = acceleration + // NOTE: Not physical repulsion - proxy for spatial competition and turbulence + // Prevents region stacking while creating realistic dispersion patterns + // CRITIQUE POINT: May cause "force field" effect around ITCZ zones where regions + // oscillate/scatter instead of converging due to attraction vs repulsion conflict. + // Alternative approaches: density-based drift, no interaction, or collision division. + // TODO: Implement as configurable algorithm options for empirical testing. + float repulsion = calculateRepulsionForce(region, nearbyRegions); + region.wind_strength += repulsion * ACCELERATION_FACTOR; + + // Movement decay + region.wind_strength *= (1.0 - DECAY_PER_MOVE); + + // Tile crossing cost + region.wind_strength *= (1.0 - DECAY_PER_TILE); + + // Die when too weak + if (region.wind_strength < MINIMUM_THRESHOLD) { + destroyRegion(region); + } +} +``` + +**ITCZ Gravitational Effects:** +```cpp +void applyITCZGravity(WindRegion& region) { + for (auto& itcz : active_itcz_zones) { + float distance = calculateDistance(region.position, itcz.center); + + if (distance < itcz.gravitational_range) { + // Attraction force (inverse square law) + // NOTE: "Gravitational" metaphor for influence strength, not literal physics + // Like saying someone has "gravitas" - clear semantic meaning for developers + float attraction = itcz.mass / (distance * distance); + Vector2 pull_direction = normalize(itcz.center - region.position); + + // Apply attraction + region.velocity += pull_direction * attraction; + + // Amplification effect as region approaches + float proximity = (itcz.range - distance) / itcz.range; + float amplification = 1.0 + (itcz.max_amplification * proximity); + + region.wind_strength *= amplification; + region.wetness *= amplification; + } + } +} +``` + +### Phase 5: Storm Classification and Token Distribution + +**Climate Zone Classification:** +```cpp +// Simple thresholds for climate zone determination +const float HIGH_WIND_THRESHOLD = 2.0; +const float FLOOD_THRESHOLD = 1.5; +const float HURRICANE_WIND = 2.5; +const float HURRICANE_RAIN = 2.0; + +bool isHighWindZone(const WindRegion& region) { + return region.wind_strength >= HIGH_WIND_THRESHOLD; +} + +bool isFloodZone(const WindRegion& region) { + return region.wetness >= FLOOD_THRESHOLD; +} + +bool isHurricaneZone(const WindRegion& region) { + return region.wind_strength >= HURRICANE_WIND && region.wetness >= HURRICANE_RAIN; +} +``` + +**Token Distribution System:** +```cpp +void distributeTokens(WindRegion& region) { + // Basic climate tokens for all regions + int wind_tokens = static_cast(region.wind_strength * 10); + int rain_tokens = static_cast(region.wetness * 10); + + WorldTile& tile = world_map.getTile(region.position); + tile.addTokens("wind", wind_tokens); + tile.addTokens("rain", rain_tokens); + + // Special climate zone tokens for extreme weather + if (isHighWindZone(region)) { + tile.addTokens("highWind", 1); // Hostile to forests + } + if (isFloodZone(region)) { + tile.addTokens("flood", 1); // Forces wetlands/marshes + } + if (isHurricaneZone(region)) { + tile.addTokens("hurricane", 1); // Specialized hurricane biome + } + + // Consume distributed tokens from region + region.wind_tokens -= wind_tokens; + region.rain_tokens -= rain_tokens; +} +``` + +## Geographic Climate Patterns + +### Realistic Climate Formation + +**Congo Basin (Rainforest):** +``` +1. Large African landmass → Strong ITCZ at equator +2. Atlantic wind regions spawn → Move east via trade winds +3. ITCZ aspiration → Convergence at Congo → Amplification ×3 +4. Super-humid storms → Massive rain token distribution +5. Result: Dense rainforest biome +``` + +**Sahara Desert:** +``` +1. Sahara latitude (25-35°N) → Outside ITCZ band +2. No convergence zone → Wind regions pass through +3. Continental distance → Low initial moisture +4. Subtropical high pressure → Air descends (simulated via movement patterns) +5. Result: Minimal rain tokens → Desert biome +``` + +**Egypt/Algeria Coastal:** +``` +1. Mediterranean wind regions → Moderate moisture +2. Coastal proximity → Some rain tokens +3. Sahara interior → Moisture depleted inland +4. Result: Mediterranean coastal climate → Desert interior gradient +``` + +### Emergent Seasonal Patterns + +**ITCZ Strength Variation:** +```json +"seasonal_modulation": { + "itcz_strength_summer": 1.5, // Stronger convection + "itcz_strength_winter": 0.8, // Weaker convection + "spawn_rate_summer": 1.3, // More wind regions + "spawn_rate_winter": 0.7 // Fewer wind regions +} +``` + +**Results:** +- **Monsoon Seasons**: ITCZ amplification cycles +- **Hurricane Seasons**: Increased spawn rates + ITCZ amplification +- **Dry Seasons**: Reduced ITCZ strength + lower spawn rates + +## Climate Zone Effects on Biome Generation + +### Token-Based Biome Classification + +**Climate Token Usage:** +```cpp +BiomeType classifyBiome(const WorldTile& tile) { + int total_rain = tile.getAccumulatedTokens("rain"); + int total_wind = tile.getAccumulatedTokens("wind"); + int highWind_tokens = tile.getAccumulatedTokens("highWind"); + int flood_tokens = tile.getAccumulatedTokens("flood"); + int hurricane_tokens = tile.getAccumulatedTokens("hurricane"); + + // Special climate zones override normal biome classification + if (hurricane_tokens > 0) { + return BiomeType::HURRICANE_ZONE; // Specialized storm-resistant vegetation + } + if (flood_tokens > FLOOD_THRESHOLD) { + return BiomeType::WETLANDS; // Forced marshes/swamps + } + if (highWind_tokens > STORM_THRESHOLD) { + // High wind prevents forest growth + if (total_rain > 300) { + return BiomeType::STORM_PRAIRIE; // Grasslands that can handle wind + } else { + return BiomeType::BADLANDS; // Sparse, wind-resistant vegetation + } + } + + // Normal biome classification using basic rain/wind tokens + if (total_rain > 500) { + return BiomeType::TROPICAL_RAINFOREST; + } else if (total_rain < 50) { + return BiomeType::HOT_DESERT; + } + // ... additional normal biome logic +} +``` + +**Climate Zone Characteristics:** +- **Hurricane Zones** → Storm-resistant palms, specialized coastal vegetation +- **Flood Zones** → Wetlands, marshes, swamp vegetation mandatory +- **High Wind Zones** → No forests allowed, prairie/badlands only +- **Normal Zones** → Standard biome classification by rain/temperature + +## Performance Characteristics + +### Computational Complexity +- **Wind Regions**: O(n) for n active regions (~50-200 simultaneously) +- **ITCZ Calculations**: O(m) for m convergence zones (~5-15 globally) +- **Token Distribution**: O(tiles_visited) per region movement +- **Total per cycle**: O(n × average_movement_distance) + +### Memory Usage +- **WindRegion**: 32 bytes per region +- **ITCZ Zone**: 24 bytes per zone +- **Token accumulation**: Uses existing tile data structure +- **Estimated total**: <5MB for global weather simulation + +### Generation Time +- **Landmass analysis**: 1-2 seconds (one-time setup) +- **Per simulation cycle**: 10-50ms for 100-200 wind regions +- **Full climate stabilization**: 100-500 cycles → 10-30 seconds total + +## Integration with Existing Systems + +### TectonicRegions Reuse +```cpp +// Leverage existing tectonic analysis +class ClimateSystem { + void initializeFromTectonics(const std::vector& regions) { + auto continents = groupRegionsByProximity(regions); + auto oceans = calculateOceanBasins(continents); + + generateITCZFromContinents(continents); + setupWindSpawnFromOceans(oceans); + } +}; +``` + +### RegionalInfluence Framework +```cpp +// Wind regions as mobile regional influences +class WindRegion : public RegionalInfluence { + void applyInfluenceToTile(WorldTile& tile) override { + distributeTokens(tile); + + // Create regional influence for persistent effects + if (isStormLevel()) { + createPersistentInfluence(tile, getStormType()); + } + } +}; +``` + +### Biome Generation Integration +```cpp +// Use accumulated climate tokens for biome classification +BiomeType classifyBiome(const WorldTile& tile) { + int total_rain = tile.getAccumulatedTokens("rain"); + int total_wind = tile.getAccumulatedTokens("wind"); + float temperature = tile.getTemperature(); + + if (total_rain > 500 && temperature > 20.0f) { + return BiomeType::TROPICAL_RAINFOREST; + } else if (total_rain < 50 && temperature > 15.0f) { + return BiomeType::HOT_DESERT; + } + // ... additional biome logic +} +``` + +## Implementation Priority + +### Phase 1: Core Framework (1-2 weeks) +1. WindRegion class and basic movement +2. Token distribution system +3. Simple spawn from ocean detection +4. Basic planetary circulation bands + +### Phase 2: ITCZ System (1-2 weeks) +1. Landmass analysis from TectonicRegions +2. ITCZ generation and gravitational effects +3. Wind region amplification mechanics +4. Storm classification system + +### Phase 3: Advanced Features (1-2 weeks) +1. Destruction token system and persistent effects +2. Seasonal variation and modulation +3. Performance optimization +4. Integration with biome generation + +### Phase 4: Tuning and Validation (1 week) +1. Parameter adjustment for realistic patterns +2. Verification of Congo/Sahara differentiation +3. Performance profiling and optimization +4. Documentation and examples + +## Configuration Example + +```json +{ + "climate_simulation": { + "wind_spawn_system": { + "base_spawn_rate": 0.1, + "ocean_size_factor": 0.001, + "max_concurrent_regions": 200 + }, + "planetary_circulation": { + "trade_winds_strength": 1.5, + "jet_stream_strength": 1.8, + "calm_zone_chaos": 0.3 + }, + "itcz_system": { + "latitude_band": [0.45, 0.55], + "min_landmass_size": 10000, + "max_ocean_distance": 800, + "amplification_max": 3.0 + }, + "storm_thresholds": { + "high_wind_min": 2.0, + "flood_wetness_min": 1.5, + "hurricane_wind_min": 2.5, + "hurricane_rain_min": 2.0 + }, + "token_distribution": { + "wind_token_factor": 10, + "rain_token_factor": 10, + "climate_zone_rate": 1 + } + } +} +``` + +**Note**: All parameters are hot-reloadable via the modular configuration system. Magic numbers are intentionally externalizable for real-time tuning during development - adjust values, save config, see immediate results without recompilation. +``` + +## Scientific Accuracy vs Gameplay + +### Scientifically Inspired Elements +- ✅ ITCZ formation from continental heating +- ✅ Planetary circulation bands (trade winds, jet streams) +- ✅ Storm formation from wind-moisture interaction +- ✅ Geographic influence on climate patterns +- ✅ Persistent landscape effects from weather + +### Gameplay Simplifications +- ⚠️ 2D simulation instead of 3D atmospheric layers +- ⚠️ Simplified storm evolution (no pressure systems) +- ⚠️ Discrete token system instead of continuous fields +- ⚠️ Accelerated timeframes for practical simulation + +### Result +**Plausible climate science** that creates **engaging gameplay** with **emergent complexity** from **simple, understandable rules**. + +--- + +**Status**: System designed and ready for implementation. Provides realistic climate differentiation (Sahara vs Congo) through elegant mobile region simulation using existing tectonic framework. \ No newline at end of file diff --git a/docs/02-systems/GEOLOGICAL_SIMULATION_SYSTEM.md b/docs/02-systems/GEOLOGICAL_SIMULATION_SYSTEM.md new file mode 100644 index 0000000..892d0a7 --- /dev/null +++ b/docs/02-systems/GEOLOGICAL_SIMULATION_SYSTEM.md @@ -0,0 +1,1886 @@ +# Geological Simulation System + +**Status**: Designed - Ready for Implementation +**Scope**: Complete planetary formation from accretion to industrial-ready geology +**Duration**: 4.65 billion years simulation in 95 cycles + +## System Overview + +Revolutionary geological simulation system that generates realistic planetary geology through scientifically-inspired processes. Creates diverse, coherent geology with proper resource distribution for industrial gameplay. + +### Key Innovations +- **RegionalInfluence framework** adapted for geological processes +- **Tectonic regions** as simple circles with forces (not complex mesh) +- **Carbon region system** for realistic coal/oil formation +- **Dynamic sea level** affecting all geological processes +- **Optimized 24-byte tiles** supporting geological temperature ranges + +## Simulation Phases + +### Phase 1: Planetary Accretion (30 cycles × 100M years = 3.0 Ga) + +**Initial Conditions**: +- Temperature: -100°C (space cold) +- Elevation: -30,000m (no surface) +- Empty planetary core + +**Process - Meteorite Bombardment**: +``` +For each wave (100M years): + 1. Generate 100-500 random meteorite impacts + 2. Each impact adds: + - Kinetic energy → heat (up to +2000°C) + - Mass → elevation change (+crater formation) + - Metal composition → resource deposits + 3. Heavy metals sink to planetary core + 4. Core temperature drives volcanic eruptions + 5. Eruptions redistribute core metals to surface + 6. Gradual cooling between waves +``` + +**Expected Results**: +- Surface elevation: -30,000m → -15,000m +- Core composition: 80% iron, 15% nickel, 5% precious metals +- Crater-based geology with metal deposits +- Temperature stabilization around 1000-1500°C + +### Phase 2: Tectonic Formation (25 cycles × 100M years = 2.5 Ga) + +**Reduced Meteorite Activity**: +```cpp +// Phase 2 meteorite parameters (reduced from Phase 1) +impacts_per_wave = rng.randInt(10, 50); // 10x reduction +meteorite_mass = rng.randFloat(10^12, 10^15); // Smaller impacts +impact_probability = 0.3f; // 30% chance per cycle +``` + +**Tectonic Region System**: +```cpp +struct TectonicRegion { + uint32_t region_id; + float center_x, center_y; // Mobile center (world coordinates) + float radius; // Current radius (tiles) + float velocity_x, velocity_y; // Movement (tiles per cycle) + float mass; // For repulsive force calculations + RegionType type; // OCEANIC, CONTINENTAL, VOLCANIC + + // Evolution parameters + float split_probability; // Chance to divide (0.01 = 1% per cycle) + float growth_rate; // Radius change per cycle (+/- tiles) + float stability; // Resistance to external forces + + // Formation tracking + int formation_cycle; // When this region was created + uint32_t parent_region_id; // If split from another region +}; + +enum class RegionType { + OCEANIC, // Dense, subducts under continental + CONTINENTAL, // Light, forms mountains when compressed + VOLCANIC, // Active volcanic zone (temporary) +}; +``` + +**Tectonic Physics Engine**: +```cpp +void updateTectonicRegions(float time_step) { + // 1. Calculate repulsive forces between all regions + for (auto& region1 : tectonic_regions) { + Vector2 total_force = {0.0f, 0.0f}; + + for (auto& region2 : tectonic_regions) { + if (region1.region_id == region2.region_id) continue; + + float distance = calculateDistance(region1.center, region2.center); + float overlap = (region1.radius + region2.radius) - distance; + + if (overlap > 0) { + // Collision detected! + Vector2 repulsion_direction = normalize(region1.center - region2.center); + + // Force magnitude: F = k * overlap^2 / (mass1 + mass2) + float force_magnitude = REPULSION_CONSTANT * overlap * overlap / + (region1.mass + region2.mass); + + Vector2 repulsion_force = repulsion_direction * force_magnitude; + total_force += repulsion_force; + + // Create volcanic zone at collision point + createVolcanicZone(region1, region2, overlap); + } + } + + // Apply acceleration: a = F/m + Vector2 acceleration = total_force / region1.mass; + region1.velocity_x += acceleration.x * time_step; + region1.velocity_y += acceleration.y * time_step; + + // Apply velocity damping (friction) + region1.velocity_x *= VELOCITY_DAMPING; + region1.velocity_y *= VELOCITY_DAMPING; + } + + // 2. Update positions and sizes + for (auto& region : tectonic_regions) { + // Move regions + region.center_x += region.velocity_x * time_step; + region.center_y += region.velocity_y * time_step; + + // Boundary wrapping (world is spherical) + wrapCoordinates(region.center_x, region.center_y); + + // Evolve size + region.radius += region.growth_rate * time_step; + region.radius = std::clamp(region.radius, MIN_REGION_RADIUS, MAX_REGION_RADIUS); + + // Check for splitting + if (region.radius > SPLIT_THRESHOLD && + rng.probability(region.split_probability * time_step)) { + splitTectonicRegion(region); + } + } +} +``` + +**Volcanic Zone Creation**: +```cpp +void createVolcanicZone(TectonicRegion& r1, TectonicRegion& r2, float collision_intensity) { + // Volcanic zone at intersection point + Vector2 intersection = calculateIntersectionCenter(r1, r2); + float volcanic_radius = collision_intensity * VOLCANIC_RADIUS_FACTOR; + + // Create temporary volcanic region + TectonicRegion volcanic_zone = { + .center_x = intersection.x, + .center_y = intersection.y, + .radius = volcanic_radius, + .type = RegionType::VOLCANIC, + .formation_cycle = current_cycle, + .split_probability = 0.05f, // High chance to break apart + .growth_rate = -0.1f // Shrinks over time + }; + + // Apply volcanic influence to affected tiles + RegionalInfluence volcanic_influence = { + .type = "volcanic_mountain_formation", + .intensity = collision_intensity, + .properties = json{ + {"elevation_bonus", collision_intensity * 500.0f}, // +500m per intensity + {"temperature_bonus", collision_intensity * 300.0f}, // +300°C + {"resource_deposits", json::array({"iron", "sulfur", "rare_metals"})}, + {"volcanic_features", json::array({"volcano", "hot_springs", "lava_tubes"})} + } + }; + + applyRegionalInfluence(volcanic_influence, intersection.x, intersection.y, volcanic_radius); + tectonic_regions.push_back(volcanic_zone); +} +``` + +**Region Splitting Algorithm**: +```cpp +void splitTectonicRegion(TectonicRegion& parent) { + // Create two child regions + float split_distance = parent.radius * 0.4f; + Vector2 split_direction = randomUnitVector(); + + TectonicRegion child1 = parent; + TectonicRegion child2 = parent; + + // Assign new IDs + child1.region_id = next_region_id++; + child2.region_id = next_region_id++; + child1.parent_region_id = parent.region_id; + child2.parent_region_id = parent.region_id; + + // Separate positions + child1.center_x += split_direction.x * split_distance; + child1.center_y += split_direction.y * split_distance; + child2.center_x -= split_direction.x * split_distance; + child2.center_y -= split_direction.y * split_distance; + + // Reduce sizes + child1.radius *= 0.7f; + child2.radius *= 0.7f; + + // Opposite velocities (moving apart) + child1.velocity_x = split_direction.x * SPLIT_VELOCITY; + child1.velocity_y = split_direction.y * SPLIT_VELOCITY; + child2.velocity_x = -split_direction.x * SPLIT_VELOCITY; + child2.velocity_y = -split_direction.y * SPLIT_VELOCITY; + + // Replace parent with children + removeRegion(parent); + addRegion(child1); + addRegion(child2); + + // Create rift valley between children + createRiftValley(child1, child2); +} +``` + +**Expected Results**: +- Surface elevation: -15,000m → -5,000m (+10km crustal thickening) +- Formation of 15-25 stable tectonic regions +- Mountain ranges at collision zones (+1000-3000m elevation) +- Rift valleys where regions separate (-500m elevation) +- Distinct continental vs oceanic regions + +### Phase 3: Hydrological Cycles (25 cycles × 20M years = 0.5 Ga) + +**Dynamic Sea Level System**: +```cpp +struct OceanLevel { + float current_sea_level; // Global reference (meters) + float ice_volume; // Polar ice volume (km³) + float thermal_expansion_factor; // Ocean thermal expansion coefficient + float tectonic_basin_volume; // Total oceanic basin volume + + void updateSeaLevel(float global_temperature, float volcanic_co2) { + // 1. Ice volume changes (glaciation/melting) + float target_ice_volume = calculateIceVolume(global_temperature); + float ice_change = (target_ice_volume - ice_volume) * 0.1f; // 10% change per cycle + ice_volume += ice_change; + + // Sea level change: 1 km³ ice = +2.7mm sea level + float ice_effect = -ice_change * 0.0027f; + + // 2. Thermal expansion + float thermal_effect = (global_temperature - 15.0f) * thermal_expansion_factor; + + // 3. Tectonic effects (basin formation/destruction) + float tectonic_effect = (tectonic_basin_volume - baseline_basin_volume) * 0.001f; + + // 4. Update sea level + current_sea_level += ice_effect + thermal_effect + tectonic_effect; + current_sea_level = std::clamp(current_sea_level, -200.0f, +100.0f); // Realistic bounds + } + + float calculateIceVolume(float global_temp) const { + if (global_temp < -5.0f) return MAX_ICE_VOLUME; // Ice age + if (global_temp > 25.0f) return 0.0f; // No ice + return MAX_ICE_VOLUME * (25.0f - global_temp) / 30.0f; // Linear interpolation + } +}; +``` + +**Hydraulic Erosion System**: +```cpp +void applyHydraulicErosion(float cycle_duration_years) { + const float HYDRAULIC_EFFICIENCY = 10.0f; // 10x more effective than tectonic + + for (int y = 0; y < map_height; ++y) { + for (int x = 0; x < map_width; ++x) { + WorldTile tile = world_map->getTile(x, y); + float elevation = tile.getElevation(); + + if (elevation > current_sea_level) { + // CONTINENTAL EROSION + + // 1. Calculate water flow (slope-based) + float average_neighbor_elevation = calculateAverageNeighborElevation(x, y); + float slope = elevation - average_neighbor_elevation; + float water_flow = std::max(0.0f, slope * 0.01f); // Flow intensity + + // 2. Erosion rate based on elevation and flow + float elevation_factor = (elevation - current_sea_level) / 1000.0f; // Higher = more erosion + float erosion_rate = water_flow * elevation_factor * HYDRAULIC_EFFICIENCY; + + // 3. Apply erosion + float erosion_amount = erosion_rate * cycle_duration_years / 1000000.0f; // Per million years + tile.setElevation(elevation - erosion_amount); + + // 4. Transport sediments downstream + transportSediments(tile, x, y, erosion_amount); + + } else if (elevation > current_sea_level - 200.0f) { + // COASTAL EROSION + + float depth_below_sea = current_sea_level - elevation; + float coastal_erosion_rate = 50.0f; // Intense coastal erosion + + if (depth_below_sea < 50.0f) { // Shallow coastal zone + float erosion_amount = coastal_erosion_rate * cycle_duration_years / 1000000.0f; + tile.setElevation(elevation - erosion_amount); + + // Form beaches and deltas + if (hasRiverInput(x, y)) { + formDelta(tile, x, y); + } + } + + } else { + // DEEP OCEAN - sediment deposition + + float sedimentation_rate = calculateSedimentInput(x, y); + float deposition_amount = sedimentation_rate * cycle_duration_years / 1000000.0f; + tile.setElevation(elevation + deposition_amount); + } + } + } +} + +void transportSediments(WorldTile& source_tile, int x, int y, float sediment_amount) { + // Find steepest downhill direction + auto [target_x, target_y] = findSteepestDescentDirection(x, y); + + if (target_x != x || target_y != y) { + WorldTile target_tile = world_map->getTile(target_x, target_y); + + // Deposit sediments at target + float current_elevation = target_tile.getElevation(); + target_tile.setElevation(current_elevation + sediment_amount * 0.5f); // 50% deposition + + // Create river network + createRiverSegment(x, y, target_x, target_y); + + // Continue transport if target is above sea level + if (target_tile.getElevation() > current_sea_level) { + transportSediments(target_tile, target_x, target_y, sediment_amount * 0.5f); + } + } +} +``` + +**River Network Formation**: +```cpp +struct RiverNetwork { + std::unordered_map> river_connections; // tile -> downstream tiles + std::unordered_map flow_volumes; // tile -> water volume + + void createRiverSegment(int from_x, int from_y, int to_x, int to_y) { + uint32_t from_index = from_y * map_width + from_x; + uint32_t to_index = to_y * map_width + to_x; + + // Add connection + river_connections[from_index].push_back(to_index); + + // Increase flow volume + flow_volumes[to_index] += flow_volumes[from_index] + 1.0f; + + // Mark tiles as having river features + WorldTile from_tile = world_map->getTile(from_x, from_y); + WorldTile to_tile = world_map->getTile(to_x, to_y); + + from_tile.setFlag(TileFlags::HAS_RIVER, true); + to_tile.setFlag(TileFlags::HAS_RIVER, true); + } + + void formDelta(WorldTile& tile, int x, int y) { + // Delta formation where river meets ocean + RegionalInfluence delta_influence = { + .type = "river_delta", + .intensity = flow_volumes[y * map_width + x] / 100.0f, // Intensity based on river size + .properties = json{ + {"elevation_bonus", 10.0f}, // Slight elevation increase + {"sediment_richness", 1.5f}, // Rich sediments + {"features", json::array({"wetlands", "fertile_soil", "natural_harbors"})} + } + }; + + applyRegionalInfluence(delta_influence, x, y, 5.0f); // 5-tile radius + } +}; +``` + +**Climate Integration**: +```cpp +void updateGlobalClimate(float cycle_duration) { + // 1. Volcanic CO2 emissions + float volcanic_co2 = calculateVolcanicCO2Emissions(); + atmospheric_co2 += volcanic_co2; + + // 2. Weathering CO2 absorption + float weathering_absorption = calculateWeatheringRate() * cycle_duration; + atmospheric_co2 -= weathering_absorption; + + // 3. Temperature from CO2 (greenhouse effect) + global_temperature = BASE_TEMPERATURE + log(atmospheric_co2 / BASELINE_CO2) * CLIMATE_SENSITIVITY; + + // 4. Update sea level based on new temperature + ocean_level.updateSeaLevel(global_temperature, volcanic_co2); + + // 5. Regional climate effects + updateRegionalClimate(); +} + +void updateRegionalClimate() { + for (int y = 0; y < map_height; ++y) { + for (int x = 0; x < map_width; ++x) { + WorldTile tile = world_map->getTile(x, y); + float elevation = tile.getElevation(); + + // Temperature varies with elevation (lapse rate: -6.5°C/km) + float local_temperature = global_temperature - (elevation / 1000.0f) * 6.5f; + + // Distance from ocean affects temperature (continental effect) + float ocean_distance = calculateDistanceToOcean(x, y); + float continental_effect = ocean_distance / 1000.0f * 2.0f; // +2°C per 1000km inland + local_temperature += continental_effect; + + tile.setTemperature(local_temperature); + + // Humidity based on proximity to water and temperature + float humidity = calculateHumidity(ocean_distance, local_temperature, elevation); + tile.setHumidity(humidity); + } + } +} +``` + +**Expected Results**: +- Surface elevation: -5,000m → 0m (modern sea level) +- Formation of permanent river networks draining to oceans +- Coastal features: deltas, beaches, fjords, cliffs +- Climate zones established based on elevation and ocean proximity +- Sedimentary basins filled with eroded material + +### Phase 4: Carboniferous Period (35 cycles × 10M years = 0.35 Ga) + +**Dynamic Forest System**: +```cpp +// Forest seeds are continuously created and destroyed by geological events +void manageDynamicForests(GMap& map, int cycle) { + // Always seed new forests with base probability + seedNewForests(map); + + // Existing forests attempt to expand + expandExistingForests(map); + + // Geological events destroy forests + destroyForestsByGeologicalEvents(map, cycle); +} + +void seedNewForests(GMap& map) { + for (each_tile) { + float seed_probability = base_forest_seed_rate; + + // Environmental modifiers + if (tile.getTemperature() >= 15.0f && tile.getTemperature() <= 35.0f) { + seed_probability *= temperature_bonus; // Optimal temperature + } + if (tile.getHumidity() > 0.4f) { + seed_probability *= humidity_bonus; // Sufficient moisture + } + if (tile.getElevation() < 2000.0f) { + seed_probability *= elevation_bonus; // Below treeline + } + + if (random() < seed_probability) { + createForestSeed(tile); + } + } +} + +void expandExistingForests(GMap& map) { + for (each_forest_tile) { + for (each_neighbor) { + if (isViableForForest(neighbor) && random() < forest_expansion_rate) { + expandForestTo(neighbor); + } + } + } +} + +void destroyForestsByGeologicalEvents(GMap& map, int cycle) { + // Volcanic eruptions destroy forests + for (auto& volcanic_event : getCurrentVolcanicEvents(cycle)) { + destroyForestsInRadius(volcanic_event.center, volcanic_event.destruction_radius); + } + + // Major floods destroy forests + for (each_tile_with_extreme_water_level) { + if (tile.getWaterLevel() > flood_destruction_threshold) { + destroyForest(tile); + } + } + + // Extreme erosion destroys forests + for (each_tile) { + if (getCurrentErosionRate(tile) > erosion_destruction_threshold) { + destroyForest(tile); + } + } + + // Climate extremes destroy forests + if (tile.getTemperature() < -10.0f || tile.getTemperature() > 50.0f) { + destroyForest(tile); + } +} +``` + +**Carbon Region System**: +```cpp +struct CarbonRegion { + uint32_t region_id; + float center_x, center_y; // Position (world coordinates) + float radius; // Affected area (tiles) + float carbon_mass; // Total carbon content (megatons) + int formation_cycle; // When this region was created + CarbonType type; // Current state: COAL, OIL, GAS + + // Tectonic attachment + uint32_t attached_tectonic_region_id; // Moves with tectonic plate + float attachment_strength; // 0.8-1.0 (strong attachment) + + // Conversion tracking + float original_coal_mass; // Initial coal amount + float conversion_progress; // 0.0-1.0 (coal→oil conversion) + int cycles_underwater; // How long submerged +}; + +enum class CarbonType { + COAL, // Terrestrial formation + OIL, // Marine conversion + NATURAL_GAS // Late-stage oil maturation +}; +``` + +**Forest Growth and Coal Formation**: +```cpp +void processForestGrowth(int cycle) { + for (int y = 0; y < map_height; ++y) { + for (int x = 0; x < map_width; ++x) { + WorldTile tile = world_map->getTile(x, y); + + if (isForestSuitable(tile, x, y)) { + float biomass_potential = calculateBiomassPotential(tile); + float forest_density = std::min(1.0f, biomass_potential); + + if (forest_density > 0.3f) { // Minimum density for coal formation + // Create or enhance carbon region + CarbonRegion* existing_region = findNearestCarbonRegion(x, y, 5.0f); + + if (existing_region) { + // Add to existing region + enhanceCarbonRegion(*existing_region, forest_density); + } else { + // Create new carbon region + CarbonRegion new_region = createCarbonRegion(x, y, forest_density, cycle); + carbon_regions.push_back(new_region); + } + } + } + } + } + + // Merge nearby carbon regions + mergeCarbonRegions(); +} + +bool isForestSuitable(const WorldTile& tile, int x, int y) { + float elevation = tile.getElevation(); + float temperature = tile.getTemperature(); + float humidity = tile.getHumidity(); + + return (elevation > current_sea_level + 10.0f) && // Above sea level + (elevation < current_sea_level + 1000.0f) && // Not too mountainous + (temperature >= 10.0f && temperature <= 30.0f) && // Temperate range + (humidity > 0.4f) && // Sufficient moisture + (!tile.getFlag(TileFlags::VOLCANIC_ACTIVE)); // Not volcanically active +} + +CarbonRegion createCarbonRegion(int x, int y, float forest_density, int cycle) { + CarbonRegion region; + region.region_id = next_carbon_region_id++; + region.center_x = x; + region.center_y = y; + region.radius = forest_density * 8.0f; // Dense forests = larger regions + region.carbon_mass = forest_density * 100.0f; // Base carbon mass (megatons) + region.formation_cycle = cycle; + region.type = CarbonType::COAL; + + // Attach to nearest tectonic region + TectonicRegion* nearest_tectonic = findNearestTectonicRegion(x, y); + if (nearest_tectonic) { + region.attached_tectonic_region_id = nearest_tectonic->region_id; + region.attachment_strength = 0.9f; // Strong attachment + } + + return region; +} +``` + +**Carbon Region Movement and Merging**: +```cpp +void updateCarbonRegionMovement(float time_step) { + for (auto& carbon_region : carbon_regions) { + TectonicRegion* tectonic = getTectonicRegion(carbon_region.attached_tectonic_region_id); + + if (tectonic) { + // Move with tectonic plate + carbon_region.center_x += tectonic->velocity_x * carbon_region.attachment_strength * time_step; + carbon_region.center_y += tectonic->velocity_y * carbon_region.attachment_strength * time_step; + + // Handle tectonic collisions + if (tectonic->isInCollision()) { + float collision_stress = tectonic->getCollisionIntensity(); + + if (collision_stress > 2.0f) { + // High stress can redistribute carbon deposits + redistributeCarbonDeposit(carbon_region, collision_stress); + } + } + } + } +} + +void mergeCarbonRegions() { + for (size_t i = 0; i < carbon_regions.size(); ++i) { + for (size_t j = i + 1; j < carbon_regions.size(); ++j) { + float distance = calculateDistance(carbon_regions[i].center, carbon_regions[j].center); + float merge_threshold = (carbon_regions[i].radius + carbon_regions[j].radius) * 0.8f; + + if (distance < merge_threshold) { + // Merge regions + CarbonRegion merged; + merged.region_id = next_carbon_region_id++; + merged.center_x = (carbon_regions[i].center_x + carbon_regions[j].center_x) / 2.0f; + merged.center_y = (carbon_regions[i].center_y + carbon_regions[j].center_y) / 2.0f; + merged.radius = sqrt(carbon_regions[i].radius * carbon_regions[i].radius + + carbon_regions[j].radius * carbon_regions[j].radius); + merged.carbon_mass = carbon_regions[i].carbon_mass + carbon_regions[j].carbon_mass; + merged.formation_cycle = std::min(carbon_regions[i].formation_cycle, carbon_regions[j].formation_cycle); + merged.type = CarbonType::COAL; // Combined regions start as coal + + // Remove original regions and add merged + carbon_regions.erase(carbon_regions.begin() + j); + carbon_regions.erase(carbon_regions.begin() + i); + carbon_regions.push_back(merged); + + break; // Start over after modification + } + } + } +} +``` + +**Coal to Oil Conversion**: +```cpp +void processCoalToOilConversion(int current_cycle) { + const float CONVERSION_RATE_PER_CYCLE = 0.05f; // 5% per cycle (10M years) + const float NATURAL_GAS_RATIO = 0.15f; // 15% of oil becomes gas + + for (auto& coal_region : carbon_regions) { + if (coal_region.type == CarbonType::COAL && isRegionUnderwater(coal_region)) { + coal_region.cycles_underwater++; + + // Only convert if underwater for multiple cycles (pressure + time) + if (coal_region.cycles_underwater >= 3) { + float conversion_amount = coal_region.carbon_mass * CONVERSION_RATE_PER_CYCLE; + + if (conversion_amount > 1.0f) { // Minimum threshold + // Create oil region at same location + CarbonRegion oil_region = coal_region; + oil_region.region_id = next_carbon_region_id++; + oil_region.type = CarbonType::OIL; + oil_region.carbon_mass = conversion_amount; + oil_region.radius *= 0.8f; // Oil regions are more concentrated + oil_region.formation_cycle = current_cycle; + + // Create natural gas as byproduct + if (conversion_amount > 10.0f) { + CarbonRegion gas_region = oil_region; + gas_region.region_id = next_carbon_region_id++; + gas_region.type = CarbonType::NATURAL_GAS; + gas_region.carbon_mass = conversion_amount * NATURAL_GAS_RATIO; + gas_region.radius *= 1.2f; // Gas spreads more widely + + carbon_regions.push_back(gas_region); + } + + // Reduce original coal region + coal_region.carbon_mass -= conversion_amount; + coal_region.conversion_progress += CONVERSION_RATE_PER_CYCLE; + + // Add oil region + carbon_regions.push_back(oil_region); + + // Remove depleted coal regions + if (coal_region.carbon_mass < 1.0f) { + // Mark for removal + coal_region.carbon_mass = 0.0f; + } + } + } + } + } + + // Remove depleted regions + carbon_regions.erase( + std::remove_if(carbon_regions.begin(), carbon_regions.end(), + [](const CarbonRegion& region) { return region.carbon_mass < 1.0f; }), + carbon_regions.end() + ); +} + +bool isRegionUnderwater(const CarbonRegion& region) { + // Check if majority of region is below sea level + int underwater_tiles = 0; + int total_tiles = 0; + + int radius_int = static_cast(region.radius); + for (int dy = -radius_int; dy <= radius_int; ++dy) { + for (int dx = -radius_int; dx <= radius_int; ++dx) { + float distance = sqrt(dx*dx + dy*dy); + if (distance <= region.radius) { + int x = static_cast(region.center_x) + dx; + int y = static_cast(region.center_y) + dy; + + if (world_map->isValidCoordinate(x, y)) { + WorldTile tile = world_map->getTile(x, y); + total_tiles++; + + if (tile.getElevation() < current_sea_level - 50.0f) { // 50m underwater minimum + underwater_tiles++; + } + } + } + } + } + + return (static_cast(underwater_tiles) / total_tiles) > 0.6f; // 60% underwater +} +``` + +**Resource Application to Tiles**: +```cpp +void applyCarbonRegionsToTiles() { + for (const auto& region : carbon_regions) { + int radius_int = static_cast(region.radius); + + for (int dy = -radius_int; dy <= radius_int; ++dy) { + for (int dx = -radius_int; dx <= radius_int; ++dx) { + float distance = sqrt(dx*dx + dy*dy); + if (distance <= region.radius) { + int x = static_cast(region.center_x) + dx; + int y = static_cast(region.center_y) + dy; + + if (world_map->isValidCoordinate(x, y)) { + WorldTile tile = world_map->getTile(x, y); + float influence = 1.0f - (distance / region.radius); // Gradient from center + + // Apply resource based on carbon type + switch (region.type) { + case CarbonType::COAL: + addResourceToTile(tile, "coal", region.carbon_mass * influence); + break; + case CarbonType::OIL: + addResourceToTile(tile, "petroleum", region.carbon_mass * influence); + break; + case CarbonType::NATURAL_GAS: + addResourceToTile(tile, "natural_gas", region.carbon_mass * influence); + break; + } + } + } + } + } + } +} +``` + +**Expected Results**: +- **Dynamic forest evolution**: Forests continuously seed, expand, and get destroyed by geological events +- **Multiple forest generations**: Layers of carbon deposits from different geological periods +- **Realistic forest patterns**: Forests avoid active volcanic zones, extreme climates, and flood-prone areas +- **Coal deposit diversity**: Various ages and qualities of coal from different forest cycles +- **Oil formation**: Submerged forest areas naturally convert to petroleum over time +- **Geological storytelling**: Each coal seam represents a specific period of forest growth and burial + +### Phase 5: Pre-Faunal Stabilization (15 cycles × 10M years = 0.15 Ga) + +**Maturation-Only Phase - No New Formation**: +```cpp +void processStabilizationCycle(int cycle) { + // 1. HYDROCARBON MATURATION (no new formation) + continueHydrocarbonMaturation(); + + // 2. PETROLEUM MIGRATION TO TRAPS + migratePetroleumToGeologicalTraps(); + + // 3. FINAL EROSION PHASE + applyFinalErosion(); + + // 4. SOIL LAYER DEVELOPMENT + developSoilLayers(); + + // 5. CLIMATE STABILIZATION + stabilizeClimate(); + + // 6. GEOLOGICAL STRUCTURE FINALIZATION + finalizeGeologicalStructures(); +} +``` + +**Continued Hydrocarbon Maturation**: +```cpp +void continueHydrocarbonMaturation() { + const float REDUCED_CONVERSION_RATE = 0.03f; // Slower than Carboniferous (3% per cycle) + + for (auto& coal_region : carbon_regions) { + if (coal_region.type == CarbonType::COAL && isRegionUnderwater(coal_region)) { + // Continue coal→oil conversion at reduced rate + float conversion_amount = coal_region.carbon_mass * REDUCED_CONVERSION_RATE; + + if (conversion_amount > 0.5f) { // Lower threshold for final conversion + processCoalToOilConversion(coal_region, conversion_amount); + } + } + } + + // Oil→Gas maturation for old oil deposits + for (auto& oil_region : carbon_regions) { + if (oil_region.type == CarbonType::OIL) { + int oil_age = current_cycle - oil_region.formation_cycle; + + if (oil_age > 10 && oil_region.carbon_mass > 5.0f) { // Mature oil deposits + float gas_conversion = oil_region.carbon_mass * 0.02f; // 2% oil→gas + + createNaturalGasFromOil(oil_region, gas_conversion); + } + } + } +} +``` + +**Petroleum Migration to Geological Traps**: +```cpp +struct GeologicalTrap { + float center_x, center_y; + float capacity; // Maximum hydrocarbon storage + float current_fill; // Current hydrocarbon content + TrapType type; // ANTICLINE, FAULT, SALT_DOME, STRATIGRAPHIC + float formation_cycle; // When trap was formed +}; + +enum class TrapType { + ANTICLINE, // Upward fold in rock layers + FAULT_TRAP, // Hydrocarbon blocked by fault + SALT_DOME, // Hydrocarbon trapped around salt intrusion + STRATIGRAPHIC // Trapped between different rock types +}; + +void migratePetroleumToGeologicalTraps() { + // 1. Identify geological traps from tectonic history + std::vector traps = identifyGeologicalTraps(); + + // 2. Migrate oil and gas to nearest suitable traps + for (auto& hydrocarbon_region : carbon_regions) { + if (hydrocarbon_region.type == CarbonType::OIL || hydrocarbon_region.type == CarbonType::NATURAL_GAS) { + GeologicalTrap* nearest_trap = findNearestTrap(hydrocarbon_region, traps); + + if (nearest_trap && nearest_trap->current_fill < nearest_trap->capacity) { + float migration_amount = calculateMigrationAmount(hydrocarbon_region, *nearest_trap); + + // Move hydrocarbons to trap + nearest_trap->current_fill += migration_amount; + hydrocarbon_region.carbon_mass -= migration_amount; + + // Concentrate hydrocarbons in trap location + concentrateHydrocarbonsAtTrap(*nearest_trap, hydrocarbon_region.type, migration_amount); + } + } + } +} + +std::vector identifyGeologicalTraps() { + std::vector traps; + + // Find anticlines (upward folds) from tectonic compression + for (const auto& tectonic_region : tectonic_regions) { + if (tectonic_region.type == RegionType::CONTINENTAL) { + // Look for elevation highs within the region (potential anticlines) + auto high_points = findElevationHighsInRegion(tectonic_region); + + for (const auto& point : high_points) { + GeologicalTrap anticline = { + .center_x = point.x, + .center_y = point.y, + .capacity = calculateAnticlineCapacity(point), + .current_fill = 0.0f, + .type = TrapType::ANTICLINE, + .formation_cycle = tectonic_region.formation_cycle + }; + traps.push_back(anticline); + } + } + } + + // Find fault traps from tectonic collisions + for (const auto& collision_zone : historical_tectonic_collisions) { + GeologicalTrap fault_trap = { + .center_x = collision_zone.center_x, + .center_y = collision_zone.center_y, + .capacity = collision_zone.intensity * 50.0f, // Capacity based on collision intensity + .current_fill = 0.0f, + .type = TrapType::FAULT_TRAP, + .formation_cycle = collision_zone.formation_cycle + }; + traps.push_back(fault_trap); + } + + return traps; +} +``` + +**Final Erosion and Surface Formation**: +```cpp +void applyFinalErosion() { + const float FINAL_EROSION_RATE = 5.0f; // Reduced from active hydrological phase + + for (int y = 0; y < map_height; ++y) { + for (int x = 0; x < map_width; ++x) { + WorldTile tile = world_map->getTile(x, y); + float elevation = tile.getElevation(); + + if (elevation > current_sea_level) { + // Expose coal seams through erosion + exposeCoalSeams(tile, x, y); + + // Carve final river valleys + carveRiverValleys(tile, x, y); + + // Form final coastal features + if (elevation < current_sea_level + 100.0f) { // Coastal zone + formCoastalFeatures(tile, x, y); + } + } + } + } +} + +void exposeCoalSeams(WorldTile& tile, int x, int y) { + // Check if there are coal deposits below current elevation + CarbonRegion* coal_region = findCoalRegionAt(x, y); + + if (coal_region && coal_region->type == CarbonType::COAL) { + float erosion_depth = calculateErosionDepth(tile); + + if (erosion_depth > 50.0f) { // Significant erosion + // Expose coal seam at surface + tile.setFlag(TileFlags::SURFACE_COAL, true); + + // Add surface coal resource + addResourceToTile(tile, "surface_coal", coal_region->carbon_mass * 0.1f); + } + } +} +``` + +**Soil Development System**: +```cpp +void developSoilLayers() { + for (int y = 0; y < map_height; ++y) { + for (int x = 0; x < map_width; ++x) { + WorldTile tile = world_map->getTile(x, y); + + if (tile.getElevation() > current_sea_level + 5.0f) { // Above sea level + SoilType soil = determineSoilType(tile, x, y); + float soil_depth = calculateSoilDepth(tile, x, y); + + // Apply soil influence + RegionalInfluence soil_influence = { + .type = "soil_development", + .intensity = soil_depth / 10.0f, // Depth in meters / 10 + .properties = json{ + {"soil_type", getSoilTypeName(soil)}, + {"fertility", calculateSoilFertility(soil, tile)}, + {"drainage", calculateSoilDrainage(soil, tile)}, + {"ph_level", calculateSoilPH(soil, tile)} + } + }; + + applyRegionalInfluence(soil_influence, x, y, 1.0f); + } + } + } +} + +enum class SoilType { + CLAY, // Heavy, nutrient-rich, poor drainage + SAND, // Light, good drainage, low nutrients + LOAM, // Balanced, ideal for agriculture + PEAT, // Organic-rich, acidic, wetland areas + ROCKY, // Thin soil, mountainous areas + ALLUVIAL // River deposits, very fertile +}; + +SoilType determineSoilType(const WorldTile& tile, int x, int y) { + float elevation = tile.getElevation(); + float temperature = tile.getTemperature(); + float humidity = tile.getHumidity(); + + // River deltas and floodplains + if (tile.getFlag(TileFlags::HAS_RIVER) && elevation < current_sea_level + 50.0f) { + return SoilType::ALLUVIAL; + } + + // Wetland areas + if (humidity > 0.8f && elevation < current_sea_level + 20.0f) { + return SoilType::PEAT; + } + + // Mountainous areas + if (elevation > current_sea_level + 1000.0f) { + return SoilType::ROCKY; + } + + // Climate-based soil formation + if (temperature > 20.0f && humidity < 0.3f) { + return SoilType::SAND; // Arid regions + } else if (temperature < 10.0f && humidity > 0.6f) { + return SoilType::CLAY; // Cold, wet regions + } else { + return SoilType::LOAM; // Temperate regions + } +} +``` + +**Final Climate Stabilization**: +```cpp +void stabilizeClimate() { + // Reduce climate variability and volcanic activity + volcanic_activity_level *= 0.8f; // 20% reduction per cycle + climate_stability += 0.1f; // Increase stability + + // Establish final climate zones + for (int y = 0; y < map_height; ++y) { + for (int x = 0; x < map_width; ++x) { + WorldTile tile = world_map->getTile(x, y); + + ClimateZone zone = determineClimateZone(tile, x, y); + applyClimateZone(tile, zone); + } + } +} + +enum class ClimateZone { + ARCTIC, // < -10°C, low precipitation + SUBARCTIC, // -10 to 0°C, moderate precipitation + TEMPERATE, // 0 to 20°C, variable precipitation + SUBTROPICAL, // 20 to 30°C, high precipitation + TROPICAL, // > 30°C, very high precipitation + ARID, // Any temperature, very low precipitation + MEDITERRANEAN // Warm, dry summers, mild wet winters +}; +``` + +**Final Geological State**: +```cpp +struct FinalGeologicalState { + // TERRAIN + ✅ stable_continents; // Continental masses established + ✅ ocean_basins; // Deep ocean basins + ✅ mountain_ranges; // Various ages, realistic erosion + ✅ river_networks; // Mature drainage systems + ✅ coastal_features; // Beaches, cliffs, deltas, fjords + + // RESOURCES + ✅ coal_deposits; // Continental basins, exposed seams + ✅ oil_fields; // Sedimentary basins, geological traps + ✅ natural_gas; // Associated with oil, separate fields + ✅ metal_deposits; // From meteorite impacts and volcanism + + // CLIMATE + ✅ climate_zones; // Stable temperature/precipitation patterns + ✅ soil_types; // Mature soil development + ✅ seasonal_patterns; // Established weather cycles + + // READY FOR INDUSTRIAL GAMEPLAY + ✅ resource_accessibility; // Surface coal, shallow oil, metal ores + ✅ transportation_routes; // Rivers, coastal access, terrain variety + ✅ strategic_locations; // Resource clusters, defensive positions + ✅ environmental_challenges; // Climate zones, terrain obstacles +}; +``` + +**Expected Results**: +- **Complete geological maturity**: All major processes stabilized +- **Industrial-ready resources**: Coal seams exposed, oil in accessible traps +- **Realistic geography**: Mountain ranges, river valleys, coastal plains +- **Climate diversity**: Multiple biomes and environmental conditions +- **Strategic complexity**: Resource distribution creates interesting gameplay choices +- **Historical coherence**: Geological features tell the story of planetary formation + +## Phase 6: Climate Simulation and Biome Generation + +### Overview +After geological stabilization, run advanced climate simulation using mobile WindRegions and Inter-Tropical Convergence Zones (ITCZ) to establish realistic temperature, humidity, and wind patterns. Creates emergent weather patterns through wind region interactions rather than predefined climate zones. + +**Key Innovation**: Revolutionary climate simulation using **mobile wind regions** that spawn, evolve, and interact to create emergent weather patterns. Solves the "Sahara vs Congo" problem through **Inter-Tropical Convergence Zones (ITCZ)** and **planetary rotation bands** without complex 3D atmospheric physics. + +### Climate Simulation Architecture + +**Phase 6.1: Landmass Analysis and ITCZ Generation** + +Uses existing TectonicRegions from Phase 2: +```cpp +// Analyze continental masses from existing tectonic data +std::vector continents = groupTectonicRegions(); + +// Generate water masses by inverse analysis +std::vector oceans = detectOceanBasins(continents); + +// Place ITCZ zones on qualifying equatorial landmasses +for (auto& continent : continents) { + if (continent.latitude >= 0.45 && continent.latitude <= 0.55 && + continent.area > MIN_LANDMASS_SIZE) { + createITCZ(continent.center, sqrt(continent.area)); + } +} +``` + +**ITCZ Requirements:** +- **Latitude Band**: 45-55% of map height (equatorial) +- **Minimum Landmass**: 10,000+ tiles +- **Ocean Proximity**: Within 800km for moisture source +- **Continental Heating**: Large thermal mass for convection + +**Phase 6.2: WindRegion Spawning System** + +Mobile WindRegions spawn from ocean masses: +```json +"wind_spawn_system": { + "spawn_locations": "ocean_masses_only", + "spawn_frequency": "water_mass_size / 1000", + "initial_strength": "water_temperature * evaporation_factor", + "spawn_distribution": "random_within_water_region_biased_toward_center" +} +``` + +**WindRegion Mobile Entities:** +```json +"wind_region": { + "position": [x, y], + "wind_strength": 1.0, // Base intensity (decays over time) + "wetness": 0.0, // Moisture content (gained over ocean) + "velocity": [vx, vy], // Movement vector + "wind_tokens": 100, // Distributed to tiles + "decay_per_move": 0.02, // -2% strength per movement + "decay_per_tile": 0.01 // -1% strength per tile crossed +} +``` + +**Phase 6.3: Movement and Planetary Circulation** + +Planetary rotation bands based on real atmospheric data: +```json +"planetary_circulation": { + "polar_jet_north": { + "latitude_range": [0.10, 0.25], + "direction": "west_to_east", + "strength": 1.8 + }, + "equatorial_trades": { + "latitude_range": [0.40, 0.60], + "direction": "east_to_west", + "strength": 1.5 + }, + "polar_jet_south": { + "latitude_range": [0.75, 0.95], + "direction": "west_to_east", + "strength": 1.8 + } +} +``` + +**Movement Calculation:** +```cpp +Vector2 movement = + planetary_rotation_band * 0.6 + // 60% planetary circulation + equator_to_pole_bias * 0.2 + // 20% thermal circulation + terrain_deflection * 0.1 + // 10% topographic influence + random_variation * 0.1; // 10% chaos +``` + +**Phase 6.4: WindRegion Evolution and Interactions** + +Dynamic evolution with ITCZ gravitational effects: +```cpp +void updateWindRegion(WindRegion& region) { + // Gain moisture over water + if (currentTile.isOcean()) { + region.wetness += OCEAN_MOISTURE_GAIN; + } + + // Repulsion from other regions = acceleration + // NOTE: Not physical repulsion - proxy for spatial competition and turbulence + // Prevents region stacking while creating realistic dispersion patterns + // CRITIQUE POINT: May cause "force field" effect around ITCZ zones where regions + // oscillate/scatter instead of converging due to attraction vs repulsion conflict. + // Alternative approaches: density-based drift, no interaction, or collision division. + // TODO: Implement as configurable algorithm options for empirical testing. + float repulsion = calculateRepulsionForce(region, nearbyRegions); + region.wind_strength += repulsion * ACCELERATION_FACTOR; + + // Movement decay + region.wind_strength *= (1.0 - DECAY_PER_MOVE); + + // Die when too weak + if (region.wind_strength < MINIMUM_THRESHOLD) { + destroyRegion(region); + } +} +``` + +**ITCZ Gravitational Effects:** +```cpp +void applyITCZGravity(WindRegion& region) { + for (auto& itcz : active_itcz_zones) { + float distance = calculateDistance(region.position, itcz.center); + + if (distance < itcz.gravitational_range) { + // Attraction force (inverse square law) + // NOTE: "Gravitational" metaphor for influence strength, not literal physics + // Like saying someone has "gravitas" - clear semantic meaning for developers + float attraction = itcz.mass / (distance * distance); + Vector2 pull_direction = normalize(itcz.center - region.position); + + // Apply attraction + region.velocity += pull_direction * attraction; + + // Amplification effect as region approaches + float proximity = (itcz.range - distance) / itcz.range; + float amplification = 1.0 + (itcz.max_amplification * proximity); + + region.wind_strength *= amplification; + region.wetness *= amplification; + } + } +} +``` + +**Phase 6.5: Token Distribution and Climate Zone Formation** + +Climate zone classification using token accumulation: +```cpp +void distributeTokens(WindRegion& region) { + // Basic climate tokens for all regions + int wind_tokens = static_cast(region.wind_strength * 10); + int rain_tokens = static_cast(region.wetness * 10); + + WorldTile& tile = world_map.getTile(region.position); + tile.addTokens("wind", wind_tokens); + tile.addTokens("rain", rain_tokens); + + // Special climate zone tokens for extreme weather + if (isHighWindZone(region)) { + tile.addTokens("highWind", 1); // Hostile to forests + } + if (isFloodZone(region)) { + tile.addTokens("flood", 1); // Forces wetlands/marshes + } + if (isHurricaneZone(region)) { + tile.addTokens("hurricane", 1); // Specialized hurricane biome + } +} +``` + +### Climate Zone Effects on Biome Generation + +**Token-Based Biome Classification:** +```cpp +BiomeType classifyBiome(const WorldTile& tile) { + int total_rain = tile.getAccumulatedTokens("rain"); + int total_wind = tile.getAccumulatedTokens("wind"); + int highWind_tokens = tile.getAccumulatedTokens("highWind"); + int flood_tokens = tile.getAccumulatedTokens("flood"); + int hurricane_tokens = tile.getAccumulatedTokens("hurricane"); + + // Special climate zones override normal biome classification + if (hurricane_tokens > 0) { + return BiomeType::HURRICANE_ZONE; // Specialized storm-resistant vegetation + } + if (flood_tokens > FLOOD_THRESHOLD) { + return BiomeType::WETLANDS; // Forced marshes/swamps + } + if (highWind_tokens > STORM_THRESHOLD) { + // High wind prevents forest growth + if (total_rain > 300) { + return BiomeType::STORM_PRAIRIE; // Grasslands that can handle wind + } else { + return BiomeType::BADLANDS; // Sparse, wind-resistant vegetation + } + } + + // Normal biome classification using basic rain/wind tokens + if (total_rain > 500) { + return BiomeType::TROPICAL_RAINFOREST; + } else if (total_rain < 50) { + return BiomeType::HOT_DESERT; + } + // ... additional normal biome logic +} +``` + +**Climate Zone Characteristics:** +- **Hurricane Zones** → Storm-resistant palms, specialized coastal vegetation +- **Flood Zones** → Wetlands, marshes, swamp vegetation mandatory +- **High Wind Zones** → No forests allowed, prairie/badlands only +- **Normal Zones** → Standard biome classification by rain/temperature + +### Geographic Climate Patterns + +**Realistic Climate Formation Examples:** + +**Congo Basin (Rainforest):** +``` +1. Large African landmass → Strong ITCZ at equator +2. Atlantic wind regions spawn → Move east via trade winds +3. ITCZ aspiration → Convergence at Congo → Amplification ×3 +4. Super-humid storms → Massive rain token distribution +5. Result: Dense rainforest biome +``` + +**Sahara Desert:** +``` +1. Sahara latitude (25-35°N) → Outside ITCZ band +2. No convergence zone → Wind regions pass through +3. Continental distance → Low initial moisture +4. Subtropical high pressure → Air descends (simulated via movement patterns) +5. Result: Minimal rain tokens → Desert biome +``` + +### Configuration Integration + +**Climate Configuration (Hot-Reloadable):** +```json +{ + "climate_simulation": { + "wind_spawn_system": { + "base_spawn_rate": 0.1, + "ocean_size_factor": 0.001, + "max_concurrent_regions": 200 + }, + "planetary_circulation": { + "trade_winds_strength": 1.5, + "jet_stream_strength": 1.8, + "calm_zone_chaos": 0.3 + }, + "itcz_system": { + "latitude_band": [0.45, 0.55], + "min_landmass_size": 10000, + "max_ocean_distance": 800, + "amplification_max": 3.0 + }, + "storm_thresholds": { + "high_wind_min": 2.0, + "flood_wetness_min": 1.5, + "hurricane_wind_min": 2.5, + "hurricane_rain_min": 2.0 + } + } +} +``` + +**Note**: All parameters are hot-reloadable via the modular configuration system. Magic numbers are intentionally externalizable for real-time tuning during development - adjust values, save config, see immediate results without recompilation. + +### Performance Characteristics + +**Computational Complexity:** +- **Wind Regions**: O(n) for n active regions (~50-200 simultaneously) +- **ITCZ Calculations**: O(m) for m convergence zones (~5-15 globally) +- **Token Distribution**: O(tiles_visited) per region movement +- **Total per cycle**: O(n × average_movement_distance) + +**Memory Usage:** +- **WindRegion**: 32 bytes per region +- **ITCZ Zone**: 24 bytes per zone +- **Token accumulation**: Uses existing tile data structure +- **Estimated total**: <5MB for global weather simulation + +**Generation Time:** +- **Landmass analysis**: 1-2 seconds (one-time setup) +- **Per simulation cycle**: 10-50ms for 100-200 wind regions +- **Full climate stabilization**: 100-500 cycles → 10-30 seconds total + +## Phase 7: Budget Assignment and Natural Features + +### Random Budget Assignment (Normal Distribution) + +After climate and hydrology stabilization, assign budget scores to each tile using a bell curve distribution: + +```cpp +void assignBudgetScores(GMap& map) { + std::random_device rd; + std::mt19937 gen(rd()); + std::normal_distribution budget_dist(0.0f, 3.0f); // Mean=0, σ=3 + + for (int y = 0; y < map.getHeight(); y++) { + for (int x = 0; x < map.getWidth(); x++) { + float budget_value = budget_dist(gen); + int8_t budget = static_cast(std::clamp(budget_value, -10.0f, 10.0f)); + + WorldTile tile = map.getTile(x, y); + tile.setTargetBudgetScore(budget); + } + } +} +``` + +**Budget Distribution:** +- **68%** of tiles: budget score -3 to +3 +- **95%** of tiles: budget score -6 to +6 +- **Rare extremes**: -10/-9 and +9/+10 scores for unique locations + +### Natural Features Placement (Uniform Random) + +Place natural geological features randomly across the map with uniform distribution: + +```cpp +void placeNaturalFeatures(GMap& map, FeatureManager& feature_manager) { + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_real_distribution prob_dist(0.0f, 1.0f); + + const float FEATURE_CHANCE = 0.05f; // 5% of tiles get features + + for (int y = 0; y < map.getHeight(); y++) { + for (int x = 0; x < map.getWidth(); x++) { + if (prob_dist(gen) < FEATURE_CHANCE) { + // Natural features from gameData configuration + std::vector available_features = { + "cave", "hot_spring", "canyon", "plateau", + "marsh", "oasis", "geyser", "cliff", "gorge", + "natural_bridge", "sinkhole", "spring" + }; + + std::uniform_int_distribution feature_dist(0, available_features.size() - 1); + std::string feature = available_features[feature_dist(gen)]; + + feature_manager.placeFeature(feature, x, y); + } + } + } +} +``` + +## Phase 8: Resource Region Conversion + +### Regional Influence to Resource Features + +Convert abstract regional influences from geological simulation into concrete resource features on the map: + +```cpp +void convertRegionsToFeatures(GMap& map, FeatureManager& feature_manager) { + std::random_device rd; + std::mt19937 gen(rd()); + + for (auto& region : map.getRegionalInfluences()) { + // Semi-random feature count per region (1-8 features) + std::uniform_int_distribution feature_count_dist(1, 8); + int feature_count = feature_count_dist(gen); + + for (int i = 0; i < feature_count; i++) { + // Random position within region radius + auto [x, y] = getRandomPositionInRegion(region); + + // Region influence strength determines feature quality + float distance = getDistanceFromCenter(region, x, y); + float influence_strength = region.getInfluenceAt(distance); + + // Place appropriate features based on region type + placeRegionalFeature(region, x, y, influence_strength, feature_manager); + } + } +} + +void placeRegionalFeature(const RegionalInfluence& region, int x, int y, + float strength, FeatureManager& feature_manager) { + + if (region.getType() == "tectonic_plate") { + // Tectonic regions: metal deposits + if (strength > 0.8f) { + feature_manager.placeFeature("rich_iron_ore", x, y); + } else if (strength > 0.6f) { + feature_manager.placeFeature("copper_deposit", x, y); + } else if (strength > 0.4f) { + feature_manager.placeFeature("tin_deposit", x, y); + } else { + feature_manager.placeFeature("stone_quarry", x, y); + } + } + + else if (region.getType() == "carbon_region") { + // Carbon regions: coal and oil deposits + if (strength > 0.7f) { + feature_manager.placeFeature("rich_coal_seam", x, y); + } else if (strength > 0.5f) { + feature_manager.placeFeature("oil_well", x, y); + } else if (strength > 0.3f) { + feature_manager.placeFeature("coal_outcrop", x, y); + } else { + feature_manager.placeFeature("peat_bog", x, y); + } + } + + else if (region.getType() == "volcanic_zone") { + // Volcanic regions: geothermal and rare minerals + if (strength > 0.8f) { + feature_manager.placeFeature("geothermal_vent", x, y); + } else if (strength > 0.6f) { + feature_manager.placeFeature("sulfur_deposit", x, y); + } else if (strength > 0.4f) { + feature_manager.placeFeature("obsidian_field", x, y); + } else { + feature_manager.placeFeature("hot_spring", x, y); + } + } + + else if (region.getType() == "recent_meteorite_crater") { + // Recent meteorite impacts: rare metals and exotic materials + // NOTE: Different from Phase 1 planetary accretion meteorites + if (strength > 0.9f) { + feature_manager.placeFeature("platinum_deposit", x, y); + } else if (strength > 0.7f) { + feature_manager.placeFeature("rare_earth_deposit", x, y); + } else if (strength > 0.5f) { + feature_manager.placeFeature("gold_vein", x, y); + } else { + feature_manager.placeFeature("impact_glass", x, y); + } + } +} + +std::pair getRandomPositionInRegion(const RegionalInfluence& region) { + std::random_device rd; + std::mt19937 gen(rd()); + + // Random angle and distance within region radius + std::uniform_real_distribution angle_dist(0.0f, 2.0f * M_PI); + std::uniform_real_distribution radius_dist(0.0f, region.getRadius()); + + float angle = angle_dist(gen); + float distance = radius_dist(gen); + + int x = static_cast(region.getCenterX() + distance * cos(angle)); + int y = static_cast(region.getCenterY() + distance * sin(angle)); + + return {x, y}; +} +``` + +### Resource Feature Characteristics + +**Influence Strength Distribution:** +- **0.8-1.0**: Premium resources (rich deposits, rare materials) +- **0.6-0.8**: High-quality resources (standard industrial deposits) +- **0.4-0.6**: Medium-quality resources (adequate for basic industry) +- **0.2-0.4**: Low-quality resources (marginal extraction) +- **0.0-0.2**: Minimal resources (trace amounts only) + +**Regional Resource Mapping:** +- **Tectonic Regions**: Iron, copper, tin, stone → Industrial base materials +- **Carbon Regions**: Coal, oil, peat → Energy resources +- **Volcanic Zones**: Geothermal, sulfur, obsidian → Specialized materials +- **Recent Meteorite Craters**: Platinum, rare earths, gold → Advanced technology materials + +**Feature Distribution:** +- **1-8 features per region** (semi-random count) +- **Position**: Random within region radius +- **Quality**: Determined by distance from region center (closer = better) +- **Type**: Fixed by region type, quality by influence strength + +## Planetary Mass Conservation System + +### Core-Based Mass Conservation + +To maintain realistic mass conservation throughout geological simulation, the system uses a planetary core that absorbs eroded material and releases it through volcanic activity: + +```cpp +struct PlanetaryCore { + float core_mass; // Accumulated eroded material + float surface_mass; // Current surface terrain mass + float max_core_capacity; // Core saturation threshold + float volcanic_overflow_rate; // Rate of volcanic material expulsion (0.1-0.3) + float total_planetary_mass; // Constant after Phase 1 (meteorite bombardment) + + // Derived values + float core_pressure_ratio; // core_mass / max_core_capacity + int pending_volcanic_events; // Queued volcanic eruptions +}; + +void updateMassConservation(PlanetaryCore& core) { + // Validation: Total mass conservation + assert(core.core_mass + core.surface_mass == core.total_planetary_mass); + + // Core overflow triggers volcanic activity + if (core.core_mass > core.max_core_capacity) { + float overflow = core.core_mass - core.max_core_capacity; + float volcanic_expulsion = overflow * core.volcanic_overflow_rate; + + // Transfer mass from core to pending volcanic events + core.core_mass -= volcanic_expulsion; + + // Queue volcanic events proportional to overflow + int new_volcanic_events = static_cast(volcanic_expulsion / volcanic_event_mass_threshold); + core.pending_volcanic_events += new_volcanic_events; + + // Store remaining material for future volcanism + core.pending_volcanic_material += volcanic_expulsion; + } +} +``` + +### Erosion to Core Transfer + +All erosion processes transfer material to the planetary core rather than redistributing on surface: + +```cpp +void erodeToCore(WorldTile& tile, float erosion_amount, PlanetaryCore& core) { + // Remove material from surface + float current_elevation = tile.getElevation(); + tile.setElevation(current_elevation - erosion_amount); + + // Transfer to planetary core + core.core_mass += erosion_amount; + core.surface_mass -= erosion_amount; + + // Track erosion for geological history + tile.addFlag(TileFlags::ERODED_THIS_CYCLE); +} + +// Apply to all erosion processes +void riverErosion(WorldTile& tile, float water_flow, PlanetaryCore& core) { + if (water_flow > erosion_threshold) { + float erosion_amount = water_flow * erosion_rate_factor; + erodeToCore(tile, erosion_amount, core); + } +} + +void glacialErosion(WorldTile& tile, float ice_thickness, PlanetaryCore& core) { + float erosion_amount = ice_thickness * glacial_erosion_factor; + erodeToCore(tile, erosion_amount, core); +} +``` + +### Volcanic Overflow System + +Core overflow creates realistic volcanic activity that returns material to surface: + +```cpp +void processVolcanicOverflow(GMap& map, PlanetaryCore& core) { + while (core.pending_volcanic_events > 0) { + // Select volcanic location based on geological factors + auto [x, y] = selectVolcanicLocation(map); + + // Calculate eruption magnitude + float eruption_material = core.pending_volcanic_material / core.pending_volcanic_events; + + // Create volcanic eruption + createVolcanicEruption(map, x, y, eruption_material); + + // Update core state + core.surface_mass += eruption_material; + core.pending_volcanic_material -= eruption_material; + core.pending_volcanic_events--; + } +} + +std::pair selectVolcanicLocation(const GMap& map) { + // Prefer locations with: + // - Active tectonic boundaries + // - Existing volcanic history + // - High core pressure influence + + std::vector> candidate_locations; + + for (auto& tectonic_region : map.getTectonicRegions()) { + if (tectonic_region.getActivity() > volcanic_activity_threshold) { + // Add boundary tiles as candidates + auto boundary_tiles = tectonic_region.getBoundaryTiles(); + candidate_locations.insert(candidate_locations.end(), + boundary_tiles.begin(), boundary_tiles.end()); + } + } + + // Weight by distance from core pressure points + return selectWeightedRandom(candidate_locations); +} + +void createVolcanicEruption(GMap& map, int center_x, int center_y, float material_amount) { + // Deposit material in volcanic pattern + int eruption_radius = static_cast(sqrt(material_amount / volcanic_density_factor)); + + for (int dy = -eruption_radius; dy <= eruption_radius; dy++) { + for (int dx = -eruption_radius; dx <= eruption_radius; dx++) { + float distance = sqrt(dx*dx + dy*dy); + if (distance <= eruption_radius) { + int x = center_x + dx; + int y = center_y + dy; + + if (map.isValidCoordinate(x, y)) { + // Volcanic deposition decreases with distance + float deposition_factor = 1.0f - (distance / eruption_radius); + float local_deposition = material_amount * deposition_factor / (M_PI * eruption_radius * eruption_radius); + + WorldTile tile = map.getTile(x, y); + tile.setElevation(tile.getElevation() + local_deposition); + + // Mark as volcanic terrain + tile.setFlag(TileFlags::VOLCANIC_DEPOSIT, true); + } + } + } + } +} +``` + +### Mass Conservation Benefits + +**Perfect Conservation:** +- Total planetary mass remains constant after Phase 1 +- All eroded material is accounted for in core +- Volcanic activity returns material to surface +- No material created or destroyed + +**Realistic Geological Activity:** +- Core pressure drives continuing volcanism +- Volcanic activity decreases as core pressure reduces +- Natural equilibrium between erosion and volcanic deposition +- Geological activity persists throughout simulation + +**Simplified Implementation:** +- No complex sediment transport calculations +- No surface redistribution algorithms +- Single mass conservation equation +- Volcanic activity emerges naturally from core overflow + +**Gameplay Benefits:** +- Ongoing geological activity creates dynamic world +- Volcanic regions provide unique resource opportunities +- Erosion/volcanism balance creates varied topography +- Long-term geological processes affect industrial planning + +## Technical Architecture + +### WorldTileData Structure (32 bytes) +```cpp +struct WorldTileData { + // Terrain (11 bytes) - Always accessed, geological simulation ready + uint16_t terrain_type_id; // 65k terrain types + uint16_t biome_type_id; // Biome classification + uint16_t elevation; // -11km to +32km range + int16_t temperature; // -3276°C to +3276°C (0.1°C precision) + uint8_t humidity; // 0-100% (0.4% precision) + uint8_t wind_data; // 4 bits direction + 4 bits intensity + uint8_t water_level; // Accumulated water for river formation + + // Metadata (21 bytes) - Generation and gameplay + int8_t target_budget_score; // -10 to +10 + uint32_t regional_influence_id; // → Regional influence data + uint8_t influence_strength; // 0-255 + uint32_t tile_flags; // State flags + uint32_t feature_set_id; // → Feature collection + uint8_t padding2[7]; // Future expansion space +}; +``` + +### RegionalInfluence System +- **TectonicRegions**: Mobile circular regions with physics +- **CarbonRegions**: Carbon deposit tracking with tectonic attachment +- **VolcanicZones**: Created dynamically at tectonic collisions +- **SeaLevelInfluence**: Global parameter affecting all processes + +### FeatureManager Integration +- Simple helper interface for placing geological features +- Handles feature set creation and tile updates automatically +- Used by generation algorithms, doesn't do generation itself + +## Performance Characteristics + +### Memory Usage +- **1M tiles**: 32MB core tile data (increased from 24MB for hydrology) +- **Feature sets**: Sparse, shared between similar tiles +- **Geological regions**: ~10-50 regions vs millions of tiles +- **Climate wind regions**: ~50-200 mobile regions during simulation +- **Total estimated**: <125MB for complete planetary geology + advanced climate simulation + +### Computational Complexity +- **Tectonic simulation**: O(n²) for n regions (~25 regions = 625 operations) +- **Meteorite impacts**: O(k) for k impacts per wave +- **Sea level effects**: O(tiles) single pass +- **Carbon processes**: O(regions) sparse operations +- **Climate simulation**: O(n × movement_distance) for n wind regions (~50-200 regions) + +### Generation Time +- **Geological phases**: 10-20 seconds for complete 4.65 billion year simulation +- **Climate simulation**: 10-30 seconds for 100-500 climate cycles +- **Total estimated**: 20-50 seconds for complete world generation +- **Progressive**: Can display intermediate results during generation +- **Deterministic**: Same seed produces identical geology and climate + +## Implementation Priority + +### Phase 1: Core Architecture (1-2 weeks) +1. RegionalInfluence and RegionalInfluenceManager classes +2. TectonicRegion basic structure and physics +3. Simple meteorite impact system +4. Basic tile elevation/temperature updates + +### Phase 2: Full Geology (2-3 weeks) +1. Complete tectonic interaction system +2. Dynamic sea level integration +3. Carbon region formation and conversion +4. Volcanic zone creation + +### Phase 3: Polish (1-2 weeks) +1. Parameter tuning for realistic results +2. Performance optimization +3. Generation progress reporting +4. Validation and debugging tools + +## Scientific Accuracy vs Gameplay + +### Scientifically Inspired Elements +- ✅ Late Heavy Bombardment period +- ✅ Planetary differentiation (metals sink to core) +- ✅ Tectonic processes creating mountains/valleys +- ✅ Carboniferous period forest→coal formation +- ✅ Marine conditions for oil formation +- ✅ Sea level variations affecting geology +- ✅ ITCZ formation from continental heating +- ✅ Planetary circulation bands (trade winds, jet streams) +- ✅ Realistic climate differentiation (Congo vs Sahara) + +### Gameplay Simplifications +- ⚠️ Tectonic regions as circles (not realistic plate shapes) +- ⚠️ Fixed map size instead of planetary expansion +- ⚠️ Simplified core-mantle dynamics +- ⚠️ Compressed timescales for practical generation +- ⚠️ 2D wind simulation instead of 3D atmospheric layers +- ⚠️ Discrete token system instead of continuous climate fields +- ⚠️ Mobile wind regions as simplified weather systems + +### Result +**Plausible geology and climate** that creates **interesting gameplay** with **emergent weather patterns** without requiring PhD in atmospheric science to understand or debug. + +## Integration Points + +### WorldGenerationModule +- Orchestrates all geological phases +- Manages simulation state and progression +- Provides query interface for generated geology + +### FeatureManager +- Places geological features based on simulation results +- Handles feature set optimization and tile updates +- Simple interface for placement algorithms + +### RegionalInfluenceManager +- Core system managing all regional effects +- Handles tectonic regions, carbon regions, volcanic zones +- Provides influence application to tiles + +### Future Extensions +- **Dynamic climate**: Real-time weather systems during gameplay +- **Mineral resource modeling**: Detailed ore deposit formation +- **Advanced erosion**: River network evolution during gameplay +- **Geological time compression**: Speed up/slow down specific phases +- **Seasonal climate**: Monthly/yearly climate variations +- **Climate change**: Long-term climate evolution from industrial activity + +--- + +**Status**: System designed and ready for implementation. All major components specified with clear interfaces and realistic performance targets. Scientific accuracy balanced with implementation complexity for practical game development. \ No newline at end of file diff --git a/gameData/Biomes/alpine.json b/gameData/Biomes/alpine.json new file mode 100644 index 0000000..3d418cc --- /dev/null +++ b/gameData/Biomes/alpine.json @@ -0,0 +1,164 @@ +{ + "biome_id": "alpine", + "display_name": "Alpine", + "description": "High-altitude mountain regions above treeline with extreme cold, intense UV radiation, and specialized cold-adapted vegetation", + + "classification": { + "type": "normal_biome", + "priority": 15, + "token_requirements": { + "temperature": {"max": 0, "condition": "below_freezing"}, + "elevation": {"min": 2000, "condition": "high_altitude"} + }, + "climate_conditions": { + "extreme_cold": true, + "high_altitude_effects": true, + "intense_uv_radiation": true, + "short_growing_season": true, + "strong_winds": true + }, + "elevation_range": { + "minimum": 2000, + "typical_range": [2500, 4000], + "formation_zone": "above_treeline" + }, + "generation_notes": { + "formation_process": "Created by combination of cold temperatures (≤0°C) and high elevation (≥2000m)", + "geographic_distribution": "Mountain peaks and high plateaus above treeline", + "rarity": "Uncommon - limited to high mountain areas", + "minimum_area": 25, + "typical_area_range": [50, 300] + } + }, + + "vegetation": { + "primary": "alpine_specialists", + "secondary": ["alpine_grasses", "cushion_plants", "mountain_wildflowers", "dwarf_conifers"], + "characteristics": [ + "extremely_low_growth_forms", + "cold_and_wind_adaptation", + "UV_radiation_protection", + "short_intense_growing_season", + "deep_root_systems" + ], + "forest_compatibility": false, + "note": "Above treeline - only specialized alpine plants survive extreme conditions" + }, + + "environmental_properties": { + "altitude_extremes": 3.0, + "temperature_extremes": 2.8, + "uv_radiation": 2.9, + "wind_exposure": 2.7, + "oxygen_levels": 0.6, + "growing_season": 0.3, + "biodiversity": 0.8 + }, + + "resource_modifiers": { + "mineral_extraction": 2.2, + "rare_earth_elements": 2.0, + "precious_metals": 1.8, + "glacial_water": 1.6, + "wind_energy": 2.1, + "solar_energy": 1.7, + "agriculture": 0.0, + "forestry": 0.0, + "tourism": 1.8, + "research_value": 2.4 + }, + + "industrial_considerations": { + "construction_requirements": [ + "extreme_altitude_engineering", + "wind_and_cold_resistance", + "oxygen_supplementation_systems", + "helicopter_or_cable_access" + ], + "advantages": [ + "rich_mineral_deposits", + "excellent_wind_and_solar_exposure", + "natural_isolation_and_security", + "fresh_water_sources_from_glaciers" + ], + "challenges": [ + "extreme_construction_costs", + "altitude_sickness_for_workers", + "limited_access_and_logistics", + "equipment_stress_from_conditions" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "natural_fortress": 3.2, + "altitude_advantage": 2.8, + "difficult_approach": 3.0 + }, + "economic_factors": { + "mining_bonus": 2.2, + "construction_costs": 3.8, + "transportation_costs": 3.5, + "energy_generation_bonus": 1.9 + }, + "strategic_value": { + "territorial_control": 2.9, + "observation_posts": 3.0, + "resource_monopoly": 2.4 + } + }, + + "altitude_effects": { + "oxygen_reduction": "significant_breathing_difficulty", + "atmospheric_pressure": "reduced_pressure_affects_equipment", + "temperature_lapse": "colder_with_increasing_elevation", + "uv_intensity": "increased_radiation_exposure" + }, + + "seasonal_extremes": { + "winter": { + "conditions": "extreme_cold_and_snow_cover", + "accessibility": "extremely_limited", + "survival": "life_threatening_conditions" + }, + "summer": { + "conditions": "brief_growing_season", + "accessibility": "limited_weather_windows", + "activities": "peak_construction_and_research" + } + }, + + "wildlife": { + "adapted_species": [ + "mountain_goats", + "alpine_birds", + "high_altitude_insects", + "cold_adapted_mammals" + ], + "hunting_opportunities": 0.8, + "biodiversity": 0.8, + "conservation_value": "unique_high_altitude_adaptations" + }, + + "geological_features": { + "exposed_bedrock": "minimal_soil_cover", + "glacial_formations": "cirques_and_moraines", + "talus_slopes": "unstable_rock_debris", + "alpine_lakes": "pristine_high_altitude_water" + }, + + "mountaineering_aspects": { + "climbing_opportunities": 2.5, + "avalanche_risk": 2.8, + "weather_unpredictability": 3.0, + "rescue_difficulty": 3.2 + }, + + "water_resources": { + "glacial_melt": "seasonal_water_source", + "alpine_springs": "pure_mountain_water", + "snow_accumulation": "winter_water_storage", + "watershed_importance": "supplies_lower_elevations" + }, + +} \ No newline at end of file diff --git a/gameData/Biomes/badlands.json b/gameData/Biomes/badlands.json new file mode 100644 index 0000000..2698fb1 --- /dev/null +++ b/gameData/Biomes/badlands.json @@ -0,0 +1,141 @@ +{ + "biome_id": "badlands", + "display_name": "Badlands", + "description": "Harsh, wind-scoured regions with minimal vegetation, created by persistent high winds and limited rainfall", + + "classification": { + "type": "special_climate_zone", + "priority": 8, + "token_requirements": { + "highWind_tokens": {"min": 2, "condition": "above_storm_threshold"}, + "rain_tokens": {"max": 300, "condition": "insufficient_moisture"} + }, + "climate_conditions": { + "persistent_high_winds": true, + "limited_rainfall": true, + "extreme_temperature_variations": true, + "severe_erosion": true + }, + "elevation_range": { + "minimum": 200, + "maximum": 1500, + "typical_range": [400, 1200], + "formation_zone": "wind_exposed_continental_interiors" + }, + "generation_notes": { + "formation_process": "Created by highWind_tokens in areas with insufficient rain_tokens", + "geographic_distribution": "Interior continental areas with extreme wind exposure and low precipitation", + "rarity": "Rare - requires extreme combination of high wind and low rainfall", + "minimum_area": 75, + "typical_area_range": [150, 600] + } + }, + + "vegetation": { + "primary": "sparse_wind_resistant", + "secondary": ["hardy_cacti", "thorny_shrubs", "rock_lichens", "drought_adapted_grasses"], + "characteristics": [ + "extremely_deep_roots", + "water_storage_adaptations", + "minimal_surface_area", + "protective_spines_or_waxy_coatings" + ], + "forest_compatibility": false, + "note": "Only the most resilient plants can survive the combination of wind and drought" + }, + + "environmental_properties": { + "wind_energy": 2.2, + "erosion_rate": 2.8, + "water_scarcity": 2.5, + "temperature_extremes": 2.3, + "soil_quality": 0.3, + "biodiversity": 0.4 + }, + + "resource_modifiers": { + "wind_energy": 2.2, + "mineral_exposure": 1.8, + "rare_earth_elements": 1.4, + "solar_energy": 1.9, + "geothermal_potential": 1.3, + "agriculture": 0.1, + "forestry": 0.0, + "water_resources": 0.2, + "industrial_suitability": 0.8, + "tourism": 0.6 + }, + + "industrial_considerations": { + "construction_requirements": [ + "extreme_wind_resistance", + "sandstorm_protection", + "water_importation_systems", + "temperature_resistant_materials" + ], + "advantages": [ + "exceptional_wind_energy_sites", + "exposed_mineral_deposits", + "excellent_solar_exposure", + "natural_isolation_for_sensitive_operations" + ], + "challenges": [ + "extreme_construction_conditions", + "constant_erosion_and_sandblasting", + "water_scarcity", + "equipment_maintenance_difficulties" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "natural_fortress": 2.5, + "difficult_terrain": 2.8, + "visibility_reduction": 1.8 + }, + "economic_factors": { + "construction_costs": 2.8, + "maintenance_costs": 3.2, + "resource_extraction_bonus": 1.6, + "energy_generation_bonus": 2.0 + }, + "strategic_value": { + "natural_barrier": 2.7, + "hidden_base_potential": 2.2, + "resource_control": 1.9 + } + }, + + "environmental_hazards": { + "sandstorms": { + "frequency": "frequent", + "intensity": "severe", + "effects": "equipment_damage_and_visibility_loss" + }, + "flash_floods": { + "frequency": "rare_but_devastating", + "cause": "sudden_rainfall_on_hard_packed_earth", + "effects": "temporary_impassable_terrain" + }, + "temperature_extremes": { + "daily_variation": "extreme", + "seasonal_variation": "severe", + "effects": "equipment_stress_and_human_discomfort" + } + }, + + "geological_features": { + "exposed_rock_formations": "dramatic_geological_history_visible", + "mineral_outcroppings": "rare_elements_accessible_at_surface", + "wind_carved_formations": "unique_landscape_features", + "erosion_patterns": "constantly_changing_topography" + }, + + "survival_considerations": { + "water_sources": "extremely_rare_and_precious", + "shelter_requirements": "protection_from_wind_and_temperature", + "navigation_challenges": "shifting_landmarks_and_poor_visibility", + "supply_lines": "critical_for_any_operations" + }, + +} \ No newline at end of file diff --git a/gameData/Biomes/biome_index.json b/gameData/Biomes/biome_index.json new file mode 100644 index 0000000..c784593 --- /dev/null +++ b/gameData/Biomes/biome_index.json @@ -0,0 +1,215 @@ +{ + "biome_system_version": "1.0", + "description": "Comprehensive biome definitions for WindRegion-based climate simulation system", + "last_updated": "2024-09-29", + + "classification_system": { + "special_climate_zones": { + "description": "Biomes created by extreme weather token accumulation", + "priority_range": [1, 5], + "evaluation_order": "first", + "override_normal_biomes": true + }, + "normal_biomes": { + "description": "Standard biomes based on temperature and rainfall patterns", + "priority_range": [10, 20], + "evaluation_order": "second", + "fallback_system": true + } + }, + + "biome_definitions": { + "special_climate_zones": [ + { + "biome_id": "wetlands", + "file": "wetlands.json", + "priority": 1, + "token_requirement": "flood_tokens > flood_threshold", + "description": "Marshes and swamps from recurring flooding patterns" + }, + { + "biome_id": "coastal_plain", + "file": "coastal_plain.json", + "priority": 2, + "token_requirement": "rain_tokens >= 150 AND coastal_proximity <= 5", + "description": "Low-lying coastal areas with maritime influence and salt-tolerant vegetation" + }, + { + "biome_id": "cliffs", + "file": "cliffs.json", + "priority": 3, + "token_requirement": "elevation >= 50 AND coastal_proximity <= 2", + "description": "Dramatic vertical coastal formations with extreme wind exposure" + }, + { + "biome_id": "sandy_coast", + "file": "sandy_coast.json", + "priority": 4, + "token_requirement": "rain_tokens >= 100 AND coastal_proximity <= 3", + "description": "Expansive sandy beaches and dune systems with tourism potential" + }, + { + "biome_id": "rocky_shore", + "file": "rocky_shore.json", + "priority": 5, + "token_requirement": "rain_tokens >= 120 AND coastal_proximity <= 2", + "description": "Rugged coastal areas with tidal pools and marine ecosystems" + }, + { + "biome_id": "hurricane_zone", + "file": "hurricane_zone.json", + "priority": 6, + "token_requirement": "hurricane_tokens > 0", + "description": "Storm-resistant coastal vegetation in hurricane-prone areas" + }, + { + "biome_id": "storm_prairie", + "file": "storm_prairie.json", + "priority": 7, + "token_requirement": "highWind_tokens > storm_threshold AND rain_tokens > 300", + "description": "Wind-resistant grasslands with adequate moisture" + }, + { + "biome_id": "badlands", + "file": "badlands.json", + "priority": 8, + "token_requirement": "highWind_tokens > storm_threshold AND rain_tokens <= 300", + "description": "Sparse vegetation in extreme wind and drought conditions" + } + ], + "normal_biomes": [ + { + "biome_id": "tropical_rainforest", + "file": "tropical_rainforest.json", + "priority": 10, + "requirements": "rain_tokens >= 500 AND temperature >= 25", + "description": "Dense equatorial forests with maximum biodiversity" + }, + { + "biome_id": "hot_desert", + "file": "hot_desert.json", + "priority": 11, + "requirements": "rain_tokens <= 50 AND temperature >= 20", + "description": "Arid regions with minimal vegetation and extreme heat" + }, + { + "biome_id": "temperate_forest", + "file": "temperate_forest.json", + "priority": 12, + "requirements": "rain_tokens >= 300 AND temperature >= 15 AND temperature <= 25", + "description": "Seasonal forests in moderate climate zones" + }, + { + "biome_id": "grassland", + "file": "grassland.json", + "priority": 13, + "requirements": "rain_tokens >= 200 AND temperature >= 10", + "description": "Temperate grasslands ideal for agriculture" + }, + { + "biome_id": "tundra", + "file": "tundra.json", + "priority": 14, + "requirements": "temperature <= -10", + "description": "Arctic regions with permafrost and minimal vegetation" + }, + { + "biome_id": "alpine", + "file": "alpine.json", + "priority": 15, + "requirements": "temperature <= 0 AND elevation >= 2000", + "description": "High-altitude mountain regions above treeline" + }, + { + "biome_id": "cold_desert", + "file": "cold_desert.json", + "priority": 16, + "requirements": "rain_tokens <= 30 AND temperature <= 10", + "description": "High-altitude or high-latitude arid regions with cold temperatures" + }, + { + "biome_id": "hills", + "file": "hills.json", + "priority": 17, + "requirements": "elevation >= 500 AND elevation <= 1500 AND rain_tokens >= 150", + "description": "Rolling hill country with diverse microclimates and mixed vegetation" + }, + { + "biome_id": "rocky_plateau", + "file": "rocky_plateau.json", + "priority": 18, + "requirements": "elevation >= 800 AND rain_tokens >= 100 AND rain_tokens <= 400", + "description": "Elevated flat-topped terrain with exposed bedrock and hardy vegetation" + }, + { + "biome_id": "scrubland", + "file": "scrubland.json", + "priority": 1, + "requirements": "fallback_biome", + "description": "Semi-arid transition zones with sparse vegetation - default fallback biome" + } + ] + }, + + "token_thresholds": { + "climate_zone_tokens": { + "storm_threshold": 2.0, + "flood_threshold": 3.0, + "hurricane_requirement": "wind >= 2.5 AND rain >= 2.0" + }, + "normal_biome_tokens": { + "rain_abundant": 500, + "rain_moderate": 300, + "rain_limited": 200, + "rain_minimal": 50, + "rain_very_minimal": 30 + }, + "temperature_ranges": { + "tropical": 25, + "temperate_warm": 20, + "temperate_cool": 15, + "cold": 10, + "freezing": 0, + "arctic": -10 + }, + "elevation_thresholds": { + "sea_level": 0, + "hills": 500, + "mountains": 1000, + "high_mountains": 2000, + "alpine_zone": 2500 + } + }, + + "biome_selection_algorithm": { + "step_1": "Check special climate zone tokens (priority 1-5)", + "step_2": "If no special zones match, evaluate normal biomes (priority 10+)", + "step_3": "Use highest priority match, or fallback to 'scrubland' if none match", + "step_4": "Apply forest feature integration for forest-compatible biomes" + }, + + "integration_notes": { + "climate_system": "Biomes are generated from accumulated tokens from mobile WindRegions", + "congo_vs_sahara": "System designed to create tropical_rainforest (Congo) vs hot_desert (Sahara)", + "token_accumulation": "Permanent climate record from WindRegion movements over 300 cycles", + "special_zones": "Extreme weather creates unique biomes not found in traditional climate models", + "forest_features": "Existing forest features from geological phases influence final biome selection" + }, + + "validation_patterns": { + "congo_basin": { + "expected_biome": "tropical_rainforest", + "token_pattern": "rain_tokens > 500 from ITCZ convergence", + "latitude": "equatorial (45-55%)" + }, + "sahara_desert": { + "expected_biome": "hot_desert", + "token_pattern": "rain_tokens < 50 due to no ITCZ influence", + "latitude": "subtropical (25-35%)" + }, + "hurricane_coasts": { + "expected_biome": "hurricane_zone", + "token_pattern": "hurricane_tokens from coastal storm activity" + } + } +} \ No newline at end of file diff --git a/gameData/Biomes/cliffs.json b/gameData/Biomes/cliffs.json new file mode 100644 index 0000000..ed094b1 --- /dev/null +++ b/gameData/Biomes/cliffs.json @@ -0,0 +1,156 @@ +{ + "biome_id": "cliffs", + "display_name": "Coastal Cliffs", + "description": "Dramatic vertical coastal formations with rugged terrain, seabird colonies and strategic defensive positions", + + "classification": { + "type": "special_climate_zone", + "priority": 3, + "token_requirements": { + "elevation": {"min": 50, "condition": "elevated_coastal_terrain"}, + "coastal_proximity": {"max": 2, "condition": "immediate_ocean_access"} + }, + "climate_conditions": { + "extreme_wind_exposure": true, + "salt_spray_intense": true, + "maritime_influence": true, + "erosion_active": true + }, + "elevation_range": { + "minimum": 50, + "maximum": 500, + "typical_range": [100, 300], + "formation_zone": "elevated_coastal_areas_with_vertical_drops" + }, + "generation_notes": { + "formation_process": "Created by coastal elevation requirements with immediate ocean access", + "geographic_distribution": "Vertical coastal formations and sea cliffs", + "rarity": "Uncommon - specific geological coastal conditions", + "minimum_area": 50, + "typical_area_range": [100, 400] + } + }, + + "vegetation": { + "primary": "cliff_adapted_specialists", + "secondary": ["hardy_coastal_shrubs", "cliff_grasses", "maritime_lichens", "wind_sculpted_trees"], + "characteristics": [ + "extreme_wind_tolerance", + "salt_spray_resistance", + "cliff_face_adaptation", + "shallow_root_systems", + "low_growth_forms" + ], + "forest_compatibility": false, + "note": "Only the most specialized plants survive on exposed cliff faces" + }, + + "environmental_properties": { + "wind_exposure": 3.0, + "salt_spray": 2.8, + "erosion_activity": 2.6, + "soil_depth": 0.3, + "access_difficulty": 2.9, + "biodiversity": 1.2 + }, + + "resource_modifiers": { + "stone_quarrying": 2.4, + "seabird_guano": 1.8, + "lighthouse_sites": 2.8, + "wind_energy": 2.6, + "defensive_positions": 3.0, + "agriculture": 0.1, + "forestry": 0.0, + "tourism": 2.1, + "industrial_suitability": 0.3, + "research_value": 1.9 + }, + + "industrial_considerations": { + "construction_requirements": [ + "extreme_wind_protection", + "cliff_face_stabilization", + "specialized_access_systems", + "salt_spray_corrosion_prevention" + ], + "advantages": [ + "unparalleled_defensive_position", + "lighthouse_and_navigation_sites", + "stone_quarrying_opportunities", + "extreme_wind_energy_potential" + ], + "challenges": [ + "extremely_difficult_access", + "continuous_erosion_threats", + "construction_cost_multipliers", + "limited_flat_building_space" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "natural_fortress": 3.2, + "coastal_observation": 3.0, + "amphibious_invasion_prevention": 3.5 + }, + "economic_factors": { + "construction_costs": 4.2, + "maintenance_costs": 3.8, + "stone_extraction_bonus": 2.4, + "tourism_lighthouse_revenue": 2.1 + }, + "strategic_value": { + "naval_observation": 3.2, + "coastal_defense": 3.5, + "navigation_control": 2.8 + } + }, + + "survival_challenges": { + "access_limitations": "rope_and_climbing_equipment_required", + "wind_safety": "extreme_weather_poses_constant_danger", + "erosion_instability": "cliff_faces_subject_to_sudden_collapse", + "isolation": "limited_escape_routes_during_emergencies" + }, + + "wildlife": { + "adapted_species": [ + "seabird_colonies", + "cliff_nesting_birds", + "marine_mammals_below", + "specialized_cliff_insects" + ], + "hunting_opportunities": 0.8, + "biodiversity": 1.2, + "conservation_value": "critical_seabird_nesting_habitat" + }, + + "geological_characteristics": { + "rock_type": "resistant_coastal_bedrock", + "stability": "variable_depending_on_rock_type_and_weather", + "erosion_patterns": "continuous_marine_erosion", + "cliff_height": "typically_50_to_300_meters" + }, + + "maritime_interaction": { + "wave_action": "intense_wave_impact_at_base", + "tidal_influence": "extreme_tidal_variation_exposure", + "storm_impact": "severe_weather_amplification", + "navigation_hazard": "dangerous_waters_for_small_vessels" + }, + + "research_opportunities": { + "coastal_erosion_studies": 2.4, + "seabird_ecology": 2.2, + "maritime_archaeology": 1.8, + "wind_pattern_analysis": 2.0 + }, + + "historical_significance": { + "lighthouse_heritage": "traditional_navigation_aid_locations", + "defensive_castles": "medieval_coastal_fortification_sites", + "shipwreck_archaeology": "dangerous_waters_with_historical_wrecks", + "smuggling_history": "hidden_coves_and_secret_landing_sites" + } +} \ No newline at end of file diff --git a/gameData/Biomes/coastal_plain.json b/gameData/Biomes/coastal_plain.json new file mode 100644 index 0000000..93d6ad1 --- /dev/null +++ b/gameData/Biomes/coastal_plain.json @@ -0,0 +1,154 @@ +{ + "biome_id": "coastal_plain", + "display_name": "Coastal Plain", + "description": "Low-lying areas along coastlines with maritime influence, salt-tolerant vegetation and access to marine resources", + + "classification": { + "type": "special_climate_zone", + "priority": 2, + "token_requirements": { + "rain_tokens": {"min": 150, "condition": "moderate_coastal_rainfall"}, + "coastal_proximity": {"max": 5, "condition": "near_ocean"} + }, + "climate_conditions": { + "maritime_influence": true, + "moderate_temperatures": true, + "salt_spray_exposure": true, + "sea_breeze_circulation": true + }, + "elevation_range": { + "minimum": 0, + "maximum": 100, + "typical_range": [0, 50], + "formation_zone": "low_coastal_areas_with_marine_influence" + }, + "generation_notes": { + "formation_process": "Created by moderate rainfall with coastal proximity requirements", + "geographic_distribution": "Coastal lowlands with maritime climate influence", + "rarity": "Common - major coastal settlement areas", + "minimum_area": 100, + "typical_area_range": [200, 800] + } + }, + + "vegetation": { + "primary": "salt_tolerant_coastal_plants", + "secondary": ["sea_grasses", "coastal_shrubs", "salt_marsh_plants", "dune_vegetation"], + "characteristics": [ + "salt_tolerance", + "wind_resistance", + "sand_stabilization", + "maritime_adaptation", + "moderate_productivity" + ], + "forest_compatibility": "coastal_adapted_trees_only", + "note": "Specialized vegetation adapted to salt spray and coastal conditions" + }, + + "environmental_properties": { + "salt_tolerance": 2.5, + "wind_exposure": 2.1, + "soil_salinity": 1.8, + "erosion_resistance": 1.4, + "marine_influence": 2.8, + "biodiversity": 1.6 + }, + + "resource_modifiers": { + "fishing": 2.5, + "salt_production": 2.0, + "seaweed_harvest": 1.8, + "maritime_trade": 2.2, + "agriculture": 1.1, + "livestock_grazing": 1.3, + "wind_energy": 1.8, + "tourism": 1.9, + "forestry": 0.4, + "industrial_suitability": 1.2 + }, + + "industrial_considerations": { + "construction_requirements": [ + "salt_corrosion_protection", + "wind_resistant_design", + "foundation_drainage_systems", + "storm_surge_preparation" + ], + "advantages": [ + "excellent_port_access", + "maritime_trade_routes", + "flat_construction_terrain", + "consistent_wind_resources" + ], + "challenges": [ + "salt_corrosion_issues", + "storm_surge_vulnerability", + "soil_salinity_problems", + "seasonal_tourism_variations" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "amphibious_operations": 2.4, + "naval_support_access": 2.6 + }, + "economic_factors": { + "maritime_trade_bonus": 2.2, + "fishing_industry_income": 2.5, + "tourism_revenue": 1.9, + "salt_corrosion_costs": 1.8 + }, + "strategic_value": { + "port_development": 2.8, + "naval_base_suitability": 2.4, + "international_trade": 2.3 + } + }, + + "seasonal_patterns": { + "storm_season": { + "conditions": "increased_wind_and_precipitation_from_ocean_storms", + "challenges": "storm_surge_flooding_and_infrastructure_damage", + "opportunities": "increased_fish_migration_and_wave_energy" + }, + "calm_season": { + "conditions": "stable_weather_with_consistent_sea_breezes", + "opportunities": "optimal_fishing_and_maritime_trade_conditions", + "tourism": "peak_visitor_season_with_mild_coastal_climate" + } + }, + + "wildlife": { + "adapted_species": [ + "seabirds", + "coastal_mammals", + "intertidal_species", + "migratory_shorebirds" + ], + "hunting_opportunities": 1.4, + "biodiversity": 1.6, + "conservation_value": "important_bird_migration_corridors" + }, + + "soil_characteristics": { + "soil_type": "sandy_coastal_soils_with_salt_content", + "drainage": "excellent_natural_drainage", + "salinity": "moderate_to_high_salt_content", + "fertility": "moderate_with_marine_nutrient_input" + }, + + "maritime_features": { + "tidal_influence": "strong_tidal_variations", + "beach_access": "natural_beaches_and_sandy_shores", + "harbor_potential": "excellent_natural_harbors", + "storm_protection": "requires_artificial_breakwaters" + }, + + "land_use_potential": { + "port_development": "primary_economic_opportunity", + "fishing_industry": "major_coastal_resource_exploitation", + "tourism_development": "beach_and_maritime_recreation", + "salt_farming": "traditional_coastal_industry" + } +} \ No newline at end of file diff --git a/gameData/Biomes/cold_desert.json b/gameData/Biomes/cold_desert.json new file mode 100644 index 0000000..901b09d --- /dev/null +++ b/gameData/Biomes/cold_desert.json @@ -0,0 +1,184 @@ +{ + "biome_id": "cold_desert", + "display_name": "Cold Desert", + "description": "High-altitude or high-latitude desert regions with cold temperatures and minimal precipitation, featuring specialized cold-adapted arid vegetation", + + "classification": { + "type": "normal_biome", + "priority": 16, + "token_requirements": { + "rain_tokens": {"max": 30, "condition": "very_low_precipitation"}, + "temperature": {"max": 10, "condition": "cold_climate"} + }, + "climate_conditions": { + "cold_temperatures": true, + "extreme_aridity": true, + "high_altitude_or_latitude": true, + "strong_temperature_variations": true, + "low_humidity": true + }, + "elevation_range": { + "minimum": 500, + "maximum": 3000, + "typical_range": [1000, 2500], + "formation_zone": "high_altitude_plateaus_and_polar_deserts" + }, + "generation_notes": { + "formation_process": "Created by very low rain_tokens (≤30) combined with cold temperatures (≤10°C)", + "geographic_distribution": "High-altitude plateaus, continental interiors with cold climates, polar deserts", + "rarity": "Uncommon - requires specific combination of cold and extreme aridity", + "minimum_area": 100, + "typical_area_range": [250, 1000] + } + }, + + "vegetation": { + "primary": "cold_adapted_desert_plants", + "secondary": ["hardy_shrubs", "drought_cold_tolerant_grasses", "alpine_succulents", "cushion_plants"], + "characteristics": [ + "dual_stress_adaptation", + "cold_and_drought_tolerance", + "compact_growth_forms", + "deep_root_systems", + "protective_surface_structures" + ], + "forest_compatibility": false, + "note": "Must survive both extreme cold and water scarcity simultaneously" + }, + + "environmental_properties": { + "water_scarcity": 2.9, + "cold_extremes": 2.4, + "temperature_variation": 2.7, + "wind_exposure": 2.3, + "soil_aridity": 2.8, + "growing_season": 0.4, + "biodiversity": 0.4 + }, + + "resource_modifiers": { + "mineral_deposits": 1.9, + "rare_earth_elements": 1.6, + "wind_energy": 1.8, + "solar_energy": 1.4, + "geothermal_potential": 1.5, + "salt_deposits": 1.7, + "agriculture": 0.05, + "forestry": 0.0, + "water_resources": 0.15, + "industrial_suitability": 0.6, + "research_value": 1.8 + }, + + "industrial_considerations": { + "construction_requirements": [ + "cold_weather_protection", + "water_conservation_systems", + "wind_and_dust_protection", + "specialized_heating_systems" + ], + "advantages": [ + "mineral_resource_access", + "low_environmental_impact_restrictions", + "natural_preservation_conditions", + "strategic_isolation" + ], + "challenges": [ + "dual_environmental_stress", + "water_importation_requirements", + "extreme_temperature_management", + "limited_growing_season" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "natural_barrier": 2.6, + "difficult_logistics": 2.8, + "environmental_protection": 2.4 + }, + "economic_factors": { + "construction_costs": 2.6, + "heating_costs": 2.8, + "water_importation_costs": 3.2, + "mineral_extraction_bonus": 1.7 + }, + "strategic_value": { + "resource_control": 2.0, + "territorial_buffer": 2.5, + "research_isolation": 2.2 + } + }, + + "survival_challenges": { + "water_procurement": { + "sources": "snow_melt_and_rare_springs", + "conservation": "critical_water_management", + "quality": "often_high_mineral_content" + }, + "temperature_management": { + "heating_requirements": "essential_for_survival", + "insulation_needs": "extreme_cold_protection", + "equipment_protection": "cold_weather_maintenance" + }, + "food_procurement": { + "agriculture": "nearly_impossible", + "hunting": "limited_wildlife", + "imports": "critical_supply_dependence" + } + }, + + "wildlife": { + "adapted_species": [ + "cold_desert_lizards", + "hardy_small_mammals", + "migratory_birds", + "specialized_arthropods" + ], + "hunting_opportunities": 0.4, + "biodiversity": 0.4, + "conservation_value": "unique_dual_stress_adaptations" + }, + + "seasonal_patterns": { + "winter": { + "conditions": "extreme_cold_with_minimal_precipitation", + "challenges": "frozen_water_sources_and_heating_demands", + "wildlife": "minimal_activity_and_hibernation" + }, + "summer": { + "conditions": "brief_warming_period_with_slight_moisture", + "opportunities": "limited_growing_season_and_construction", + "wildlife": "peak_activity_and_reproduction" + } + }, + + "geological_characteristics": { + "soil_type": "thin_rocky_soils_with_poor_water_retention", + "rock_formations": "exposed_bedrock_and_scree_slopes", + "mineral_exposure": "weathering_exposes_valuable_deposits", + "erosion_patterns": "wind_and_freeze_thaw_erosion" + }, + + "water_sources": { + "seasonal_snowmelt": "primary_annual_water_input", + "underground_springs": "rare_but_critical_resources", + "atmospheric_moisture": "dew_and_frost_collection", + "imported_water": "essential_for_human_activities" + }, + + "research_opportunities": { + "extreme_environment_biology": 2.0, + "cold_arid_adaptations": 1.9, + "climate_change_indicators": 1.8, + "mineral_formation_processes": 1.7 + }, + + "land_use_potential": { + "mining_operations": "primary_economic_activity", + "research_stations": "isolated_study_locations", + "strategic_installations": "remote_monitoring_posts", + "renewable_energy": "wind_and_limited_solar" + }, + +} \ No newline at end of file diff --git a/gameData/Biomes/grassland.json b/gameData/Biomes/grassland.json new file mode 100644 index 0000000..a8ff7bb --- /dev/null +++ b/gameData/Biomes/grassland.json @@ -0,0 +1,153 @@ +{ + "biome_id": "grassland", + "display_name": "Grassland", + "description": "Temperate grasslands with moderate rainfall and temperature, ideal for agriculture and grazing, featuring vast open plains", + + "classification": { + "type": "normal_biome", + "priority": 13, + "token_requirements": { + "rain_tokens": {"min": 200, "condition": "moderate_rainfall"}, + "temperature": {"min": 10, "condition": "temperate_climate"} + }, + "climate_conditions": { + "moderate_temperatures": true, + "adequate_rainfall": true, + "seasonal_variation": true, + "insufficient_for_forest_growth": true + }, + "elevation_range": { + "minimum": 0, + "maximum": 800, + "typical_range": [100, 600], + "formation_zone": "continental_interiors_with_moderate_precipitation" + }, + "generation_notes": { + "formation_process": "Created by moderate rain_tokens (200+) with temperate temperatures but insufficient for forests", + "geographic_distribution": "Continental interiors with moderate precipitation", + "rarity": "Common - major agricultural regions worldwide", + "minimum_area": 200, + "typical_area_range": [500, 2500] + } + }, + + "vegetation": { + "primary": "perennial_grasses", + "secondary": ["prairie_grasses", "wildflowers", "scattered_shrubs"], + "characteristics": [ + "deep_root_systems", + "drought_tolerance", + "fire_adaptation", + "seasonal_growth_cycles", + "high_productivity" + ], + "forest_compatibility": "scattered_trees_only", + "note": "Natural grassland ecosystem with high agricultural potential" + }, + + "environmental_properties": { + "agricultural_potential": 2.5, + "soil_quality": 2.2, + "carbon_storage": 1.8, + "erosion_resistance": 1.6, + "fire_resilience": 2.0, + "biodiversity": 1.4 + }, + + "resource_modifiers": { + "agriculture": 1.8, + "livestock_grazing": 2.2, + "grain_production": 2.0, + "hay_and_forage": 2.5, + "wild_game": 1.6, + "wind_energy": 1.4, + "forestry": 0.2, + "industrial_suitability": 0.9, + "recreation": 1.3 + }, + + "industrial_considerations": { + "construction_requirements": [ + "minimal_ground_preparation", + "wind_exposure_considerations", + "seasonal_weather_protection" + ], + "advantages": [ + "excellent_agricultural_land", + "easy_construction_conditions", + "flat_terrain_for_development", + "good_transportation_routes" + ], + "challenges": [ + "limited_natural_windbreaks", + "fire_risk_management", + "soil_conservation_needs", + "seasonal_weather_extremes" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "open_terrain_visibility": 2.2, + "cavalry_advantage": 2.0 + }, + "economic_factors": { + "agricultural_productivity": 2.2, + "low_development_costs": 1.5, + "food_security_bonus": 2.0 + }, + "strategic_value": { + "food_production_hub": 2.5, + "population_support": 2.2, + "transportation_network": 1.8 + } + }, + + "agricultural_systems": { + "crop_rotation": "sustainable_soil_management", + "livestock_integration": "mixed_farming_systems", + "irrigation_potential": "moderate_water_requirements", + "mechanization": "ideal_for_large_scale_farming" + }, + + "wildlife": { + "grassland_species": [ + "prairie_dogs", + "ground_nesting_birds", + "grazing_mammals", + "raptors" + ], + "hunting_opportunities": 1.6, + "biodiversity": 1.4, + "migration_routes": "important_corridors_for_many_species" + }, + + "seasonal_patterns": { + "growing_season": "spring_through_early_autumn", + "dormancy_period": "winter_with_possible_snow_cover", + "fire_season": "late_summer_natural_fire_cycles", + "grazing_patterns": "seasonal_animal_movement" + }, + + "soil_characteristics": { + "soil_type": "deep_fertile_prairie_soils", + "organic_matter": "high_due_to_grass_root_systems", + "drainage": "generally_well_drained", + "erosion_risk": "moderate_without_ground_cover" + }, + + "fire_ecology": { + "natural_fire_frequency": "every_3_10_years", + "fire_benefits": "removes_woody_plants_and_stimulates_grass_growth", + "fire_management": "controlled_burns_for_ecosystem_health", + "fire_prevention": "firebreaks_and_early_detection" + }, + + "land_use_patterns": { + "agriculture": "crop_production_and_livestock", + "urban_development": "preferred_sites_for_cities", + "transportation": "ideal_for_roads_and_railways", + "energy_production": "wind_farms_and_solar_installations" + }, + +} \ No newline at end of file diff --git a/gameData/Biomes/hills.json b/gameData/Biomes/hills.json new file mode 100644 index 0000000..6ed7261 --- /dev/null +++ b/gameData/Biomes/hills.json @@ -0,0 +1,180 @@ +{ + "biome_id": "hills", + "display_name": "Hills", + "description": "Rolling hill country with moderate elevation, diverse microclimates, and mixed vegetation creating natural terraced landscapes", + + "classification": { + "type": "normal_biome", + "priority": 17, + "token_requirements": { + "elevation": {"min": 500, "max": 1500, "condition": "moderate_altitude"}, + "rain_tokens": {"min": 150, "condition": "adequate_moisture"} + }, + "climate_conditions": { + "moderate_elevation_effects": true, + "varied_microclimates": true, + "good_drainage": true, + "wind_exposure_variation": true + }, + "elevation_range": { + "minimum": 500, + "maximum": 1500, + "typical_range": [600, 1200], + "formation_zone": "transition_between_plains_and_mountains" + }, + "generation_notes": { + "formation_process": "Created by moderate elevation (500-1500m) with adequate moisture (≥150 rain_tokens)", + "geographic_distribution": "Transition zones between plains and mountains", + "rarity": "Common - natural intermediate terrain", + "minimum_area": 100, + "typical_area_range": [200, 800] + } + }, + + "vegetation": { + "primary": "mixed_elevation_adapted", + "secondary": ["hill_grasslands", "scattered_woodlands", "shrublands", "valley_forests"], + "characteristics": [ + "elevation_gradient_adaptation", + "diverse_microhabitats", + "slope_aspect_variation", + "mixed_vegetation_types", + "erosion_resistance" + ], + "forest_compatibility": "partial_woodlands", + "note": "Diverse vegetation zones based on slope orientation and elevation" + }, + + "environmental_properties": { + "topographic_diversity": 2.5, + "drainage_quality": 2.2, + "microclimate_variation": 2.3, + "erosion_control": 1.8, + "scenic_value": 2.4, + "biodiversity": 1.6 + }, + + "resource_modifiers": { + "mixed_agriculture": 1.4, + "livestock_grazing": 1.8, + "forestry": 1.2, + "stone_quarrying": 1.6, + "wind_energy": 1.3, + "water_sources": 1.5, + "tourism": 1.9, + "industrial_suitability": 1.1, + "transportation": 0.8, + "recreation": 2.1 + }, + + "industrial_considerations": { + "construction_requirements": [ + "slope_stabilization", + "terraced_construction", + "drainage_management", + "access_road_engineering" + ], + "advantages": [ + "natural_defensive_positions", + "diverse_resource_access", + "good_water_drainage", + "scenic_development_potential" + ], + "challenges": [ + "uneven_terrain_costs", + "erosion_management", + "transportation_complexity", + "varying_soil_conditions" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "elevated_positions": 1.8, + "natural_fortification": 1.6, + "observation_advantage": 2.0 + }, + "economic_factors": { + "construction_costs": 1.4, + "agricultural_diversity": 1.6, + "tourism_income": 1.8, + "transportation_costs": 1.3 + }, + "strategic_value": { + "tactical_advantage": 1.9, + "resource_diversity": 1.7, + "settlement_desirability": 1.8 + } + }, + + "topographic_features": { + "rolling_terrain": "gentle_to_moderate_slopes", + "valley_systems": "natural_drainage_and_shelter", + "ridge_lines": "elevated_transportation_routes", + "natural_terraces": "stepped_landscape_features" + }, + + "agricultural_potential": { + "terraced_farming": "slope_agriculture_adaptation", + "mixed_land_use": "crops_pasture_and_woodland", + "orchard_suitability": "fruit_trees_on_slopes", + "vineyard_potential": "wine_production_terrain" + }, + + "water_systems": { + "spring_sources": "hillside_water_emergence", + "creek_systems": "valley_drainage_networks", + "pond_potential": "natural_water_collection", + "watershed_management": "erosion_and_runoff_control" + }, + + "wildlife": { + "habitat_diversity": [ + "valley_woodland_species", + "grassland_animals", + "edge_habitat_specialists", + "slope_adapted_plants" + ], + "hunting_opportunities": 1.6, + "biodiversity": 1.6, + "wildlife_corridors": "natural_movement_pathways" + }, + + "settlement_patterns": { + "hilltop_settlements": "defensive_and_scenic_locations", + "valley_villages": "water_access_and_shelter", + "slope_farming": "terraced_agricultural_communities", + "ridge_transportation": "natural_road_corridors" + }, + + "seasonal_characteristics": { + "spring": "varied_blooming_times_by_elevation", + "summer": "diverse_microclimates_and_activities", + "autumn": "spectacular_color_displays", + "winter": "snow_variation_by_elevation_and_aspect" + }, + + "recreational_opportunities": { + "hiking_trails": 2.2, + "scenic_driving": 2.0, + "mountain_biking": 1.9, + "photography": 2.1, + "camping": 1.7, + "nature_education": 1.8 + }, + + "microclimate_zones": { + "south_facing_slopes": "warmer_and_drier_conditions", + "north_facing_slopes": "cooler_and_moister_conditions", + "valley_bottoms": "protected_and_humid_microclimates", + "ridge_tops": "exposed_and_windy_conditions" + }, + + "soil_characteristics": { + "slope_variation": "thinner_soils_on_slopes_deeper_in_valleys", + "drainage_quality": "generally_good_with_slope_advantage", + "erosion_potential": "managed_through_vegetation_cover", + "fertility_variation": "nutrient_accumulation_in_lower_areas" + }, + +} \ No newline at end of file diff --git a/gameData/Biomes/hot_desert.json b/gameData/Biomes/hot_desert.json new file mode 100644 index 0000000..f185c06 --- /dev/null +++ b/gameData/Biomes/hot_desert.json @@ -0,0 +1,165 @@ +{ + "biome_id": "hot_desert", + "display_name": "Hot Desert", + "description": "Arid regions with high temperatures and minimal rainfall, featuring specialized drought-adapted vegetation and extreme environmental conditions", + + "classification": { + "type": "normal_biome", + "priority": 11, + "token_requirements": { + "rain_tokens": {"max": 50, "condition": "minimal_rainfall"}, + "temperature": {"min": 20, "condition": "hot_climate"} + }, + "climate_conditions": { + "extreme_aridity": true, + "high_daytime_temperatures": true, + "cold_nighttime_temperatures": true, + "irregular_precipitation": true + }, + "elevation_range": { + "minimum": 0, + "maximum": 1200, + "typical_range": [200, 800], + "formation_zone": "continental_interiors_and_subtropical_zones" + }, + "generation_notes": { + "formation_process": "Created by minimal rain_tokens (≤50) combined with hot temperatures (≥20°C)", + "geographic_distribution": "Continental interiors and subtropical high-pressure zones without ITCZ influence", + "rarity": "Common - represents Sahara success pattern", + "minimum_area": 300, + "typical_area_range": [800, 3000], + "formation_priority": "High - represents successful Congo vs Sahara differentiation" + } + }, + + "vegetation": { + "primary": "drought_adapted_specialists", + "secondary": ["cacti", "succulents", "drought_deciduous_shrubs", "ephemeral_annuals"], + "characteristics": [ + "water_storage_organs", + "reduced_leaf_surface_area", + "waxy_protective_coatings", + "deep_tap_roots", + "CAM_photosynthesis" + ], + "forest_compatibility": false, + "note": "Only highly specialized plants can survive extreme water scarcity" + }, + + "environmental_properties": { + "water_scarcity": 2.8, + "solar_exposure": 3.0, + "temperature_extremes": 2.5, + "wind_exposure": 1.8, + "soil_aridity": 2.9, + "biodiversity": 0.3 + }, + + "resource_modifiers": { + "solar_energy": 2.5, + "mineral_deposits": 1.8, + "rare_earth_elements": 1.5, + "salt_deposits": 2.0, + "geothermal_energy": 1.4, + "agriculture": 0.1, + "forestry": 0.0, + "water_resources": 0.1, + "industrial_suitability": 1.2, + "tourism": 1.0 + }, + + "industrial_considerations": { + "construction_requirements": [ + "extreme_heat_resistance", + "sand_and_dust_protection", + "water_conservation_systems", + "thermal_insulation" + ], + "advantages": [ + "excellent_solar_energy_potential", + "exposed_mineral_resources", + "vast_open_spaces", + "minimal_environmental_constraints" + ], + "challenges": [ + "extreme_water_scarcity", + "temperature_stress_on_equipment", + "sandstorm_damage", + "worker_health_and_safety" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "natural_barrier": 2.0, + "difficult_logistics": 2.5, + "heat_exhaustion_advantage": 2.2 + }, + "economic_factors": { + "solar_farm_efficiency": 2.8, + "mineral_extraction_bonus": 1.7, + "water_importation_costs": 3.0, + "construction_heat_costs": 1.8 + }, + "strategic_value": { + "renewable_energy_hub": 2.7, + "resource_control": 1.9, + "natural_isolation": 2.3 + } + }, + + "survival_adaptations": { + "water_sources": [ + "rare_oases", + "underground_aquifers", + "seasonal_water_holes", + "dew_collection" + ], + "temperature_management": [ + "underground_shelter", + "thermal_mass_utilization", + "reflective_surfaces", + "shade_structures" + ], + "navigation_challenges": [ + "shifting_sand_dunes", + "heat_mirages", + "sandstorm_visibility", + "landmark_scarcity" + ] + }, + + "wildlife": { + "adapted_species": [ + "desert_reptiles", + "nocturnal_mammals", + "water_conserving_birds", + "specialized_insects" + ], + "hunting_opportunities": 0.3, + "biodiversity": 0.3, + "conservation_value": "specialized_endemic_species" + }, + + "climatic_patterns": { + "daily_temperature_cycle": "extreme_day_night_variation", + "seasonal_patterns": "hot_dry_vs_less_hot_dry", + "precipitation_events": "rare_but_intense_flash_floods", + "wind_patterns": "dust_storms_and_thermal_circulation" + }, + + "geological_features": { + "sand_dunes": "shifting_landscape_features", + "rock_outcroppings": "rare_shelter_and_navigation_points", + "salt_flats": "remnants_of_ancient_lakes", + "mineral_exposures": "valuable_surface_deposits" + }, + + "water_economy": { + "conservation_priority": "critical", + "sources": "extremely_limited_and_precious", + "management": "every_drop_must_be_utilized", + "technology": "advanced_conservation_required" + }, + +} \ No newline at end of file diff --git a/gameData/Biomes/hurricane_zone.json b/gameData/Biomes/hurricane_zone.json new file mode 100644 index 0000000..0b82a74 --- /dev/null +++ b/gameData/Biomes/hurricane_zone.json @@ -0,0 +1,100 @@ +{ + "biome_id": "hurricane_zone", + "display_name": "Hurricane Zone", + "description": "Coastal regions subjected to frequent hurricane activity, featuring storm-resistant vegetation and specialized ecosystems", + + "classification": { + "type": "special_climate_zone", + "priority": 6, + "token_requirements": { + "hurricane_tokens": {"min": 1, "condition": "greater_than_zero"} + }, + "climate_conditions": { + "high_wind_exposure": true, + "frequent_storm_activity": true, + "salt_spray_tolerance_required": true, + "coastal_proximity": true + }, + "elevation_range": { + "minimum": 0, + "maximum": 100, + "typical_range": [0, 50], + "formation_zone": "coastal_areas_near_sea_level" + }, + "generation_notes": { + "formation_process": "Created by hurricane_tokens from WindRegions with high wind_strength + high wetness", + "geographic_distribution": "Coastal areas in hurricane-prone latitudes", + "rarity": "Moderate - found along storm-prone coastlines", + "minimum_area": 50, + "typical_area_range": [100, 500] + } + }, + + "vegetation": { + "primary": "storm_resistant_palms", + "secondary": ["coastal_grasses", "mangrove_species", "salt_tolerant_shrubs"], + "characteristics": [ + "deep_root_systems", + "flexible_trunks", + "salt_tolerance", + "rapid_recovery_after_storms" + ], + "forest_compatibility": false, + "note": "Traditional forests cannot survive the frequent high-wind disturbances" + }, + + "environmental_properties": { + "storm_resistance": 3.0, + "coastal_access": 2.0, + "wind_energy_potential": 2.5, + "biodiversity": 1.2, + "soil_stability": 0.6, + "water_drainage": 1.8 + }, + + "resource_modifiers": { + "wind_energy": 2.5, + "seafood": 1.8, + "storm_resistant_materials": 2.0, + "agriculture": 0.4, + "forestry": 0.1, + "industrial_suitability": 0.6, + "tourism_potential": 1.4 + }, + + "industrial_considerations": { + "construction_requirements": [ + "hurricane_resistant_buildings", + "elevated_foundations", + "storm_surge_protection" + ], + "advantages": [ + "excellent_wind_energy_sites", + "natural_harbors_from_storm_carving", + "unique_marine_resources" + ], + "challenges": [ + "seasonal_evacuation_needs", + "infrastructure_maintenance_costs", + "limited_agricultural_productivity" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "coastal_fortification_bonus": 1.5, + "storm_shelter_effectiveness": 2.0 + }, + "economic_factors": { + "insurance_costs": 2.5, + "reconstruction_frequency": "seasonal", + "specialized_industry_bonus": 1.3 + }, + "strategic_value": { + "naval_base_suitability": 1.8, + "early_warning_systems": 2.0, + "hurricane_tracking_advantage": true + } + }, + +} \ No newline at end of file diff --git a/gameData/Biomes/rocky_plateau.json b/gameData/Biomes/rocky_plateau.json new file mode 100644 index 0000000..2c424fb --- /dev/null +++ b/gameData/Biomes/rocky_plateau.json @@ -0,0 +1,194 @@ +{ + "biome_id": "rocky_plateau", + "display_name": "Rocky Plateau", + "description": "Elevated flat-topped landforms with exposed bedrock, thin soils, and hardy vegetation adapted to wind exposure and rocky terrain", + + "classification": { + "type": "normal_biome", + "priority": 18, + "token_requirements": { + "elevation": {"min": 800, "condition": "elevated_terrain"}, + "rain_tokens": {"min": 100, "max": 400, "condition": "moderate_to_low_moisture"} + }, + "climate_conditions": { + "elevated_exposure": true, + "strong_winds": true, + "thin_soils": true, + "temperature_extremes": true, + "good_drainage": true + }, + "elevation_range": { + "minimum": 800, + "typical_range": [1000, 2500], + "formation_zone": "elevated_flat_topped_terrain" + }, + "generation_notes": { + "formation_process": "Created by elevated terrain (≥800m) with moderate to low moisture (100-400 rain_tokens)", + "geographic_distribution": "Elevated areas with resistant geology and moderate precipitation", + "rarity": "Uncommon - requires specific geological and climatic conditions", + "minimum_area": 75, + "typical_area_range": [150, 600] + } + }, + + "vegetation": { + "primary": "rocky_terrain_specialists", + "secondary": ["plateau_grasses", "hardy_shrubs", "rock_garden_plants", "windswept_trees"], + "characteristics": [ + "rock_crevice_adaptation", + "wind_resistance", + "drought_tolerance", + "shallow_root_systems", + "hardy_constitution" + ], + "forest_compatibility": "stunted_woodlands_only", + "note": "Vegetation limited by thin soils and wind exposure" + }, + + "environmental_properties": { + "rock_exposure": 2.8, + "wind_exposure": 2.6, + "soil_depth": 0.4, + "drainage_quality": 2.9, + "temperature_variation": 2.3, + "erosion_resistance": 2.5, + "biodiversity": 0.9 + }, + + "resource_modifiers": { + "stone_quarrying": 2.5, + "mineral_extraction": 2.2, + "wind_energy": 2.3, + "solar_energy": 1.9, + "water_collection": 1.4, + "grazing_land": 0.6, + "agriculture": 0.3, + "forestry": 0.4, + "tourism": 1.7, + "industrial_suitability": 1.3 + }, + + "industrial_considerations": { + "construction_requirements": [ + "rock_drilling_and_blasting", + "wind_resistant_structures", + "water_importation_systems", + "specialized_foundation_work" + ], + "advantages": [ + "excellent_building_stone_access", + "stable_geological_foundation", + "commanding_views_and_positions", + "wind_and_solar_energy_potential" + ], + "challenges": [ + "limited_water_sources", + "difficult_excavation", + "extreme_wind_exposure", + "thin_soil_for_agriculture" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "natural_fortress": 2.8, + "observation_advantage": 2.9, + "difficult_approach": 2.4 + }, + "economic_factors": { + "quarrying_income": 2.4, + "construction_costs": 2.2, + "water_importation_costs": 2.6, + "energy_generation_bonus": 2.1 + }, + "strategic_value": { + "territorial_control": 2.7, + "communication_advantage": 2.8, + "resource_monopoly": 2.3 + } + }, + + "geological_features": { + "bedrock_exposure": "extensive_rock_outcroppings", + "flat_topped_terrain": "erosion_resistant_caprock", + "cliff_edges": "dramatic_escarpments", + "joint_and_fracture_systems": "natural_stone_quarrying_sites" + }, + + "water_systems": { + "surface_runoff": "rapid_drainage_with_minimal_retention", + "rock_pools": "temporary_water_collection_in_depressions", + "spring_emergence": "water_sources_at_plateau_edges", + "cistern_potential": "artificial_water_storage_in_rock" + }, + + "wildlife": { + "adapted_species": [ + "cliff_dwelling_birds", + "rock_crevice_mammals", + "hardy_reptiles", + "wind_dispersed_plants" + ], + "hunting_opportunities": 0.8, + "biodiversity": 0.9, + "conservation_value": "specialized_rocky_habitat_species" + }, + + "wind_patterns": { + "exposure_effects": "constant_wind_stress_on_vegetation", + "wind_channeling": "increased_velocity_over_flat_surfaces", + "turbulence_zones": "complex_airflow_around_edges", + "energy_potential": "excellent_wind_farm_locations" + }, + + "agricultural_limitations": { + "soil_depth": "insufficient_for_most_crops", + "water_scarcity": "irrigation_challenges", + "wind_damage": "crop_protection_difficulties", + "specialized_techniques": "rock_garden_and_terrace_farming" + }, + + "construction_opportunities": { + "castle_and_fort_sites": "natural_defensive_positions", + "observation_towers": "communication_and_surveillance", + "wind_farms": "optimal_renewable_energy_sites", + "quarry_operations": "building_stone_extraction" + }, + + "seasonal_characteristics": { + "winter": "extreme_wind_chill_and_ice_formation", + "spring": "brief_flowering_in_protected_crevices", + "summer": "intense_heat_reflection_from_rock", + "autumn": "dramatic_temperature_swings" + }, + + "erosion_patterns": { + "differential_weathering": "harder_rocks_form_resistant_caps", + "joint_widening": "freeze_thaw_processes", + "surface_scaling": "temperature_expansion_effects", + "chemical_weathering": "slow_soil_formation_processes" + }, + + "recreational_uses": { + "rock_climbing": 2.2, + "hiking_and_exploration": 1.8, + "photography": 2.0, + "astronomical_observation": 2.3, + "paragliding_launch": 2.1 + }, + + "microhabitats": { + "rock_crevices": "protected_growing_spaces", + "lee_slopes": "wind_protection_zones", + "water_collection_areas": "temporary_moist_zones", + "exposed_surfaces": "extreme_environment_specialists" + }, + + "formation_requirements": { + "geological_stability": "resistant_caprock_preservation", + "elevation_maintenance": "ongoing_uplift_or_erosion_resistance", + "climate_balance": "enough_moisture_for_some_vegetation", + "time_scale": "long_term_landscape_evolution" + }, + +} \ No newline at end of file diff --git a/gameData/Biomes/rocky_shore.json b/gameData/Biomes/rocky_shore.json new file mode 100644 index 0000000..c71d618 --- /dev/null +++ b/gameData/Biomes/rocky_shore.json @@ -0,0 +1,110 @@ +{ + "biome_id": "rocky_shore", + "display_name": "Rocky Shore", + "description": "Rugged coastal areas with exposed bedrock, tidal pools and rich marine ecosystems", + + "classification": { + "type": "special_climate_zone", + "priority": 5, + "token_requirements": { + "rain_tokens": {"min": 120, "condition": "moderate_coastal_precipitation"}, + "coastal_proximity": {"max": 2, "condition": "immediate_ocean_access"}, + "rock_exposure": {"min": 1, "condition": "bedrock_substrate"} + }, + "climate_conditions": { + "intense_salt_spray": true, + "tidal_variation_extreme": true, + "wave_action_strong": true, + "maritime_influence": true + }, + "elevation_range": { + "minimum": 0, + "maximum": 25, + "typical_range": [0, 10], + "formation_zone": "low_rocky_coastal_areas_with_tidal_exposure" + }, + "generation_notes": { + "formation_process": "Created by moderate rainfall with rocky coastal proximity", + "geographic_distribution": "Rocky coastlines with exposed bedrock and tidal zones", + "rarity": "Common - many temperate and cold coastlines", + "minimum_area": 60, + "typical_area_range": [120, 400] + } + }, + + "vegetation": { + "primary": "rock_crevice_specialists", + "secondary": ["maritime_lichens", "salt_marsh_edges", "cliff_grasses", "seaweed_beds"], + "characteristics": [ + "extreme_salt_tolerance", + "tidal_submersion_resistance", + "rock_crevice_growth", + "wave_impact_tolerance", + "minimal_soil_requirements" + ], + "forest_compatibility": false, + "note": "Highly specialized flora adapted to harsh intertidal conditions" + }, + + "environmental_properties": { + "salt_exposure": 3.0, + "wave_impact": 2.8, + "tidal_variation": 2.9, + "rock_weathering": 2.2, + "marine_productivity": 2.6, + "biodiversity": 1.8 + }, + + "resource_modifiers": { + "marine_biology": 2.4, + "shellfish_harvesting": 2.6, + "seaweed_collection": 2.2, + "tidal_energy": 2.0, + "stone_quarrying": 1.8, + "research_value": 2.2, + "fishing": 2.0, + "tourism": 1.6, + "agriculture": 0.1, + "forestry": 0.0, + "industrial_suitability": 0.5 + }, + + "industrial_considerations": { + "construction_requirements": [ + "extreme_salt_corrosion_protection", + "wave_impact_resistant_design", + "tidal_flood_management", + "rock_anchor_foundation_systems" + ], + "advantages": [ + "solid_bedrock_foundations", + "natural_wave_barriers", + "rich_marine_resource_access", + "tidal_energy_potential" + ], + "challenges": [ + "extreme_corrosion_environment", + "limited_flat_construction_space", + "tidal_flooding_issues", + "harsh_working_conditions" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "natural_barriers": 2.4, + "amphibious_defense": 2.6 + }, + "economic_factors": { + "marine_harvesting_bonus": 2.4, + "extreme_maintenance_costs": 2.8, + "research_station_value": 2.2, + "tidal_energy_income": 2.0 + }, + "strategic_value": { + "marine_resource_control": 2.4, + "coastal_observation": 2.0, + "scientific_research": 2.2 + } + } +} \ No newline at end of file diff --git a/gameData/Biomes/sandy_coast.json b/gameData/Biomes/sandy_coast.json new file mode 100644 index 0000000..ab41bce --- /dev/null +++ b/gameData/Biomes/sandy_coast.json @@ -0,0 +1,109 @@ +{ + "biome_id": "sandy_coast", + "display_name": "Sandy Coast", + "description": "Expansive sandy beaches and dune systems with dynamic coastal environment and tourism potential", + + "classification": { + "type": "special_climate_zone", + "priority": 4, + "token_requirements": { + "rain_tokens": {"min": 100, "condition": "moderate_coastal_precipitation"}, + "coastal_proximity": {"max": 3, "condition": "close_ocean_access"}, + "sediment_availability": {"min": 1, "condition": "sandy_substrate"} + }, + "climate_conditions": { + "maritime_influence": true, + "sand_mobility": true, + "moderate_salt_exposure": true, + "dune_formation_active": true + }, + "elevation_range": { + "minimum": 0, + "maximum": 30, + "typical_range": [0, 15], + "formation_zone": "low_coastal_areas_with_sandy_substrate" + }, + "generation_notes": { + "formation_process": "Created by moderate rainfall with sandy coastal proximity", + "geographic_distribution": "Sandy beaches, dune systems, barrier islands", + "rarity": "Common - major tourist and recreational coastlines", + "minimum_area": 80, + "typical_area_range": [150, 600] + } + }, + + "vegetation": { + "primary": "dune_stabilizing_plants", + "secondary": ["beach_grasses", "salt_tolerant_shrubs", "coastal_pines", "dune_flowers"], + "characteristics": [ + "sand_stabilization", + "salt_spray_tolerance", + "deep_root_systems", + "wind_resistance", + "seasonal_adaptation" + ], + "forest_compatibility": "coastal_pine_forests_only", + "note": "Specialized vegetation for mobile sand environments" + }, + + "environmental_properties": { + "sand_mobility": 2.4, + "salt_tolerance": 2.2, + "wind_exposure": 2.0, + "erosion_variability": 2.3, + "tourism_appeal": 2.8, + "biodiversity": 1.4 + }, + + "resource_modifiers": { + "tourism": 2.8, + "recreation": 2.6, + "fishing": 1.8, + "sand_extraction": 2.2, + "wind_energy": 1.6, + "salt_production": 1.4, + "agriculture": 0.4, + "forestry": 0.6, + "industrial_suitability": 0.8, + "coastal_development": 2.4 + }, + + "industrial_considerations": { + "construction_requirements": [ + "sand_stabilization_systems", + "hurricane_storm_surge_protection", + "seasonal_erosion_management", + "foundation_sand_compaction" + ], + "advantages": [ + "excellent_tourism_development", + "recreational_beach_access", + "sand_construction_materials", + "flat_development_terrain" + ], + "challenges": [ + "seasonal_storm_damage", + "sand_erosion_and_mobility", + "limited_freshwater_access", + "environmental_protection_regulations" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "amphibious_landing_zones": 1.8, + "coastal_monitoring": 1.6 + }, + "economic_factors": { + "tourism_revenue": 2.8, + "seasonal_income_variation": 2.2, + "beach_maintenance_costs": 1.6, + "sand_resource_income": 2.2 + }, + "strategic_value": { + "recreational_development": 2.8, + "coastal_access": 2.4, + "tourism_infrastructure": 2.6 + } + } +} \ No newline at end of file diff --git a/gameData/Biomes/scrubland.json b/gameData/Biomes/scrubland.json new file mode 100644 index 0000000..1c09b96 --- /dev/null +++ b/gameData/Biomes/scrubland.json @@ -0,0 +1,158 @@ +{ + "biome_id": "scrubland", + "display_name": "Scrubland", + "description": "Semi-arid transition zones with sparse vegetation, scattered shrubs and bushes, serving as fallback biome for indeterminate climate conditions", + + "classification": { + "type": "normal_biome", + "priority": 1, + "token_requirements": { + "_comment": "Fallback biome - no specific requirements, catches all unmatched areas" + }, + "climate_conditions": { + "moderate_aridity": true, + "variable_temperatures": true, + "irregular_precipitation": true, + "transitional_zone": true + }, + "elevation_range": { + "minimum": 0, + "maximum": 1500, + "typical_range": [200, 800], + "formation_zone": "transition_areas_between_major_biomes" + }, + "generation_notes": { + "formation_process": "Default fallback biome for areas not matching specific climate criteria", + "geographic_distribution": "Transition zones, climate boundaries, indeterminate areas", + "rarity": "Common - appears where other biomes don't fit", + "minimum_area": 50, + "typical_area_range": [100, 500] + } + }, + + "vegetation": { + "primary": "mixed_shrubs_and_bushes", + "secondary": ["drought_tolerant_shrubs", "hardy_grasses", "scattered_small_trees", "thorny_bushes"], + "characteristics": [ + "sparse_vegetation_cover", + "drought_adaptation", + "mixed_growth_patterns", + "seasonal_variation", + "opportunistic_growth" + ], + "forest_compatibility": "scattered_trees_only", + "note": "Adaptable vegetation that survives in variable conditions" + }, + + "environmental_properties": { + "vegetation_density": 1.2, + "soil_stability": 1.4, + "erosion_resistance": 1.1, + "water_retention": 1.0, + "fire_risk": 1.6, + "biodiversity": 1.1 + }, + + "resource_modifiers": { + "agriculture": 0.7, + "livestock_grazing": 1.4, + "small_game_hunting": 1.2, + "medicinal_plants": 1.3, + "thorny_wood": 1.1, + "wind_energy": 1.2, + "solar_energy": 1.3, + "forestry": 0.3, + "industrial_suitability": 0.8, + "tourism": 0.6 + }, + + "industrial_considerations": { + "construction_requirements": [ + "basic_ground_preparation", + "seasonal_weather_adaptation", + "dust_and_wind_protection" + ], + "advantages": [ + "low_environmental_restrictions", + "moderate_construction_costs", + "good_solar_exposure", + "reasonable_access_routes" + ], + "challenges": [ + "limited_water_availability", + "variable_soil_conditions", + "fire_risk_management", + "dust_storm_considerations" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "moderate_concealment": 1.2, + "irregular_terrain_advantage": 1.1 + }, + "economic_factors": { + "low_development_costs": 1.3, + "moderate_maintenance_costs": 1.1, + "grazing_income": 1.4 + }, + "strategic_value": { + "transition_zone_control": 1.2, + "buffer_territory": 1.3, + "fallback_settlement": 1.1 + } + }, + + "seasonal_patterns": { + "wet_season": { + "conditions": "increased_vegetation_growth_and_temporary_blooming", + "opportunities": "grazing_improvement_and_limited_agriculture", + "wildlife": "increased_activity_and_breeding" + }, + "dry_season": { + "conditions": "vegetation_dormancy_and_increased_fire_risk", + "challenges": "water_scarcity_and_livestock_stress", + "wildlife": "reduced_activity_and_migration" + } + }, + + "wildlife": { + "adapted_species": [ + "small_mammals", + "ground_birds", + "reptiles", + "hardy_insects" + ], + "hunting_opportunities": 1.2, + "biodiversity": 1.1, + "conservation_value": "moderate_ecosystem_diversity" + }, + + "soil_characteristics": { + "soil_type": "variable_sandy_clay_soils", + "organic_matter": "moderate_due_to_mixed_vegetation", + "drainage": "generally_well_drained_with_seasonal_variation", + "erosion_risk": "moderate_especially_during_dry_periods" + }, + + "land_use_potential": { + "extensive_grazing": "primary_economic_use", + "limited_agriculture": "drought_resistant_crops_only", + "renewable_energy": "good_solar_and_wind_potential", + "rural_settlements": "viable_with_water_management" + }, + + "water_management": { + "water_sources": "seasonal_streams_and_groundwater", + "conservation_needs": "essential_for_any_development", + "irrigation_potential": "limited_but_possible_with_investment", + "drought_resilience": "moderate_natural_adaptation" + }, + + "fire_ecology": { + "natural_fire_frequency": "irregular_seasonal_fires", + "fire_adaptation": "mixed_vegetation_recovery_rates", + "fire_management": "controlled_burns_for_grazing_improvement", + "fire_prevention": "firebreaks_and_early_warning_systems" + } +} \ No newline at end of file diff --git a/gameData/Biomes/storm_prairie.json b/gameData/Biomes/storm_prairie.json new file mode 100644 index 0000000..c61d8b3 --- /dev/null +++ b/gameData/Biomes/storm_prairie.json @@ -0,0 +1,131 @@ +{ + "biome_id": "storm_prairie", + "display_name": "Storm Prairie", + "description": "Windswept grasslands in high-wind zones with sufficient rainfall, featuring wind-resistant vegetation but hostile to forest growth", + + "classification": { + "type": "special_climate_zone", + "priority": 7, + "token_requirements": { + "highWind_tokens": {"min": 2, "condition": "above_storm_threshold"}, + "rain_tokens": {"min": 300, "condition": "sufficient_moisture"} + }, + "climate_conditions": { + "frequent_high_winds": true, + "adequate_rainfall": true, + "temperature_suitable_for_growth": true, + "forest_growth_prevented": true + }, + "elevation_range": { + "minimum": 100, + "maximum": 1000, + "typical_range": [200, 800], + "formation_zone": "interior_continental_areas_with_wind_exposure" + }, + "generation_notes": { + "formation_process": "Created by highWind_tokens in areas with sufficient rain_tokens but prevented forest growth", + "geographic_distribution": "Interior continental areas with strong wind patterns", + "rarity": "Uncommon - requires specific combination of high wind and adequate rainfall", + "minimum_area": 100, + "typical_area_range": [200, 800] + } + }, + + "vegetation": { + "primary": "wind_resistant_grasslands", + "secondary": ["hardy_shrubs", "low_bushes", "wind_adapted_wildflowers"], + "characteristics": [ + "deep_root_systems", + "flexible_stems", + "low_profile_growth", + "rapid_regrowth_after_damage" + ], + "forest_compatibility": false, + "note": "High winds prevent tree establishment and growth" + }, + + "environmental_properties": { + "wind_energy": 2.0, + "grassland_productivity": 1.6, + "soil_conservation": 1.4, + "wildfire_resilience": 1.8, + "erosion_resistance": 1.3, + "carbon_storage": 1.2 + }, + + "resource_modifiers": { + "wind_energy": 2.0, + "grazing_land": 1.8, + "wild_game": 1.4, + "medicinal_herbs": 1.3, + "honey_production": 1.6, + "agriculture": 0.7, + "forestry": 0.0, + "industrial_suitability": 1.1, + "recreation": 1.2 + }, + + "industrial_considerations": { + "construction_requirements": [ + "wind_resistant_building_design", + "deep_foundations", + "aerodynamic_structures", + "flexible_infrastructure" + ], + "advantages": [ + "excellent_wind_energy_potential", + "wide_open_spaces_for_development", + "good_soil_for_adapted_agriculture", + "natural_firebreaks" + ], + "challenges": [ + "constant_wind_stress_on_structures", + "limited_natural_windbreaks", + "difficulty_establishing_trees", + "seasonal_wind_variations" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "open_terrain_visibility": 2.0, + "difficult_approach": 1.3 + }, + "economic_factors": { + "wind_farm_efficiency": 2.2, + "livestock_grazing_bonus": 1.5, + "construction_wind_resistance_costs": 1.4 + }, + "strategic_value": { + "renewable_energy_hub": 2.5, + "cavalry_and_vehicle_advantage": 1.8, + "early_warning_systems": 1.9 + } + }, + + "seasonal_variations": { + "growing_season": { + "grass_growth_peak": "spring_and_early_summer", + "wildflower_blooms": "creating_temporary_beauty", + "wildlife_activity": "peak_grazing_and_nesting" + }, + "wind_patterns": { + "storm_season": "maximum_wind_intensity", + "calm_periods": "rare_opportunities_for_maintenance", + "seasonal_wind_direction_changes": "affecting_energy_generation" + } + }, + + "wildlife": { + "adapted_species": [ + "prairie_dogs", + "wind_resistant_birds", + "grazing_herbivores", + "burrowing_mammals" + ], + "hunting_opportunities": 1.4, + "biodiversity": 1.1, + "migration_routes": "important_stopover_for_wind_dispersed_species" + }, + +} \ No newline at end of file diff --git a/gameData/Biomes/temperate_forest.json b/gameData/Biomes/temperate_forest.json new file mode 100644 index 0000000..e819ae7 --- /dev/null +++ b/gameData/Biomes/temperate_forest.json @@ -0,0 +1,157 @@ +{ + "biome_id": "temperate_forest", + "display_name": "Temperate Forest", + "description": "Deciduous and mixed forests in moderate climate zones with seasonal variations, balanced temperature and moderate rainfall", + + "classification": { + "type": "normal_biome", + "priority": 12, + "token_requirements": { + "rain_tokens": {"min": 300, "condition": "moderate_rainfall"}, + "temperature": {"min": 15, "max": 25, "condition": "temperate_climate"} + }, + "climate_conditions": { + "moderate_temperatures": true, + "seasonal_variation": true, + "adequate_rainfall": true, + "winter_dormancy_period": true + }, + "elevation_range": { + "minimum": 0, + "maximum": 1200, + "typical_range": [100, 800], + "formation_zone": "mid_latitude_regions_with_seasonal_climate" + }, + "generation_notes": { + "formation_process": "Created by moderate rain_tokens (300+) with temperate temperatures (15-25°C)", + "geographic_distribution": "Mid-latitude regions with seasonal climate patterns", + "rarity": "Common - standard forest biome in temperate zones", + "minimum_area": 150, + "typical_area_range": [300, 1200] + } + }, + + "vegetation": { + "primary": "deciduous_and_mixed_forests", + "secondary": ["oak_maple_forests", "beech_birch_woodlands", "mixed_coniferous_deciduous"], + "characteristics": [ + "seasonal_leaf_drop", + "cold_adaptation", + "moderate_growth_rates", + "diverse_understory", + "autumn_color_displays" + ], + "forest_compatibility": true, + "note": "Classic forest ecosystem with seasonal adaptations" + }, + + "environmental_properties": { + "biodiversity": 1.8, + "carbon_storage": 1.9, + "seasonal_beauty": 2.5, + "soil_quality": 2.0, + "water_regulation": 1.7, + "wildlife_habitat": 2.2 + }, + + "resource_modifiers": { + "wood": 1.5, + "paper_products": 1.8, + "maple_syrup": 2.0, + "nuts_and_berries": 1.6, + "mushrooms": 1.7, + "wildlife": 1.8, + "agriculture": 1.2, + "industrial_suitability": 0.7, + "tourism": 2.0, + "recreation": 2.2 + }, + + "industrial_considerations": { + "construction_requirements": [ + "seasonal_weather_protection", + "foundation_frost_protection", + "moderate_humidity_control" + ], + "advantages": [ + "sustainable_timber_production", + "good_construction_conditions", + "reliable_water_sources", + "moderate_climate_for_workers" + ], + "challenges": [ + "seasonal_access_limitations", + "winter_construction_delays", + "forest_clearing_requirements", + "environmental_protection_laws" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "natural_concealment": 1.8, + "seasonal_tactical_variation": 1.6 + }, + "economic_factors": { + "sustainable_resource_income": 1.8, + "seasonal_tourism_peaks": 2.0, + "moderate_construction_costs": 1.0 + }, + "strategic_value": { + "resource_sustainability": 2.0, + "population_support": 1.8, + "defensive_terrain": 1.6 + } + }, + + "seasonal_cycle": { + "spring": { + "characteristics": "leaf_emergence_and_flowering", + "activities": "planting_and_early_harvesting", + "wildlife": "breeding_and_migration" + }, + "summer": { + "characteristics": "full_canopy_and_peak_growth", + "activities": "maximum_productivity_period", + "wildlife": "peak_activity_and_abundance" + }, + "autumn": { + "characteristics": "leaf_color_change_and_fall", + "activities": "harvest_and_preparation", + "wildlife": "migration_and_preparation" + }, + "winter": { + "characteristics": "dormancy_and_snow_cover", + "activities": "planning_and_indoor_work", + "wildlife": "hibernation_and_adaptation" + } + }, + + "wildlife": { + "diversity_index": 1.8, + "game_animals": [ + "deer", + "wild_boar", + "small_mammals", + "forest_birds" + ], + "hunting_opportunities": 1.8, + "conservation_value": "moderate_biodiversity_and_ecosystem_services" + }, + + "forest_management": { + "sustainable_harvesting": "selective_cutting_and_rotation", + "regeneration": "natural_and_assisted_forest_renewal", + "fire_management": "controlled_burns_and_fire_prevention", + "pest_control": "integrated_pest_management" + }, + + "recreation_opportunities": { + "hiking_and_trails": 2.0, + "camping": 1.8, + "wildlife_watching": 1.9, + "autumn_foliage_tourism": 2.5, + "hunting_and_fishing": 1.7 + }, + +} \ No newline at end of file diff --git a/gameData/Biomes/tropical_rainforest.json b/gameData/Biomes/tropical_rainforest.json new file mode 100644 index 0000000..0b0b133 --- /dev/null +++ b/gameData/Biomes/tropical_rainforest.json @@ -0,0 +1,147 @@ +{ + "biome_id": "tropical_rainforest", + "display_name": "Tropical Rainforest", + "description": "Dense, high-biodiversity forests in equatorial regions with high temperature and abundant rainfall, representing peak terrestrial biodiversity", + + "classification": { + "type": "normal_biome", + "priority": 10, + "token_requirements": { + "rain_tokens": {"min": 500, "condition": "abundant_rainfall"}, + "temperature": {"min": 25, "condition": "tropical_heat"} + }, + "climate_conditions": { + "high_temperature": true, + "abundant_rainfall": true, + "high_humidity": true, + "minimal_seasonal_variation": true + }, + "elevation_range": { + "minimum": 0, + "maximum": 1500, + "typical_range": [0, 800], + "formation_zone": "equatorial_lowlands_and_foothills" + }, + "generation_notes": { + "formation_process": "Created by high rain_tokens (500+) combined with tropical temperatures (25°C+)", + "geographic_distribution": "Equatorial regions with ITCZ influence and abundant moisture", + "rarity": "Moderate - requires specific combination of heat and extreme moisture", + "minimum_area": 200, + "typical_area_range": [500, 2000], + "formation_priority": "High - represents Congo Basin success pattern" + } + }, + + "vegetation": { + "primary": "multi_layered_forest_canopy", + "secondary": ["emergent_trees", "canopy_layer", "understory", "forest_floor"], + "characteristics": [ + "extreme_biodiversity", + "rapid_nutrient_cycling", + "vertical_stratification", + "epiphytic_communities", + "buttress_root_systems" + ], + "forest_compatibility": true, + "note": "Peak forest development with maximum biomass and species diversity" + }, + + "environmental_properties": { + "biodiversity": 3.0, + "carbon_storage": 2.8, + "oxygen_production": 2.5, + "water_regulation": 2.2, + "soil_protection": 2.0, + "climate_regulation": 2.3 + }, + + "resource_modifiers": { + "wood": 2.0, + "biodiversity": 3.0, + "medicinal_plants": 2.8, + "exotic_fruits": 2.5, + "rubber_and_latex": 2.2, + "spices": 2.0, + "agriculture": 0.8, + "industrial_suitability": 0.3, + "tourism": 2.4, + "research_value": 3.0 + }, + + "industrial_considerations": { + "construction_requirements": [ + "humidity_resistant_materials", + "elevated_foundations", + "pest_control_systems", + "climate_controlled_storage" + ], + "advantages": [ + "abundant_biological_resources", + "natural_pharmaceuticals", + "eco_tourism_potential", + "carbon_credit_opportunities" + ], + "challenges": [ + "extremely_difficult_construction", + "high_maintenance_costs", + "disease_and_pest_pressure", + "environmental_protection_requirements" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "natural_concealment": 2.5, + "difficult_terrain": 2.0, + "guerrilla_warfare_advantage": 2.8 + }, + "economic_factors": { + "construction_costs": 2.5, + "maintenance_difficulty": 2.3, + "biological_resource_income": 2.8, + "environmental_services_value": 3.0 + }, + "strategic_value": { + "natural_fortress": 2.2, + "resource_monopoly": 2.6, + "environmental_importance": 3.0 + } + }, + + "ecosystem_services": { + "climate_regulation": "global_carbon_cycling_and_oxygen_production", + "water_cycle": "rainfall_generation_and_watershed_protection", + "biodiversity_conservation": "highest_species_diversity_on_planet", + "soil_conservation": "preventing_erosion_and_maintaining_fertility" + }, + + "wildlife": { + "diversity_index": 3.0, + "endemic_species": "extremely_high", + "hunting_opportunities": 1.8, + "conservation_priority": "critical", + "research_opportunities": 3.0 + }, + + "layered_structure": { + "emergent_layer": "tallest_trees_reaching_60m_plus", + "canopy_layer": "main_photosynthetic_layer_30_45m", + "understory": "shade_adapted_plants_5_25m", + "forest_floor": "decomposition_and_nutrient_cycling" + }, + + "seasonal_patterns": { + "wet_season": "peak_growth_and_reproduction", + "dry_season": "minimal_but_still_adequate_rainfall", + "temperature_variation": "minimal_seasonal_change", + "biological_activity": "year_round_high_activity" + }, + + "formation_requirements": { + "temperature_stability": "consistent_warm_temperatures", + "rainfall_consistency": "year_round_abundant_water", + "soil_drainage": "well_drained_but_water_retentive", + "minimal_disturbance": "requires_stable_conditions_for_development" + }, + +} \ No newline at end of file diff --git a/gameData/Biomes/tundra.json b/gameData/Biomes/tundra.json new file mode 100644 index 0000000..018b613 --- /dev/null +++ b/gameData/Biomes/tundra.json @@ -0,0 +1,156 @@ +{ + "biome_id": "tundra", + "display_name": "Tundra", + "description": "Arctic and alpine regions with extremely cold temperatures, permafrost, and minimal vegetation adapted to harsh conditions", + + "classification": { + "type": "normal_biome", + "priority": 14, + "token_requirements": { + "temperature": {"max": -10, "condition": "extremely_cold"} + }, + "climate_conditions": { + "extremely_cold_temperatures": true, + "permafrost_layer": true, + "short_growing_season": true, + "low_precipitation": true + }, + "elevation_range": { + "minimum": 0, + "maximum": 2000, + "typical_range": [0, 500], + "formation_zone": "arctic_regions_and_high_mountain_areas" + }, + "generation_notes": { + "formation_process": "Created by extremely cold temperatures (≤-10°C) regardless of precipitation", + "geographic_distribution": "Arctic regions and high mountain areas", + "rarity": "Uncommon - limited to polar and high-altitude zones", + "minimum_area": 100, + "typical_area_range": [300, 1500] + } + }, + + "vegetation": { + "primary": "cold_adapted_specialists", + "secondary": ["mosses", "lichens", "dwarf_shrubs", "sedges"], + "characteristics": [ + "extremely_low_growth_forms", + "cold_tolerance", + "short_growing_season_adaptation", + "permafrost_root_systems", + "UV_radiation_protection" + ], + "forest_compatibility": false, + "note": "Only the most cold-adapted plants can survive permafrost conditions" + }, + + "environmental_properties": { + "permafrost_depth": 2.8, + "cold_extremes": 3.0, + "growing_season_length": 0.2, + "solar_radiation_extremes": 2.5, + "wind_exposure": 2.2, + "biodiversity": 0.3 + }, + + "resource_modifiers": { + "mineral_extraction": 1.6, + "oil_and_gas": 1.8, + "rare_earth_elements": 1.4, + "ice_and_freshwater": 2.0, + "wildlife_fur": 1.5, + "agriculture": 0.0, + "forestry": 0.0, + "renewable_energy": 0.8, + "industrial_suitability": 0.4, + "research_value": 2.2 + }, + + "industrial_considerations": { + "construction_requirements": [ + "permafrost_foundation_systems", + "extreme_cold_protection", + "heating_system_redundancy", + "ice_road_transportation" + ], + "advantages": [ + "mineral_and_energy_resources", + "natural_refrigeration", + "strategic_location_value", + "minimal_environmental_constraints" + ], + "challenges": [ + "extreme_construction_costs", + "permafrost_instability", + "transportation_difficulties", + "worker_safety_and_health" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "extreme_weather_advantage": 3.0, + "natural_fortress": 2.8, + "supply_line_difficulty": 3.2 + }, + "economic_factors": { + "extraction_bonus": 1.8, + "construction_costs": 4.0, + "heating_and_energy_costs": 3.5, + "specialized_equipment_requirements": 3.0 + }, + "strategic_value": { + "resource_control": 2.2, + "territorial_claims": 2.5, + "climate_research": 2.8 + } + }, + + "survival_challenges": { + "temperature_management": "critical_for_survival", + "food_scarcity": "hunting_and_imported_supplies", + "isolation": "extreme_remoteness_and_communication", + "equipment_failure": "catastrophic_in_cold_conditions" + }, + + "wildlife": { + "adapted_species": [ + "arctic_foxes", + "caribou_and_reindeer", + "polar_bears", + "migratory_birds" + ], + "hunting_opportunities": 1.5, + "biodiversity": 0.3, + "conservation_value": "unique_cold_adapted_species" + }, + + "seasonal_extremes": { + "polar_night": "months_of_darkness", + "midnight_sun": "months_of_continuous_daylight", + "temperature_variation": "extreme_seasonal_differences", + "ice_cycles": "freeze_thaw_permafrost_dynamics" + }, + + "permafrost_dynamics": { + "active_layer": "seasonal_thaw_zone", + "permafrost_table": "permanently_frozen_layer", + "thermokarst": "ground_collapse_from_thawing", + "frost_heave": "ground_expansion_from_freezing" + }, + + "research_opportunities": { + "climate_change_studies": 2.8, + "permafrost_research": 2.5, + "cold_adaptation_biology": 2.2, + "ice_core_paleoclimatology": 2.0 + }, + + "transportation": { + "ice_roads": "seasonal_transportation_corridors", + "aircraft_dependency": "primary_year_round_access", + "specialized_vehicles": "cold_weather_equipment_required", + "fuel_logistics": "critical_supply_chain_management" + }, + +} \ No newline at end of file diff --git a/gameData/Biomes/wetlands.json b/gameData/Biomes/wetlands.json new file mode 100644 index 0000000..5303724 --- /dev/null +++ b/gameData/Biomes/wetlands.json @@ -0,0 +1,124 @@ +{ + "biome_id": "wetlands", + "display_name": "Wetlands", + "description": "Marshy regions formed by recurring flood patterns, creating specialized aquatic ecosystems with high biodiversity", + + "classification": { + "type": "special_climate_zone", + "priority": 1, + "token_requirements": { + "flood_tokens": {"min": 3, "condition": "above_flood_threshold"} + }, + "climate_conditions": { + "frequent_flooding": true, + "high_water_table": true, + "poor_drainage": true, + "seasonal_water_variation": true + }, + "elevation_range": { + "minimum": -10, + "maximum": 200, + "typical_range": [0, 100], + "formation_zone": "low_lying_areas_with_poor_drainage" + }, + "generation_notes": { + "formation_process": "Created by flood_tokens from WindRegions with high wetness concentrations", + "geographic_distribution": "Low-lying areas with poor drainage and frequent flooding", + "rarity": "Common in flood-prone river deltas and coastal plains", + "minimum_area": 25, + "typical_area_range": [50, 300] + } + }, + + "vegetation": { + "primary": "marshes_and_swamps", + "secondary": ["cattails", "water_lilies", "cypress_trees", "bog_plants"], + "characteristics": [ + "water_adapted_root_systems", + "flood_tolerance", + "nutrient_cycling_specialists", + "methane_production" + ], + "forest_compatibility": "specialized_swamp_forests_only", + "note": "Only specialized flood-tolerant tree species can survive" + }, + + "environmental_properties": { + "water_resources": 2.5, + "biodiversity": 1.8, + "carbon_sequestration": 2.2, + "flood_control": 2.0, + "water_filtration": 2.3, + "methane_production": 1.6 + }, + + "resource_modifiers": { + "freshwater": 2.0, + "fish_and_waterfowl": 2.5, + "medicinal_plants": 1.7, + "peat": 2.8, + "natural_gas": 1.4, + "agriculture": 0.3, + "forestry": 0.5, + "industrial_suitability": 0.2, + "recreation": 1.6 + }, + + "industrial_considerations": { + "construction_requirements": [ + "pile_foundations", + "waterproof_construction", + "elevated_roads_and_platforms", + "specialized_drainage_systems" + ], + "advantages": [ + "natural_water_treatment", + "flood_protection_for_surrounding_areas", + "unique_ecosystem_services", + "peat_energy_source" + ], + "challenges": [ + "extremely_difficult_construction", + "seasonal_accessibility_issues", + "methane_emission_management", + "environmental_protection_requirements" + ] + }, + + "gameplay_effects": { + "defensive_bonuses": { + "natural_barrier": 1.8, + "difficult_terrain_advantage": 2.2 + }, + "economic_factors": { + "construction_costs": 3.0, + "maintenance_difficulty": 2.5, + "environmental_services_value": 2.0 + }, + "strategic_value": { + "natural_fortress": 1.9, + "water_control": 2.1, + "ecosystem_services": 2.3 + } + }, + + "special_features": { + "seasonal_variations": { + "wet_season": "maximum_biodiversity_and_inaccessibility", + "dry_season": "limited_access_for_construction_and_harvesting" + }, + "ecosystem_services": [ + "flood_control", + "water_purification", + "carbon_storage", + "wildlife_habitat" + ], + "environmental_hazards": [ + "methane_accumulation", + "disease_vectors", + "unstable_ground", + "toxic_plant_species" + ] + }, + +} \ No newline at end of file diff --git a/gameData/MapFeatures/aluminum.json b/gameData/MapFeatures/aluminum.json new file mode 100644 index 0000000..19893c4 --- /dev/null +++ b/gameData/MapFeatures/aluminum.json @@ -0,0 +1,40 @@ +{ + "aluminum_resources": { + "bauxite_deposit": { + "display_name": "Bauxite Deposit", + "description": "Primary aluminum ore with high aluminum oxide content ideal for smelting", + "formation_type": "tropical_laterite_weathering", + "extraction_difficulty": "medium", + "budget_impact": 4, + "resource_yield": "high", + "quality": "premium" + }, + "laterite_aluminum": { + "display_name": "Laterite Aluminum", + "description": "Weathered aluminum-rich soil formed in tropical climates", + "formation_type": "tropical_soil_weathering", + "extraction_difficulty": "easy", + "budget_impact": 3, + "resource_yield": "medium", + "quality": "standard" + }, + "nepheline_syenite": { + "display_name": "Nepheline Syenite", + "description": "Igneous rock with aluminum silicate minerals suitable for aluminum extraction", + "formation_type": "alkaline_igneous_intrusion", + "extraction_difficulty": "hard", + "budget_impact": 3, + "resource_yield": "medium", + "quality": "standard" + }, + "clay_aluminum": { + "display_name": "Aluminum Clay", + "description": "Clay deposits with elevated aluminum content requiring advanced processing", + "formation_type": "sedimentary_aluminum_concentration", + "extraction_difficulty": "very_hard", + "budget_impact": 2, + "resource_yield": "high", + "quality": "low" + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/anomalies.json b/gameData/MapFeatures/anomalies.json new file mode 100644 index 0000000..20b5136 --- /dev/null +++ b/gameData/MapFeatures/anomalies.json @@ -0,0 +1,40 @@ +{ + "anomalies": { + "magnetic_anomaly": { + "display_name": "Magnetic Anomaly", + "description": "Area with unusual magnetic properties affecting instruments and containing rare metals", + "formation_type": "magnetic_field", + "budget_impact": 2 + }, + "radio_silence_zone": { + "display_name": "Radio Silence Zone", + "description": "Mysterious area where radio communications are disrupted", + "formation_type": "electromagnetic", + "budget_impact": -1 + }, + "meteorite_impact": { + "display_name": "Meteorite Impact", + "description": "Site of ancient meteorite strike with rare metals and unique minerals", + "formation_type": "extraterrestrial", + "budget_impact": 5 + }, + "crystalline_formation": { + "display_name": "Crystalline Formation", + "description": "Natural crystal deposits with technological and commercial value", + "formation_type": "mineral_crystal", + "budget_impact": 2 + }, + "thermal_vent": { + "display_name": "Thermal Vent", + "description": "Underground heat source with geothermal energy potential", + "formation_type": "geothermal", + "budget_impact": 2 + }, + "unstable_ground": { + "display_name": "Unstable Ground", + "description": "Geologically unstable area prone to landslides and collapse", + "formation_type": "geological_instability", + "budget_impact": -3 + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/base_metals.json b/gameData/MapFeatures/base_metals.json new file mode 100644 index 0000000..6001667 --- /dev/null +++ b/gameData/MapFeatures/base_metals.json @@ -0,0 +1,58 @@ +{ + "base_metal_resources": { + "tin_placer": { + "display_name": "Tin Placer", + "description": "Cassiterite deposits concentrated in alluvial gravels and beach sands", + "formation_type": "alluvial_tin_concentration", + "extraction_difficulty": "easy", + "budget_impact": 3, + "resource_yield": "medium", + "quality": "standard" + }, + "tin_lode": { + "display_name": "Tin Lode", + "description": "Primary cassiterite ore in granite-related veins and greisen", + "formation_type": "granitic_tin_mineralization", + "extraction_difficulty": "hard", + "budget_impact": 4, + "resource_yield": "high", + "quality": "premium" + }, + "lead_galena": { + "display_name": "Lead Galena", + "description": "Primary lead sulfide ore often associated with silver and zinc", + "formation_type": "sulfide_mineralization", + "extraction_difficulty": "medium", + "budget_impact": 3, + "resource_yield": "high", + "quality": "standard" + }, + "lead_carbonate": { + "display_name": "Lead Carbonate", + "description": "Weathered lead ore with cerussite and anglesite minerals", + "formation_type": "lead_oxidation_zone", + "extraction_difficulty": "easy", + "budget_impact": 2, + "resource_yield": "medium", + "quality": "standard" + }, + "nickel_laterite": { + "display_name": "Nickel Laterite", + "description": "Tropical weathering deposit with garnierite and limonite nickel ores", + "formation_type": "laterite_nickel_weathering", + "extraction_difficulty": "medium", + "budget_impact": 4, + "resource_yield": "high", + "quality": "standard" + }, + "nickel_sulfide": { + "display_name": "Nickel Sulfide", + "description": "Primary nickel ore with pentlandite in mafic intrusions", + "formation_type": "magmatic_sulfide_segregation", + "extraction_difficulty": "hard", + "budget_impact": 5, + "resource_yield": "medium", + "quality": "premium" + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/coal.json b/gameData/MapFeatures/coal.json new file mode 100644 index 0000000..aa7ad73 --- /dev/null +++ b/gameData/MapFeatures/coal.json @@ -0,0 +1,58 @@ +{ + "coal_resources": { + "rich_coal_seam": { + "display_name": "Rich Coal Seam", + "description": "High-quality coal deposit with excellent heating value and low impurities", + "formation_type": "compressed_carboniferous_forest", + "extraction_difficulty": "medium", + "budget_impact": 4, + "resource_yield": "high", + "quality": "premium" + }, + "coal_seam": { + "display_name": "Coal Seam", + "description": "Standard coal deposit suitable for industrial and heating applications", + "formation_type": "compressed_carboniferous_forest", + "extraction_difficulty": "medium", + "budget_impact": 3, + "resource_yield": "medium", + "quality": "standard" + }, + "coal_outcrop": { + "display_name": "Coal Outcrop", + "description": "Surface-exposed coal formation easy to access but lower quality", + "formation_type": "exposed_carboniferous_forest", + "extraction_difficulty": "easy", + "budget_impact": 2, + "resource_yield": "medium", + "quality": "standard" + }, + "surface_coal": { + "display_name": "Surface Coal", + "description": "Weathered coal deposits scattered on surface with minimal extraction requirements", + "formation_type": "eroded_coal_seam", + "extraction_difficulty": "very_easy", + "budget_impact": 1, + "resource_yield": "low", + "quality": "low" + }, + "peat_bog": { + "display_name": "Peat Bog", + "description": "Early-stage coal formation providing low-grade fuel and soil amendment", + "formation_type": "partially_decomposed_organic_matter", + "extraction_difficulty": "easy", + "budget_impact": 1, + "resource_yield": "low", + "quality": "low" + }, + "lignite_deposit": { + "display_name": "Lignite Deposit", + "description": "Brown coal with moderate heating value, intermediate between peat and bituminous coal", + "formation_type": "intermediate_carboniferous_compression", + "extraction_difficulty": "medium", + "budget_impact": 2, + "resource_yield": "medium", + "quality": "medium" + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/coastal_features.json b/gameData/MapFeatures/coastal_features.json new file mode 100644 index 0000000..0a27ce1 --- /dev/null +++ b/gameData/MapFeatures/coastal_features.json @@ -0,0 +1,52 @@ +{ + "coastal_features": { + "sea_cave": { + "display_name": "Sea Cave", + "description": "Ocean-carved cavern accessible at low tide with marine ecosystems", + "formation_type": "marine_erosion", + "budget_impact": 2 + }, + "tidal_pool": { + "display_name": "Tidal Pool", + "description": "Rock depressions filled with seawater hosting unique marine life", + "formation_type": "tidal_formation", + "budget_impact": 1 + }, + "natural_harbor": { + "display_name": "Natural Harbor", + "description": "Sheltered coastal bay perfect for maritime activities and ports", + "formation_type": "coastal_geography", + "budget_impact": 3 + }, + "coral_reef": { + "display_name": "Coral Reef", + "description": "Living reef structure providing marine biodiversity and coastal protection", + "formation_type": "biological_formation", + "budget_impact": 2 + }, + "sea_stack": { + "display_name": "Sea Stack", + "description": "Isolated rocky pillar standing in shallow coastal waters", + "formation_type": "marine_erosion", + "budget_impact": 1 + }, + "beach_dunes": { + "display_name": "Beach Dunes", + "description": "Sand formations shaped by wind providing coastal protection", + "formation_type": "aeolian_formation", + "budget_impact": 1 + }, + "estuary": { + "display_name": "Estuary", + "description": "River mouth where freshwater meets saltwater creating rich ecosystems", + "formation_type": "fluvial_marine", + "budget_impact": 2 + }, + "blowhole": { + "display_name": "Blowhole", + "description": "Coastal rock formation that shoots water sprays during high waves", + "formation_type": "marine_erosion", + "budget_impact": 1 + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/copper.json b/gameData/MapFeatures/copper.json new file mode 100644 index 0000000..c7750de --- /dev/null +++ b/gameData/MapFeatures/copper.json @@ -0,0 +1,58 @@ +{ + "copper_resources": { + "porphyry_copper": { + "display_name": "Porphyry Copper", + "description": "Large-scale copper deposit in igneous intrusion with molybdenum traces", + "formation_type": "igneous_hydrothermal_intrusion", + "extraction_difficulty": "hard", + "budget_impact": 5, + "resource_yield": "very_high", + "quality": "premium" + }, + "copper_vein": { + "display_name": "Copper Vein", + "description": "High-grade copper ore in hydrothermal veins with excellent purity", + "formation_type": "hydrothermal_vein_formation", + "extraction_difficulty": "medium", + "budget_impact": 4, + "resource_yield": "high", + "quality": "premium" + }, + "chalcopyrite_deposit": { + "display_name": "Chalcopyrite Deposit", + "description": "Standard copper sulfide ore suitable for flotation processing", + "formation_type": "sulfide_mineralization", + "extraction_difficulty": "medium", + "budget_impact": 3, + "resource_yield": "medium", + "quality": "standard" + }, + "malachite_outcrop": { + "display_name": "Malachite Outcrop", + "description": "Green copper carbonate formation indicating deeper copper deposits", + "formation_type": "copper_oxidation_zone", + "extraction_difficulty": "easy", + "budget_impact": 2, + "resource_yield": "medium", + "quality": "standard" + }, + "native_copper": { + "display_name": "Native Copper", + "description": "Pure metallic copper deposits requiring minimal processing", + "formation_type": "basalt_flow_copper_precipitation", + "extraction_difficulty": "easy", + "budget_impact": 3, + "resource_yield": "low", + "quality": "premium" + }, + "copper_shale": { + "display_name": "Copper Shale", + "description": "Sedimentary copper deposit with low grade but large extent", + "formation_type": "sedimentary_copper_precipitation", + "extraction_difficulty": "very_hard", + "budget_impact": 2, + "resource_yield": "high", + "quality": "low" + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/cultural_sites.json b/gameData/MapFeatures/cultural_sites.json new file mode 100644 index 0000000..a89f64f --- /dev/null +++ b/gameData/MapFeatures/cultural_sites.json @@ -0,0 +1,40 @@ +{ + "cultural_sites": { + "ancient_ruins": { + "display_name": "Ancient Ruins", + "description": "Archaeological remains from past civilizations with historical value", + "formation_type": "archaeological", + "budget_impact": 1 + }, + "abandoned_village": { + "display_name": "Abandoned Village", + "description": "Deserted rural settlement with basic infrastructure", + "formation_type": "abandoned_settlement", + "budget_impact": 0 + }, + "old_monastery": { + "display_name": "Old Monastery", + "description": "Historic religious complex with stone architecture and strategic position", + "formation_type": "religious_heritage", + "budget_impact": 1 + }, + "castle_ruins": { + "display_name": "Castle Ruins", + "description": "Remains of medieval fortress with defensive advantages and stone materials", + "formation_type": "military_heritage", + "budget_impact": 2 + }, + "lighthouse": { + "display_name": "Lighthouse", + "description": "Coastal navigation aid with strategic maritime position", + "formation_type": "maritime_infrastructure", + "budget_impact": 1 + }, + "historical_cemetery": { + "display_name": "Historical Cemetery", + "description": "Old burial ground with cultural significance and central location", + "formation_type": "cultural_heritage", + "budget_impact": 1 + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/features_index.json b/gameData/MapFeatures/features_index.json new file mode 100644 index 0000000..c88fdd1 --- /dev/null +++ b/gameData/MapFeatures/features_index.json @@ -0,0 +1,45 @@ +{ + "feature_system_version": "1.0", + "description": "Map features catalog for procedural world generation", + "last_updated": "2024-09-29", + + "feature_categories": { + "geological_formations": { + "file": "geological_formations.json", + "description": "Natural rock and terrain formations", + "count": 10 + }, + "natural_landmarks": { + "file": "natural_landmarks.json", + "description": "Distinctive natural monuments and formations", + "count": 6 + }, + "water_features": { + "file": "water_features.json", + "description": "Lakes, rivers, springs and wetlands", + "count": 8 + }, + "industrial_ruins": { + "file": "industrial_ruins.json", + "description": "Abandoned industrial and military sites", + "count": 8 + }, + "anomalies": { + "file": "anomalies.json", + "description": "Unusual geological and electromagnetic phenomena", + "count": 6 + }, + "cultural_sites": { + "file": "cultural_sites.json", + "description": "Historical and archaeological locations", + "count": 6 + } + }, + + "generation_parameters": { + "placement_probability": 0.05, + "max_features_per_tile": 1, + "biome_filtering": true, + "budget_impact_range": [-3, 5] + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/forest_features.json b/gameData/MapFeatures/forest_features.json new file mode 100644 index 0000000..9245a28 --- /dev/null +++ b/gameData/MapFeatures/forest_features.json @@ -0,0 +1,52 @@ +{ + "forest_features": { + "ancient_grove": { + "display_name": "Ancient Grove", + "description": "Stand of extremely old trees with rare wood and spiritual significance", + "formation_type": "old_growth_forest", + "budget_impact": 3 + }, + "forest_clearing": { + "display_name": "Forest Clearing", + "description": "Natural open space within forest perfect for settlements", + "formation_type": "natural_opening", + "budget_impact": 1 + }, + "giant_tree": { + "display_name": "Giant Tree", + "description": "Massive individual tree suitable for treehouse construction", + "formation_type": "exceptional_growth", + "budget_impact": 2 + }, + "bamboo_grove": { + "display_name": "Bamboo Grove", + "description": "Dense bamboo forest with rapid growth and construction materials", + "formation_type": "bamboo_ecosystem", + "budget_impact": 1 + }, + "fruit_orchard": { + "display_name": "Wild Fruit Orchard", + "description": "Natural grove of fruit-bearing trees providing food resources", + "formation_type": "fruit_tree_cluster", + "budget_impact": 2 + }, + "medicinal_grove": { + "display_name": "Medicinal Grove", + "description": "Forest area rich in plants with pharmaceutical properties", + "formation_type": "medicinal_ecosystem", + "budget_impact": 2 + }, + "mushroom_grove": { + "display_name": "Mushroom Grove", + "description": "Forest area with abundant fungal growth and rare mushroom species", + "formation_type": "fungal_ecosystem", + "budget_impact": 1 + }, + "carboniferous_forest": { + "display_name": "Carboniferous Forest", + "description": "Ancient forest remnant with giant ferns and primitive trees, containing coal seams", + "formation_type": "paleozoic_relic", + "budget_impact": 4 + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/geological_formations.json b/gameData/MapFeatures/geological_formations.json new file mode 100644 index 0000000..2732cbc --- /dev/null +++ b/gameData/MapFeatures/geological_formations.json @@ -0,0 +1,64 @@ +{ + "geological_formations": { + "cave": { + "display_name": "Cave", + "description": "Natural underground cavern providing shelter and potential hidden resources", + "formation_type": "erosion", + "budget_impact": 1 + }, + "hot_spring": { + "display_name": "Hot Spring", + "description": "Geothermally heated groundwater emerging at surface", + "formation_type": "geothermal", + "budget_impact": 1 + }, + "canyon": { + "display_name": "Canyon", + "description": "Deep gorge carved by water erosion providing natural barriers", + "formation_type": "erosion", + "budget_impact": 0 + }, + "plateau": { + "display_name": "Plateau", + "description": "Elevated flat-topped landform with commanding views", + "formation_type": "erosion_resistant", + "budget_impact": 1 + }, + "geyser": { + "display_name": "Geyser", + "description": "Periodic eruption of heated groundwater and steam", + "formation_type": "geothermal", + "budget_impact": 2 + }, + "cliff": { + "display_name": "Cliff", + "description": "Steep vertical rock face formed by erosion or faulting", + "formation_type": "erosion_faulting", + "budget_impact": 0 + }, + "gorge": { + "display_name": "Gorge", + "description": "Narrow valley with steep rocky walls carved by water flow", + "formation_type": "water_erosion", + "budget_impact": 0 + }, + "natural_bridge": { + "display_name": "Natural Bridge", + "description": "Rock arch formation spanning across valleys or rivers", + "formation_type": "erosion_arch", + "budget_impact": 1 + }, + "sinkhole": { + "display_name": "Sinkhole", + "description": "Circular depression formed by underground water dissolution", + "formation_type": "karst_dissolution", + "budget_impact": -1 + }, + "spring": { + "display_name": "Spring", + "description": "Natural emergence of groundwater at surface", + "formation_type": "groundwater_emergence", + "budget_impact": 1 + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/gold.json b/gameData/MapFeatures/gold.json new file mode 100644 index 0000000..1a25007 --- /dev/null +++ b/gameData/MapFeatures/gold.json @@ -0,0 +1,58 @@ +{ + "gold_resources": { + "gold_lode": { + "display_name": "Gold Lode", + "description": "Primary gold deposit in quartz veins with high-grade ore concentrations", + "formation_type": "hydrothermal_quartz_vein", + "extraction_difficulty": "hard", + "budget_impact": 5, + "resource_yield": "medium", + "quality": "premium" + }, + "placer_gold": { + "display_name": "Placer Gold", + "description": "Alluvial gold deposits concentrated in river gravels and ancient streambeds", + "formation_type": "alluvial_gold_concentration", + "extraction_difficulty": "easy", + "budget_impact": 3, + "resource_yield": "medium", + "quality": "premium" + }, + "epithermal_gold": { + "display_name": "Epithermal Gold", + "description": "Shallow gold deposit formed by hot springs with silver associations", + "formation_type": "epithermal_mineralization", + "extraction_difficulty": "medium", + "budget_impact": 4, + "resource_yield": "high", + "quality": "premium" + }, + "residual_gold": { + "display_name": "Residual Gold", + "description": "Weathered gold deposits concentrated by erosion of primary sources", + "formation_type": "weathering_concentration", + "extraction_difficulty": "very_easy", + "budget_impact": 2, + "resource_yield": "low", + "quality": "premium" + }, + "conglomerate_gold": { + "display_name": "Conglomerate Gold", + "description": "Ancient gold deposits in fossil river conglomerates with uranium traces", + "formation_type": "paleozoic_conglomerate", + "extraction_difficulty": "very_hard", + "budget_impact": 4, + "resource_yield": "high", + "quality": "premium" + }, + "sulfide_gold": { + "display_name": "Sulfide Gold", + "description": "Gold associated with sulfide minerals requiring complex processing", + "formation_type": "sulfide_mineralization", + "extraction_difficulty": "very_hard", + "budget_impact": 3, + "resource_yield": "medium", + "quality": "standard" + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/industrial_ruins.json b/gameData/MapFeatures/industrial_ruins.json new file mode 100644 index 0000000..e96df69 --- /dev/null +++ b/gameData/MapFeatures/industrial_ruins.json @@ -0,0 +1,52 @@ +{ + "industrial_ruins": { + "terikon": { + "display_name": "Terikon", + "description": "Artificial hill of mining waste with recoverable materials but pollution", + "formation_type": "mining_waste", + "budget_impact": 0 + }, + "abandoned_factory": { + "display_name": "Abandoned Factory", + "description": "Derelict industrial facility with scrap metal and machinery", + "formation_type": "industrial_ruin", + "budget_impact": 1 + }, + "ghost_town": { + "display_name": "Ghost Town", + "description": "Deserted settlement with infrastructure but potential dangers", + "formation_type": "abandoned_settlement", + "budget_impact": -1 + }, + "tank_graveyard": { + "display_name": "Tank Graveyard", + "description": "Collection of abandoned military vehicles with valuable scrap metal", + "formation_type": "military_scrap", + "budget_impact": 2 + }, + "car_cemetery": { + "display_name": "Car Cemetery", + "description": "Abandoned vehicles providing civilian scrap metal", + "formation_type": "civilian_scrap", + "budget_impact": 1 + }, + "plane_wreckage": { + "display_name": "Plane Wreckage", + "description": "Crashed aircraft with rare aviation alloys and components", + "formation_type": "aviation_scrap", + "budget_impact": 3 + }, + "abandoned_mine": { + "display_name": "Abandoned Mine", + "description": "Old mining facility with potential resources but structural dangers", + "formation_type": "extraction_ruin", + "budget_impact": 0 + }, + "derelict_refinery": { + "display_name": "Derelict Refinery", + "description": "Abandoned oil processing facility with infrastructure but contamination", + "formation_type": "chemical_ruin", + "budget_impact": -2 + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/iron.json b/gameData/MapFeatures/iron.json new file mode 100644 index 0000000..95dedb1 --- /dev/null +++ b/gameData/MapFeatures/iron.json @@ -0,0 +1,67 @@ +{ + "iron_resources": { + "rich_iron_ore": { + "display_name": "Rich Iron Ore", + "description": "High-grade iron ore deposit with excellent purity and minimal processing requirements", + "formation_type": "banded_iron_formation", + "extraction_difficulty": "medium", + "budget_impact": 4, + "resource_yield": "very_high", + "quality": "premium" + }, + "iron_ore_vein": { + "display_name": "Iron Ore Vein", + "description": "Standard iron ore deposit suitable for industrial steel production", + "formation_type": "hydrothermal_iron_precipitation", + "extraction_difficulty": "medium", + "budget_impact": 3, + "resource_yield": "high", + "quality": "standard" + }, + "magnetite_deposit": { + "display_name": "Magnetite Deposit", + "description": "Magnetic iron ore with high iron content and easy magnetic separation", + "formation_type": "metamorphic_iron_concentration", + "extraction_difficulty": "easy", + "budget_impact": 3, + "resource_yield": "high", + "quality": "premium" + }, + "hematite_outcrop": { + "display_name": "Hematite Outcrop", + "description": "Surface-exposed iron oxide formation with moderate iron content", + "formation_type": "weathered_iron_oxidation", + "extraction_difficulty": "easy", + "budget_impact": 2, + "resource_yield": "medium", + "quality": "standard" + }, + "bog_iron": { + "display_name": "Bog Iron", + "description": "Iron deposits formed in wetlands through bacterial precipitation", + "formation_type": "biological_iron_precipitation", + "extraction_difficulty": "very_easy", + "budget_impact": 1, + "resource_yield": "low", + "quality": "low" + }, + "laterite_iron": { + "display_name": "Laterite Iron", + "description": "Tropical weathering iron deposit with mixed aluminum and iron content", + "formation_type": "tropical_weathering_concentration", + "extraction_difficulty": "hard", + "budget_impact": 2, + "resource_yield": "medium", + "quality": "medium" + }, + "taconite": { + "display_name": "Taconite", + "description": "Low-grade iron ore requiring beneficiation but with massive reserves", + "formation_type": "precambrian_banded_iron", + "extraction_difficulty": "hard", + "budget_impact": 2, + "resource_yield": "very_high", + "quality": "low" + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/natural_landmarks.json b/gameData/MapFeatures/natural_landmarks.json new file mode 100644 index 0000000..584798c --- /dev/null +++ b/gameData/MapFeatures/natural_landmarks.json @@ -0,0 +1,40 @@ +{ + "natural_landmarks": { + "natural_arch": { + "display_name": "Natural Arch", + "description": "Spectacular stone arch formation created by selective erosion", + "formation_type": "erosion_arch", + "budget_impact": 1 + }, + "monolith": { + "display_name": "Monolith", + "description": "Large isolated stone pillar standing prominently in landscape", + "formation_type": "erosion_resistant", + "budget_impact": 3 + }, + "rock_spire": { + "display_name": "Rock Spire", + "description": "Tall needle-like rock formation pointing skyward", + "formation_type": "erosion_pillar", + "budget_impact": 1 + }, + "mesa": { + "display_name": "Mesa", + "description": "Flat-topped mountain with steep cliff sides", + "formation_type": "erosion_resistant", + "budget_impact": 1 + }, + "hoodoo": { + "display_name": "Hoodoo", + "description": "Tall thin spire of rock formed by differential erosion", + "formation_type": "erosion_pillar", + "budget_impact": 1 + }, + "crater": { + "display_name": "Crater", + "description": "Large circular depression from ancient impact or volcanic activity", + "formation_type": "impact_volcanic", + "budget_impact": 4 + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/oil.json b/gameData/MapFeatures/oil.json new file mode 100644 index 0000000..939fa34 --- /dev/null +++ b/gameData/MapFeatures/oil.json @@ -0,0 +1,67 @@ +{ + "oil_resources": { + "major_oil_field": { + "display_name": "Major Oil Field", + "description": "Large petroleum reservoir with high pressure and excellent crude quality", + "formation_type": "deep_carboniferous_compression_with_geological_trap", + "extraction_difficulty": "hard", + "budget_impact": 5, + "resource_yield": "very_high", + "quality": "premium" + }, + "oil_well": { + "display_name": "Oil Well", + "description": "Standard petroleum deposit accessible through drilling operations", + "formation_type": "carboniferous_compression_with_geological_trap", + "extraction_difficulty": "medium", + "budget_impact": 4, + "resource_yield": "high", + "quality": "standard" + }, + "shallow_oil_pocket": { + "display_name": "Shallow Oil Pocket", + "description": "Surface-near petroleum deposit with easier access but lower pressure", + "formation_type": "shallow_carboniferous_trap", + "extraction_difficulty": "easy", + "budget_impact": 3, + "resource_yield": "medium", + "quality": "standard" + }, + "oil_seep": { + "display_name": "Oil Seep", + "description": "Natural petroleum surface emergence indicating deeper reserves", + "formation_type": "surface_petroleum_migration", + "extraction_difficulty": "very_easy", + "budget_impact": 2, + "resource_yield": "low", + "quality": "medium" + }, + "tar_sands": { + "display_name": "Tar Sands", + "description": "Heavy oil mixed with sand requiring specialized extraction methods", + "formation_type": "degraded_petroleum_in_sandstone", + "extraction_difficulty": "very_hard", + "budget_impact": 3, + "resource_yield": "high", + "quality": "low" + }, + "offshore_oil": { + "display_name": "Offshore Oil", + "description": "Underwater petroleum reservoir requiring marine drilling platforms", + "formation_type": "submerged_carboniferous_compression", + "extraction_difficulty": "very_hard", + "budget_impact": 4, + "resource_yield": "high", + "quality": "premium" + }, + "shale_oil": { + "display_name": "Shale Oil", + "description": "Oil trapped in shale rock formations requiring hydraulic fracturing", + "formation_type": "carboniferous_matter_in_shale", + "extraction_difficulty": "very_hard", + "budget_impact": 3, + "resource_yield": "medium", + "quality": "medium" + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/platinum.json b/gameData/MapFeatures/platinum.json new file mode 100644 index 0000000..c216d77 --- /dev/null +++ b/gameData/MapFeatures/platinum.json @@ -0,0 +1,40 @@ +{ + "platinum_resources": { + "pge_reef": { + "display_name": "PGE Reef", + "description": "Platinum group elements concentrated in layered igneous intrusions", + "formation_type": "layered_igneous_intrusion", + "extraction_difficulty": "very_hard", + "budget_impact": 6, + "resource_yield": "medium", + "quality": "premium" + }, + "platinum_placer": { + "display_name": "Platinum Placer", + "description": "Alluvial platinum deposits concentrated in river systems from eroded sources", + "formation_type": "alluvial_pge_concentration", + "extraction_difficulty": "medium", + "budget_impact": 4, + "resource_yield": "low", + "quality": "premium" + }, + "sperrylite_deposit": { + "display_name": "Sperrylite Deposit", + "description": "Platinum arsenide ore associated with copper-nickel sulfides", + "formation_type": "magmatic_sulfide_segregation", + "extraction_difficulty": "very_hard", + "budget_impact": 5, + "resource_yield": "medium", + "quality": "premium" + }, + "cooperite_vein": { + "display_name": "Cooperite Vein", + "description": "Platinum sulfide mineral in hydrothermal veins with palladium content", + "formation_type": "hydrothermal_pge_precipitation", + "extraction_difficulty": "hard", + "budget_impact": 5, + "resource_yield": "low", + "quality": "premium" + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/rare_metals.json b/gameData/MapFeatures/rare_metals.json new file mode 100644 index 0000000..f1cd95a --- /dev/null +++ b/gameData/MapFeatures/rare_metals.json @@ -0,0 +1,76 @@ +{ + "rare_metal_resources": { + "tungsten_vein": { + "display_name": "Tungsten Vein", + "description": "High-grade tungsten ore in quartz veins with scheelite and wolframite", + "formation_type": "hydrothermal_tungsten_precipitation", + "extraction_difficulty": "very_hard", + "budget_impact": 6, + "resource_yield": "medium", + "quality": "premium" + }, + "molybdenum_porphyry": { + "display_name": "Molybdenum Porphyry", + "description": "Molybdenum sulfide in large porphyry copper systems", + "formation_type": "porphyry_molybdenum_system", + "extraction_difficulty": "very_hard", + "budget_impact": 5, + "resource_yield": "medium", + "quality": "premium" + }, + "chromite_deposit": { + "display_name": "Chromite Deposit", + "description": "Chromium-iron oxide ore in layered mafic intrusions", + "formation_type": "layered_mafic_intrusion", + "extraction_difficulty": "hard", + "budget_impact": 4, + "resource_yield": "high", + "quality": "standard" + }, + "antimony_vein": { + "display_name": "Antimony Vein", + "description": "Stibnite ore in hydrothermal veins with mercury associations", + "formation_type": "epithermal_antimony_vein", + "extraction_difficulty": "medium", + "budget_impact": 3, + "resource_yield": "medium", + "quality": "standard" + }, + "cobalt_arsenide": { + "display_name": "Cobalt Arsenide", + "description": "Cobalt-arsenic minerals in hydrothermal deposits with silver traces", + "formation_type": "hydrothermal_cobalt_precipitation", + "extraction_difficulty": "hard", + "budget_impact": 4, + "resource_yield": "low", + "quality": "premium" + }, + "iridium_placer": { + "display_name": "Iridium Placer", + "description": "Ultra-rare platinum group metal in alluvial concentrations", + "formation_type": "alluvial_pge_concentration", + "extraction_difficulty": "very_hard", + "budget_impact": 7, + "resource_yield": "very_low", + "quality": "premium" + }, + "lithium_pegmatite": { + "display_name": "Lithium Pegmatite", + "description": "Spodumene-bearing granite pegmatite with lithium silicate minerals", + "formation_type": "granitic_pegmatite", + "extraction_difficulty": "hard", + "budget_impact": 4, + "resource_yield": "medium", + "quality": "premium" + }, + "lithium_brine": { + "display_name": "Lithium Brine", + "description": "Salt lake brines with concentrated lithium chloride solutions", + "formation_type": "evaporite_lithium_concentration", + "extraction_difficulty": "medium", + "budget_impact": 3, + "resource_yield": "high", + "quality": "standard" + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/silver.json b/gameData/MapFeatures/silver.json new file mode 100644 index 0000000..6d28626 --- /dev/null +++ b/gameData/MapFeatures/silver.json @@ -0,0 +1,49 @@ +{ + "silver_resources": { + "silver_vein": { + "display_name": "Silver Vein", + "description": "High-grade silver ore in hydrothermal veins with excellent purity", + "formation_type": "hydrothermal_precious_metal_vein", + "extraction_difficulty": "hard", + "budget_impact": 5, + "resource_yield": "medium", + "quality": "premium" + }, + "galena_silver": { + "display_name": "Galena Silver", + "description": "Silver-bearing lead sulfide ore requiring lead-silver separation", + "formation_type": "sulfide_mineralization", + "extraction_difficulty": "medium", + "budget_impact": 4, + "resource_yield": "high", + "quality": "standard" + }, + "argentite_deposit": { + "display_name": "Argentite Deposit", + "description": "Silver sulfide mineral with high silver content and moderate processing", + "formation_type": "sulfide_precipitation", + "extraction_difficulty": "medium", + "budget_impact": 4, + "resource_yield": "medium", + "quality": "premium" + }, + "native_silver": { + "display_name": "Native Silver", + "description": "Pure metallic silver deposits requiring minimal processing", + "formation_type": "hydrothermal_metal_precipitation", + "extraction_difficulty": "easy", + "budget_impact": 3, + "resource_yield": "low", + "quality": "premium" + }, + "silver_placer": { + "display_name": "Silver Placer", + "description": "Alluvial silver deposits concentrated in ancient river systems", + "formation_type": "alluvial_precious_metal_concentration", + "extraction_difficulty": "easy", + "budget_impact": 2, + "resource_yield": "low", + "quality": "premium" + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/stone.json b/gameData/MapFeatures/stone.json new file mode 100644 index 0000000..5f19435 --- /dev/null +++ b/gameData/MapFeatures/stone.json @@ -0,0 +1,103 @@ +{ + "stone_resources": { + "stone_quarry": { + "display_name": "Stone Quarry", + "description": "Generic rock outcrop suitable for basic construction materials", + "formation_type": "surface_rock_exposure", + "extraction_difficulty": "medium", + "budget_impact": 2, + "resource_yield": "very_high", + "quality": "standard" + }, + "granite_quarry": { + "display_name": "Granite Quarry", + "description": "High-quality igneous rock perfect for construction and monuments", + "formation_type": "plutonic_igneous_intrusion", + "extraction_difficulty": "hard", + "budget_impact": 4, + "resource_yield": "very_high", + "quality": "premium" + }, + "limestone_quarry": { + "display_name": "Limestone Quarry", + "description": "Sedimentary rock ideal for cement production and building materials", + "formation_type": "marine_carbonate_precipitation", + "extraction_difficulty": "medium", + "budget_impact": 3, + "resource_yield": "very_high", + "quality": "standard" + }, + "sandstone_quarry": { + "display_name": "Sandstone Quarry", + "description": "Layered sedimentary rock suitable for construction blocks and aggregate", + "formation_type": "clastic_sedimentary_formation", + "extraction_difficulty": "easy", + "budget_impact": 2, + "resource_yield": "very_high", + "quality": "standard" + }, + "marble_deposit": { + "display_name": "Marble Deposit", + "description": "Metamorphic limestone with excellent carving properties and durability", + "formation_type": "limestone_metamorphism", + "extraction_difficulty": "hard", + "budget_impact": 4, + "resource_yield": "high", + "quality": "premium" + }, + "clay_pit": { + "display_name": "Clay Pit", + "description": "Fine sedimentary material essential for ceramics and construction", + "formation_type": "weathering_accumulation", + "extraction_difficulty": "very_easy", + "budget_impact": 1, + "resource_yield": "very_high", + "quality": "standard" + }, + "sand_deposit": { + "display_name": "Sand Deposit", + "description": "Fine granular material perfect for concrete and glass production", + "formation_type": "weathering_erosion_accumulation", + "extraction_difficulty": "very_easy", + "budget_impact": 1, + "resource_yield": "very_high", + "quality": "standard" + }, + "gravel_pit": { + "display_name": "Gravel Pit", + "description": "Mixed rock fragments perfect for concrete aggregate and road base", + "formation_type": "fluvial_glacial_accumulation", + "extraction_difficulty": "very_easy", + "budget_impact": 1, + "resource_yield": "very_high", + "quality": "standard" + }, + "slate_deposit": { + "display_name": "Slate Deposit", + "description": "Fine-grained metamorphic rock perfect for roofing and flooring", + "formation_type": "shale_metamorphism", + "extraction_difficulty": "medium", + "budget_impact": 3, + "resource_yield": "high", + "quality": "premium" + }, + "quartzite_deposit": { + "display_name": "Quartzite Deposit", + "description": "Hard metamorphic quartz rock with excellent abrasive properties", + "formation_type": "sandstone_metamorphism", + "extraction_difficulty": "hard", + "budget_impact": 3, + "resource_yield": "high", + "quality": "premium" + }, + "gneiss_outcrop": { + "display_name": "Gneiss Outcrop", + "description": "Banded metamorphic rock suitable for decorative construction", + "formation_type": "high_grade_metamorphism", + "extraction_difficulty": "hard", + "budget_impact": 3, + "resource_yield": "high", + "quality": "standard" + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/thorium.json b/gameData/MapFeatures/thorium.json new file mode 100644 index 0000000..148a82c --- /dev/null +++ b/gameData/MapFeatures/thorium.json @@ -0,0 +1,31 @@ +{ + "thorium_resources": { + "monazite_placer": { + "display_name": "Monazite Placer", + "description": "Heavy mineral sand deposit with thorium-bearing rare earth phosphates", + "formation_type": "beach_placer_concentration", + "extraction_difficulty": "medium", + "budget_impact": 4, + "resource_yield": "medium", + "quality": "premium" + }, + "thorite_vein": { + "display_name": "Thorite Vein", + "description": "Primary thorium silicate mineral in granite pegmatites", + "formation_type": "granitic_pegmatite", + "extraction_difficulty": "hard", + "budget_impact": 5, + "resource_yield": "low", + "quality": "premium" + }, + "thorium_granite": { + "display_name": "Thorium Granite", + "description": "Radioactive granite with elevated thorium content requiring bulk processing", + "formation_type": "radioactive_granite_intrusion", + "extraction_difficulty": "very_hard", + "budget_impact": 3, + "resource_yield": "high", + "quality": "low" + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/titanium.json b/gameData/MapFeatures/titanium.json new file mode 100644 index 0000000..e03c7dd --- /dev/null +++ b/gameData/MapFeatures/titanium.json @@ -0,0 +1,40 @@ +{ + "titanium_resources": { + "ilmenite_deposit": { + "display_name": "Ilmenite Deposit", + "description": "Primary titanium-iron oxide ore with excellent titanium content", + "formation_type": "magmatic_oxide_segregation", + "extraction_difficulty": "hard", + "budget_impact": 5, + "resource_yield": "high", + "quality": "premium" + }, + "rutile_placer": { + "display_name": "Rutile Placer", + "description": "Heavy mineral sand deposit concentrated by wave action with pure titanium dioxide", + "formation_type": "beach_placer_concentration", + "extraction_difficulty": "medium", + "budget_impact": 4, + "resource_yield": "medium", + "quality": "premium" + }, + "anatase_vein": { + "display_name": "Anatase Vein", + "description": "Crystalline titanium dioxide in hydrothermal veins with high purity", + "formation_type": "hydrothermal_oxide_precipitation", + "extraction_difficulty": "medium", + "budget_impact": 4, + "resource_yield": "low", + "quality": "premium" + }, + "titaniferous_magnetite": { + "display_name": "Titaniferous Magnetite", + "description": "Iron-titanium oxide requiring separation processing for both metals", + "formation_type": "layered_igneous_intrusion", + "extraction_difficulty": "very_hard", + "budget_impact": 4, + "resource_yield": "high", + "quality": "standard" + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/underground_features.json b/gameData/MapFeatures/underground_features.json new file mode 100644 index 0000000..c4350a0 --- /dev/null +++ b/gameData/MapFeatures/underground_features.json @@ -0,0 +1,40 @@ +{ + "underground_features": { + "cave_network": { + "display_name": "Cave Network", + "description": "Interconnected underground cavern system with multiple entrances", + "formation_type": "limestone_dissolution", + "budget_impact": 2 + }, + "underground_lake": { + "display_name": "Underground Lake", + "description": "Subterranean water body accessible through cave systems", + "formation_type": "groundwater_accumulation", + "budget_impact": 3 + }, + "crystal_cavern": { + "display_name": "Crystal Cavern", + "description": "Underground chamber with natural crystal formations", + "formation_type": "mineral_crystallization", + "budget_impact": 4 + }, + "bat_cave": { + "display_name": "Bat Cave", + "description": "Large cave system inhabited by bat colonies with guano deposits", + "formation_type": "biological_cave", + "budget_impact": 1 + }, + "underground_river": { + "display_name": "Underground River", + "description": "Subterranean watercourse flowing through cave systems", + "formation_type": "groundwater_flow", + "budget_impact": 2 + }, + "deep_cavern": { + "display_name": "Deep Cavern", + "description": "Extremely deep cave system reaching significant depths", + "formation_type": "tectonic_cave", + "budget_impact": 3 + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/uranium.json b/gameData/MapFeatures/uranium.json new file mode 100644 index 0000000..a94aeff --- /dev/null +++ b/gameData/MapFeatures/uranium.json @@ -0,0 +1,49 @@ +{ + "uranium_resources": { + "pitchblende_vein": { + "display_name": "Pitchblende Vein", + "description": "High-grade uranium ore in hydrothermal veins with exceptional uranium content", + "formation_type": "hydrothermal_uranium_concentration", + "extraction_difficulty": "very_hard", + "budget_impact": 6, + "resource_yield": "high", + "quality": "premium" + }, + "uranium_roll_front": { + "display_name": "Uranium Roll Front", + "description": "Crescent-shaped uranium deposit formed by groundwater flow in sandstone", + "formation_type": "groundwater_uranium_precipitation", + "extraction_difficulty": "hard", + "budget_impact": 4, + "resource_yield": "medium", + "quality": "standard" + }, + "carnotite_deposit": { + "display_name": "Carnotite Deposit", + "description": "Uranium-vanadium ore in sedimentary formations with yellow coloration", + "formation_type": "sedimentary_uranium_vanadium", + "extraction_difficulty": "medium", + "budget_impact": 3, + "resource_yield": "medium", + "quality": "standard" + }, + "uraninite_placer": { + "display_name": "Uraninite Placer", + "description": "Detrital uranium deposits concentrated in ancient river channels", + "formation_type": "alluvial_uranium_concentration", + "extraction_difficulty": "medium", + "budget_impact": 3, + "resource_yield": "low", + "quality": "premium" + }, + "phosphate_uranium": { + "display_name": "Phosphate Uranium", + "description": "Low-grade uranium associated with phosphate rock formations", + "formation_type": "phosphate_uranium_association", + "extraction_difficulty": "very_hard", + "budget_impact": 2, + "resource_yield": "very_high", + "quality": "low" + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/volcanic.json b/gameData/MapFeatures/volcanic.json new file mode 100644 index 0000000..9b72183 --- /dev/null +++ b/gameData/MapFeatures/volcanic.json @@ -0,0 +1,67 @@ +{ + "volcanic_resources": { + "sulfur_fumarole": { + "display_name": "Sulfur Fumarole", + "description": "Volcanic vent depositing pure sulfur crystals from gas emissions", + "formation_type": "volcanic_gas_precipitation", + "extraction_difficulty": "medium", + "budget_impact": 3, + "resource_yield": "medium", + "quality": "premium" + }, + "obsidian_flow": { + "display_name": "Obsidian Flow", + "description": "Volcanic glass formation suitable for cutting tools and decoration", + "formation_type": "rapid_lava_cooling", + "extraction_difficulty": "easy", + "budget_impact": 2, + "resource_yield": "high", + "quality": "premium" + }, + "basalt_flow": { + "display_name": "Basalt Flow", + "description": "Dense volcanic rock excellent for construction and road aggregate", + "formation_type": "mafic_lava_flow", + "extraction_difficulty": "hard", + "budget_impact": 3, + "resource_yield": "very_high", + "quality": "standard" + }, + "pumice_deposit": { + "display_name": "Pumice Deposit", + "description": "Lightweight volcanic rock perfect for construction and abrasives", + "formation_type": "explosive_volcanic_eruption", + "extraction_difficulty": "very_easy", + "budget_impact": 1, + "resource_yield": "very_high", + "quality": "standard" + }, + "volcanic_ash": { + "display_name": "Volcanic Ash", + "description": "Fine volcanic material excellent for cement production and soil amendment", + "formation_type": "pyroclastic_fallout", + "extraction_difficulty": "very_easy", + "budget_impact": 1, + "resource_yield": "very_high", + "quality": "standard" + }, + "perlite_deposit": { + "display_name": "Perlite Deposit", + "description": "Volcanic glass that expands when heated, used for insulation", + "formation_type": "hydrated_volcanic_glass", + "extraction_difficulty": "easy", + "budget_impact": 2, + "resource_yield": "high", + "quality": "standard" + }, + "zeolite_formation": { + "display_name": "Zeolite Formation", + "description": "Crystalline volcanic minerals with molecular sieve properties", + "formation_type": "volcanic_glass_alteration", + "extraction_difficulty": "medium", + "budget_impact": 3, + "resource_yield": "medium", + "quality": "premium" + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/volcanic_features.json b/gameData/MapFeatures/volcanic_features.json new file mode 100644 index 0000000..5e500a1 --- /dev/null +++ b/gameData/MapFeatures/volcanic_features.json @@ -0,0 +1,40 @@ +{ + "volcanic_features": { + "volcano": { + "display_name": "Volcano", + "description": "Active or dormant volcanic cone with potential geothermal energy", + "formation_type": "volcanic_activity", + "budget_impact": 3 + }, + "lava_field": { + "display_name": "Lava Field", + "description": "Solidified lava flows creating rough terrain with mineral deposits", + "formation_type": "volcanic_flow", + "budget_impact": 1 + }, + "volcanic_vent": { + "display_name": "Volcanic Vent", + "description": "Secondary volcanic opening with gas emissions and sulfur deposits", + "formation_type": "volcanic_secondary", + "budget_impact": 2 + }, + "caldera": { + "display_name": "Caldera", + "description": "Large volcanic depression with fertile soils and geothermal activity", + "formation_type": "volcanic_collapse", + "budget_impact": 4 + }, + "fumarole": { + "display_name": "Fumarole", + "description": "Volcanic gas vent with sulfur deposits and geothermal potential", + "formation_type": "volcanic_gas", + "budget_impact": 1 + }, + "obsidian_field": { + "display_name": "Obsidian Field", + "description": "Natural volcanic glass deposits valuable for precision tools", + "formation_type": "volcanic_glass", + "budget_impact": 2 + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/water_features.json b/gameData/MapFeatures/water_features.json new file mode 100644 index 0000000..885456a --- /dev/null +++ b/gameData/MapFeatures/water_features.json @@ -0,0 +1,64 @@ +{ + "water_features": { + "lake": { + "display_name": "Lake", + "description": "Large body of fresh water surrounded by land", + "formation_type": "water_accumulation", + "budget_impact": 1 + }, + "pond": { + "display_name": "Pond", + "description": "Small body of still fresh water", + "formation_type": "water_accumulation", + "budget_impact": 1 + }, + "waterfall": { + "display_name": "Waterfall", + "description": "Water cascading down from height with hydroelectric potential", + "formation_type": "water_erosion", + "budget_impact": 1 + }, + "marsh": { + "display_name": "Marsh", + "description": "Wetland area with standing water and specialized vegetation", + "formation_type": "water_saturation", + "budget_impact": 0 + }, + "central_hill_swamp": { + "display_name": "Central Hill Swamp", + "description": "Marshy wetland with elevated central hill providing strategic position", + "formation_type": "water_saturation_with_elevation", + "budget_impact": 1 + }, + "islands_swamp": { + "display_name": "Islands Swamp", + "description": "Swampland dotted with multiple small dry islands and complex waterways", + "formation_type": "fragmented_water_saturation", + "budget_impact": 1 + }, + "hilly_swampy": { + "display_name": "Hilly Swampy", + "description": "Rolling terrain with marshy valleys and elevated dry ridges", + "formation_type": "terrain_drainage_pattern", + "budget_impact": 0 + }, + "river_source": { + "display_name": "River Source", + "description": "Origin point of a major river with strategic importance", + "formation_type": "groundwater_emergence", + "budget_impact": 2 + }, + "delta": { + "display_name": "River Delta", + "description": "Fertile river mouth area with rich sediment deposits", + "formation_type": "sediment_deposit", + "budget_impact": 2 + }, + "oasis": { + "display_name": "Oasis", + "description": "Isolated fertile spot in desert with precious water source", + "formation_type": "groundwater_emergence", + "budget_impact": 3 + } + } +} \ No newline at end of file diff --git a/gameData/MapFeatures/zinc.json b/gameData/MapFeatures/zinc.json new file mode 100644 index 0000000..0cf2c94 --- /dev/null +++ b/gameData/MapFeatures/zinc.json @@ -0,0 +1,40 @@ +{ + "zinc_resources": { + "sphalerite_deposit": { + "display_name": "Sphalerite Deposit", + "description": "Primary zinc sulfide ore with high zinc content and lead associations", + "formation_type": "sulfide_mineralization", + "extraction_difficulty": "medium", + "budget_impact": 3, + "resource_yield": "high", + "quality": "standard" + }, + "zinc_carbonate": { + "display_name": "Zinc Carbonate", + "description": "Oxidized zinc ore formed by weathering of sulfide deposits", + "formation_type": "zinc_oxidation_zone", + "extraction_difficulty": "easy", + "budget_impact": 3, + "resource_yield": "medium", + "quality": "standard" + }, + "franklinite_ore": { + "display_name": "Franklinite Ore", + "description": "Zinc-iron-manganese oxide mineral in metamorphic formations", + "formation_type": "metamorphic_oxide_formation", + "extraction_difficulty": "hard", + "budget_impact": 4, + "resource_yield": "medium", + "quality": "premium" + }, + "willemite_deposit": { + "display_name": "Willemite Deposit", + "description": "Zinc silicate mineral with fluorescent properties under UV light", + "formation_type": "silicate_mineralization", + "extraction_difficulty": "medium", + "budget_impact": 3, + "resource_yield": "medium", + "quality": "standard" + } + } +} \ No newline at end of file diff --git a/gameData/Regions/README.json b/gameData/Regions/README.json new file mode 100644 index 0000000..8cbe406 --- /dev/null +++ b/gameData/Regions/README.json @@ -0,0 +1,81 @@ +{ + "region_system_v3": { + "description": "Scalable blacklist + frequent biomes system with mass requirements", + "version": "3.0", + + "revolutionary_simplification": { + "problem_solved": "Exponential complexity of biome compatibility (20 biomes × 50 features = 1000 combinations)", + "old_system": "compatible_biomes + incompatible_biomes + probability (redundant and massive)", + "new_system": "incompatible_biomes (blacklist) + frequent_biomes (priority) - NO probability" + }, + + "core_logic": { + "default_behavior": "All features available everywhere by default", + "blacklist_filtering": "incompatible_biomes = hard exclusions (geological impossibility)", + "priority_system": "frequent_biomes = higher priority/likelihood in these environments", + "mass_gating": "minimum_region_mass = geological strength requirements", + "selection_method": "Filter by mass + blacklist, then prioritize frequent biomes" + }, + + "workflow_example": { + "scenario": "Iron region (mass=200) placing feature in 'alpine' biome", + "step_1": "Filter by mass: rich_iron_ore (≥150✅), iron_ore_vein (≥75✅), bog_iron (≥10✅), etc.", + "step_2": "Filter by blacklist: remove bog_iron (alpine incompatible), keep rich_iron_ore + iron_ore_vein", + "step_3": "Check frequent biomes: rich_iron_ore has alpine in frequent_biomes → HIGH PRIORITY", + "step_4": "Result: rich_iron_ore selected (mass ok, not blacklisted, frequent in alpine)" + }, + + "scalability_advantages": { + "new_biome_addition": "Automatically compatible with all features except explicit blacklists", + "maintenance_load": "~3 blacklist entries per feature vs ~15+ whitelist entries", + "geological_logic": "Blacklist = impossible formations, frequent = optimal conditions", + "no_probability_management": "Eliminates probability balancing and normalization complexity" + }, + + "feature_examples": { + "rich_iron_ore": { + "incompatible_biomes": ["tropical_rainforest", "wetlands"], + "frequent_biomes": ["hills", "rocky_plateau", "alpine"], + "explanation": "Cannot form in tropical/wetland conditions, optimal in mountain/hill tectonics" + }, + "laterite_iron": { + "incompatible_biomes": ["alpine", "cold_desert", "tundra", "hot_desert"], + "frequent_biomes": ["tropical_rainforest"], + "explanation": "Requires tropical weathering, impossible in cold/dry conditions" + }, + "peat_bog": { + "incompatible_biomes": ["hot_desert", "cold_desert", "alpine", "rocky_plateau"], + "frequent_biomes": ["wetlands"], + "explanation": "Needs wetland accumulation, impossible in dry/rocky conditions" + } + }, + + "files_updated": { + "iron_regions.json": "7 features with blacklist+frequent system", + "copper_regions.json": "6 features with blacklist+frequent system", + "coal_regions.json": "6 features with blacklist+frequent system", + "oil_regions.json": "7 features with blacklist+frequent system", + "spatial_distribution_patterns.json": "5 random density patterns for regions" + }, + + "implementation_ready": { + "phase_8_integration": "System ready for world generation Phase 8", + "algorithm": [ + "1. Region assigned random pattern (concentrated/uniform/ring/clustered/gradient)", + "2. Pattern determines density distribution within region radius", + "3. For each feature placement:", + "4. - Check region.mass >= feature.minimum_region_mass", + "5. - Check local_biome NOT IN feature.incompatible_biomes", + "6. - Prioritize features where local_biome IN feature.frequent_biomes", + "7. - Select from available features", + "8. - Place according to region density pattern" + ] + }, + + "maintenance_metrics": { + "old_system": "1000+ compatibility combinations to maintain", + "new_system": "~200 blacklist entries total across all features", + "reduction_factor": "5x less maintenance, infinite scalability for new biomes" + } + } +} \ No newline at end of file diff --git a/gameData/Regions/coal_regions.json b/gameData/Regions/coal_regions.json new file mode 100644 index 0000000..369ef30 --- /dev/null +++ b/gameData/Regions/coal_regions.json @@ -0,0 +1,90 @@ +{ + "coal_region_system": { + "resource_type": "coal", + "description": "Coal feature selection based on region mass and biome compatibility", + + "features": { + "rich_coal_seam": { + "display_name": "Rich Coal Seam", + "incompatible_biomes": ["hot_desert", "cold_desert", "alpine", "wetlands"], + "frequent_biomes": ["temperate_forest", "hills"], + "minimum_region_mass": 100, + "quality_base": "premium", + "extraction_difficulty": "medium", + "budget_impact": 4, + "description": "High-quality coal requiring substantial geological compression" + }, + + "coal_seam": { + "display_name": "Coal Seam", + "incompatible_biomes": ["hot_desert", "cold_desert", "alpine"], + "frequent_biomes": ["temperate_forest", "grassland", "hills"], + "minimum_region_mass": 50, + "quality_base": "standard", + "extraction_difficulty": "medium", + "budget_impact": 3, + "description": "Standard coal in medium-strength regions" + }, + + "coal_outcrop": { + "display_name": "Coal Outcrop", + "incompatible_biomes": ["hot_desert", "alpine", "tropical_rainforest"], + "frequent_biomes": ["temperate_forest", "grassland", "hills", "scrubland"], + "minimum_region_mass": 25, + "quality_base": "standard", + "extraction_difficulty": "easy", + "budget_impact": 2, + "description": "Surface coal accessible in small regions" + }, + + "surface_coal": { + "display_name": "Surface Coal", + "incompatible_biomes": ["hot_desert", "cold_desert", "alpine", "wetlands"], + "frequent_biomes": ["temperate_forest", "grassland", "scrubland"], + "minimum_region_mass": 15, + "quality_base": "low", + "extraction_difficulty": "very_easy", + "budget_impact": 1, + "description": "Weathered coal in small regions" + }, + + "lignite_deposit": { + "display_name": "Lignite Deposit", + "incompatible_biomes": ["hot_desert", "cold_desert", "alpine", "rocky_plateau"], + "frequent_biomes": ["temperate_forest", "grassland"], + "minimum_region_mass": 75, + "quality_base": "medium", + "extraction_difficulty": "medium", + "budget_impact": 2, + "description": "Brown coal in medium sedimentary regions" + }, + + "peat_bog": { + "display_name": "Peat Bog", + "incompatible_biomes": ["hot_desert", "cold_desert", "alpine", "rocky_plateau"], + "frequent_biomes": ["wetlands"], + "minimum_region_mass": 10, + "quality_base": "low", + "extraction_difficulty": "easy", + "budget_impact": 1, + "description": "Early coal formation in wetland environments" + } + }, + + "selection_logic": { + "step_1": "Check region mass against minimum_region_mass", + "step_2": "Filter out features with incompatible biomes", + "step_3": "Prioritize features with frequent biomes for this location", + "step_4": "Select from available features", + "fallback": "If no features available, place generic coal" + }, + + "mass_categories": { + "tiny_region": {"mass_range": [10, 25], "typical_features": ["peat_bog", "surface_coal"]}, + "small_region": {"mass_range": [25, 50], "typical_features": ["coal_outcrop", "surface_coal"]}, + "medium_region": {"mass_range": [50, 100], "typical_features": ["coal_seam", "lignite_deposit"]}, + "large_region": {"mass_range": [100, 300], "typical_features": ["rich_coal_seam", "coal_seam"]}, + "huge_region": {"mass_range": [300, 1000], "typical_features": ["rich_coal_seam"]} + } + } +} \ No newline at end of file diff --git a/gameData/Regions/copper_regions.json b/gameData/Regions/copper_regions.json new file mode 100644 index 0000000..ae30ac1 --- /dev/null +++ b/gameData/Regions/copper_regions.json @@ -0,0 +1,89 @@ +{ + "copper_region_system": { + "resource_type": "copper_ore", + "description": "Copper feature selection based on region mass and biome compatibility", + + "features": { + "porphyry_copper": { + "display_name": "Porphyry Copper", + "incompatible_biomes": ["wetlands", "coastal_plain"], + "frequent_biomes": ["hills", "rocky_plateau", "alpine"], + "minimum_region_mass": 200, + "quality_base": "premium", + "extraction_difficulty": "hard", + "budget_impact": 5, + "description": "Large-scale copper system requiring massive geological activity" + }, + + "copper_vein": { + "display_name": "Copper Vein", + "incompatible_biomes": ["wetlands"], + "frequent_biomes": ["hills", "rocky_plateau", "alpine"], + "minimum_region_mass": 75, + "quality_base": "premium", + "extraction_difficulty": "medium", + "budget_impact": 4, + "description": "High-grade copper veins in medium-strength regions" + }, + + "chalcopyrite_deposit": { + "display_name": "Chalcopyrite Deposit", + "incompatible_biomes": ["wetlands", "tropical_rainforest"], + "frequent_biomes": ["hills", "temperate_forest", "grassland", "scrubland"], + "minimum_region_mass": 50, + "quality_base": "standard", + "extraction_difficulty": "medium", + "budget_impact": 3, + "description": "Standard copper sulfide in moderate regions" + }, + + "malachite_outcrop": { + "display_name": "Malachite Outcrop", + "incompatible_biomes": ["wetlands", "tropical_rainforest"], + "frequent_biomes": ["hills", "scrubland", "grassland"], + "minimum_region_mass": 30, + "quality_base": "standard", + "extraction_difficulty": "easy", + "budget_impact": 2, + "description": "Surface copper ore in small to medium regions" + }, + + "native_copper": { + "display_name": "Native Copper", + "incompatible_biomes": ["wetlands", "tropical_rainforest", "hot_desert"], + "frequent_biomes": ["rocky_plateau", "hills", "alpine"], + "minimum_region_mass": 100, + "quality_base": "premium", + "extraction_difficulty": "easy", + "budget_impact": 3, + "description": "Pure copper requiring specific geological conditions" + }, + + "copper_shale": { + "display_name": "Copper Shale", + "incompatible_biomes": ["wetlands", "alpine", "rocky_plateau"], + "frequent_biomes": ["grassland", "temperate_forest", "scrubland"], + "minimum_region_mass": 150, + "quality_base": "low", + "extraction_difficulty": "very_hard", + "budget_impact": 2, + "description": "Low-grade copper in large sedimentary regions" + } + }, + + "selection_logic": { + "step_1": "Check region mass against minimum_region_mass", + "step_2": "Filter out features with incompatible biomes", + "step_3": "Prioritize features with frequent biomes for this location", + "step_4": "Select from available features", + "fallback": "If no features available, place generic copper_ore" + }, + + "mass_categories": { + "small_region": {"mass_range": [30, 75], "typical_features": ["malachite_outcrop", "chalcopyrite_deposit"]}, + "medium_region": {"mass_range": [75, 150], "typical_features": ["copper_vein", "chalcopyrite_deposit"]}, + "large_region": {"mass_range": [150, 300], "typical_features": ["porphyry_copper", "copper_shale", "native_copper"]}, + "huge_region": {"mass_range": [300, 1000], "typical_features": ["porphyry_copper", "copper_shale"]} + } + } +} \ No newline at end of file diff --git a/gameData/Regions/gold_regions.json b/gameData/Regions/gold_regions.json new file mode 100644 index 0000000..8cc7146 --- /dev/null +++ b/gameData/Regions/gold_regions.json @@ -0,0 +1,80 @@ +{ + "gold_region_system": { + "resource_type": "gold_ore", + "description": "Gold deposit regions with biome-compatible feature selection", + + "features": { + "gold_lode": { + "display_name": "Gold Lode", + "compatible_biomes": ["hills", "rocky_plateau", "alpine"], + "incompatible_biomes": ["wetlands", "coastal_plain"], + "pattern": "concentrated", + "probability": 0.25, + "quality_base": "premium", + "extraction_difficulty": "hard", + "budget_impact": 5, + "geological_requirements": ["hydrothermal_quartz_vein"] + }, + + "placer_gold": { + "display_name": "Placer Gold", + "compatible_biomes": ["temperate_forest", "grassland", "coastal_plain"], + "incompatible_biomes": ["alpine", "rocky_plateau", "hot_desert"], + "pattern": "clustered", + "probability": 0.30, + "quality_base": "premium", + "extraction_difficulty": "easy", + "budget_impact": 3, + "geological_requirements": ["alluvial_gold_concentration"] + }, + + "epithermal_gold": { + "display_name": "Epithermal Gold", + "compatible_biomes": ["hills", "scrubland", "temperate_forest"], + "incompatible_biomes": ["wetlands", "cold_desert"], + "pattern": "ring", + "probability": 0.20, + "quality_base": "premium", + "extraction_difficulty": "medium", + "budget_impact": 4, + "geological_requirements": ["epithermal_mineralization"] + }, + + "residual_gold": { + "display_name": "Residual Gold", + "compatible_biomes": ["hills", "scrubland", "grassland"], + "incompatible_biomes": ["wetlands", "alpine"], + "pattern": "gradient", + "probability": 0.15, + "quality_base": "premium", + "extraction_difficulty": "very_easy", + "budget_impact": 2, + "geological_requirements": ["weathering_concentration"] + }, + + "conglomerate_gold": { + "display_name": "Conglomerate Gold", + "compatible_biomes": ["hills", "rocky_plateau"], + "incompatible_biomes": ["wetlands", "coastal_plain", "tropical_rainforest"], + "pattern": "uniform", + "probability": 0.08, + "quality_base": "premium", + "extraction_difficulty": "very_hard", + "budget_impact": 4, + "geological_requirements": ["paleozoic_conglomerate"] + }, + + "sulfide_gold": { + "display_name": "Sulfide Gold", + "compatible_biomes": ["hills", "rocky_plateau", "alpine"], + "incompatible_biomes": ["wetlands", "coastal_plain"], + "pattern": "concentrated", + "probability": 0.02, + "quality_base": "standard", + "extraction_difficulty": "very_hard", + "budget_impact": 3, + "geological_requirements": ["sulfide_mineralization"] + } + } + } +} \ No newline at end of file diff --git a/gameData/Regions/iron_regions.json b/gameData/Regions/iron_regions.json new file mode 100644 index 0000000..4a2c26c --- /dev/null +++ b/gameData/Regions/iron_regions.json @@ -0,0 +1,101 @@ +{ + "iron_region_system": { + "resource_type": "iron_ore", + "description": "Iron feature selection based on region mass and biome compatibility", + + "features": { + "rich_iron_ore": { + "display_name": "Rich Iron Ore", + "incompatible_biomes": ["tropical_rainforest", "wetlands"], + "frequent_biomes": ["hills", "rocky_plateau", "alpine"], + "minimum_region_mass": 150, + "quality_base": "premium", + "extraction_difficulty": "medium", + "budget_impact": 4, + "description": "High-grade iron ore requiring strong geological activity" + }, + + "iron_ore_vein": { + "display_name": "Iron Ore Vein", + "incompatible_biomes": ["tropical_rainforest", "wetlands"], + "frequent_biomes": ["hills", "rocky_plateau", "alpine", "temperate_forest"], + "minimum_region_mass": 75, + "quality_base": "standard", + "extraction_difficulty": "medium", + "budget_impact": 3, + "description": "Standard iron ore in medium-strength regions" + }, + + "magnetite_deposit": { + "display_name": "Magnetite Deposit", + "incompatible_biomes": ["wetlands", "hot_desert"], + "frequent_biomes": ["hills", "rocky_plateau", "alpine"], + "minimum_region_mass": 50, + "quality_base": "premium", + "extraction_difficulty": "easy", + "budget_impact": 3, + "description": "Magnetic iron ore accessible in moderate regions" + }, + + "hematite_outcrop": { + "display_name": "Hematite Outcrop", + "incompatible_biomes": ["tropical_rainforest", "wetlands"], + "frequent_biomes": ["hills", "rocky_plateau", "grassland", "scrubland"], + "minimum_region_mass": 25, + "quality_base": "standard", + "extraction_difficulty": "easy", + "budget_impact": 2, + "description": "Surface iron ore available in small regions" + }, + + "laterite_iron": { + "display_name": "Laterite Iron", + "incompatible_biomes": ["alpine", "cold_desert", "tundra", "hot_desert"], + "frequent_biomes": ["tropical_rainforest"], + "minimum_region_mass": 30, + "quality_base": "medium", + "extraction_difficulty": "hard", + "budget_impact": 2, + "description": "Tropical weathering iron, specialized formation" + }, + + "bog_iron": { + "display_name": "Bog Iron", + "incompatible_biomes": ["hot_desert", "cold_desert", "alpine", "rocky_plateau"], + "frequent_biomes": ["wetlands"], + "minimum_region_mass": 10, + "quality_base": "low", + "extraction_difficulty": "very_easy", + "budget_impact": 1, + "description": "Low-grade iron in wetland environments" + }, + + "taconite": { + "display_name": "Taconite", + "incompatible_biomes": ["tropical_rainforest", "wetlands", "hot_desert"], + "frequent_biomes": ["hills", "rocky_plateau", "grassland"], + "minimum_region_mass": 200, + "quality_base": "low", + "extraction_difficulty": "hard", + "budget_impact": 2, + "description": "Low-grade iron requiring very large, stable regions" + } + }, + + "selection_logic": { + "step_1": "Check region mass against minimum_region_mass", + "step_2": "Filter out features with incompatible biomes", + "step_3": "Prioritize features with frequent biomes for this location", + "step_4": "Select from available features", + "fallback": "If no features available, place generic iron_ore" + }, + + "mass_categories": { + "tiny_region": {"mass_range": [10, 30], "typical_features": ["bog_iron", "laterite_iron"]}, + "small_region": {"mass_range": [30, 75], "typical_features": ["hematite_outcrop", "magnetite_deposit"]}, + "medium_region": {"mass_range": [75, 150], "typical_features": ["iron_ore_vein", "magnetite_deposit"]}, + "large_region": {"mass_range": [150, 300], "typical_features": ["rich_iron_ore", "iron_ore_vein"]}, + "huge_region": {"mass_range": [300, 1000], "typical_features": ["rich_iron_ore", "taconite"]} + } + } +} \ No newline at end of file diff --git a/gameData/Regions/oil_regions.json b/gameData/Regions/oil_regions.json new file mode 100644 index 0000000..b04d58e --- /dev/null +++ b/gameData/Regions/oil_regions.json @@ -0,0 +1,101 @@ +{ + "oil_region_system": { + "resource_type": "crude_oil", + "description": "Oil feature selection based on region mass and biome compatibility", + + "features": { + "major_oil_field": { + "display_name": "Major Oil Field", + "incompatible_biomes": ["alpine", "rocky_plateau", "wetlands"], + "frequent_biomes": ["grassland", "scrubland", "hot_desert"], + "minimum_region_mass": 250, + "quality_base": "premium", + "extraction_difficulty": "hard", + "budget_impact": 5, + "description": "Large oil reservoirs requiring massive sedimentary basins" + }, + + "oil_well": { + "display_name": "Oil Well", + "incompatible_biomes": ["alpine", "wetlands"], + "frequent_biomes": ["grassland", "temperate_forest", "scrubland"], + "minimum_region_mass": 75, + "quality_base": "standard", + "extraction_difficulty": "medium", + "budget_impact": 4, + "description": "Standard oil deposits in medium regions" + }, + + "shallow_oil_pocket": { + "display_name": "Shallow Oil Pocket", + "incompatible_biomes": ["alpine", "wetlands"], + "frequent_biomes": ["grassland", "temperate_forest", "scrubland", "hills"], + "minimum_region_mass": 30, + "quality_base": "standard", + "extraction_difficulty": "easy", + "budget_impact": 3, + "description": "Surface-near oil accessible in small regions" + }, + + "oil_seep": { + "display_name": "Oil Seep", + "incompatible_biomes": ["alpine", "cold_desert", "wetlands"], + "frequent_biomes": ["grassland", "scrubland", "temperate_forest"], + "minimum_region_mass": 15, + "quality_base": "medium", + "extraction_difficulty": "very_easy", + "budget_impact": 2, + "description": "Natural oil emergence in tiny regions" + }, + + "offshore_oil": { + "display_name": "Offshore Oil", + "incompatible_biomes": ["hills", "rocky_plateau", "alpine", "hot_desert"], + "frequent_biomes": ["coastal_plain"], + "minimum_region_mass": 150, + "quality_base": "premium", + "extraction_difficulty": "very_hard", + "budget_impact": 4, + "description": "Marine oil deposits in coastal regions" + }, + + "tar_sands": { + "display_name": "Tar Sands", + "incompatible_biomes": ["alpine", "hot_desert", "wetlands"], + "frequent_biomes": ["grassland", "temperate_forest"], + "minimum_region_mass": 200, + "quality_base": "low", + "extraction_difficulty": "very_hard", + "budget_impact": 3, + "description": "Heavy oil requiring large sedimentary systems" + }, + + "shale_oil": { + "display_name": "Shale Oil", + "incompatible_biomes": ["alpine", "wetlands", "tropical_rainforest"], + "frequent_biomes": ["grassland", "scrubland"], + "minimum_region_mass": 100, + "quality_base": "medium", + "extraction_difficulty": "very_hard", + "budget_impact": 3, + "description": "Unconventional oil in shale formations" + } + }, + + "selection_logic": { + "step_1": "Check region mass against minimum_region_mass", + "step_2": "Filter out features with incompatible biomes", + "step_3": "Prioritize features with frequent biomes for this location", + "step_4": "Select from available features", + "fallback": "If no features available, place generic oil_seep" + }, + + "mass_categories": { + "tiny_region": {"mass_range": [15, 30], "typical_features": ["oil_seep"]}, + "small_region": {"mass_range": [30, 75], "typical_features": ["shallow_oil_pocket", "oil_seep"]}, + "medium_region": {"mass_range": [75, 150], "typical_features": ["oil_well", "shale_oil"]}, + "large_region": {"mass_range": [150, 300], "typical_features": ["major_oil_field", "offshore_oil", "tar_sands"]}, + "huge_region": {"mass_range": [300, 1000], "typical_features": ["major_oil_field", "tar_sands"]} + } + } +} \ No newline at end of file diff --git a/gameData/Regions/spatial_distribution_patterns.json b/gameData/Regions/spatial_distribution_patterns.json new file mode 100644 index 0000000..beb5781 --- /dev/null +++ b/gameData/Regions/spatial_distribution_patterns.json @@ -0,0 +1,73 @@ +{ + "region_density_patterns": { + "version": "2.0", + "description": "Density distribution patterns within resource regions - randomly assigned per region", + + "available_patterns": [ + "concentrated", + "uniform", + "ring", + "clustered", + "gradient" + ], + + "pattern_definitions": { + "concentrated": { + "description": "High feature density near region center, low at edges", + "density_center": 1.0, + "density_edge": 0.2, + "effective_radius_percent": 50, + "use_cases": "Rich ore bodies, primary deposits" + }, + + "uniform": { + "description": "Equal feature density throughout entire region", + "density_center": 1.0, + "density_edge": 1.0, + "effective_radius_percent": 100, + "use_cases": "Sedimentary layers, widespread deposits" + }, + + "ring": { + "description": "Feature density concentrated in annular zone", + "density_center": 0.1, + "density_ring_start": 0.6, + "density_ring_peak": 1.0, + "density_edge": 0.3, + "use_cases": "Contact metamorphism, intrusion margins" + }, + + "clustered": { + "description": "Multiple high-density sub-zones within region", + "cluster_count": {"min": 2, "max": 4}, + "density_in_cluster": 1.0, + "density_between_clusters": 0.2, + "use_cases": "Pod formations, scattered deposits" + }, + + "gradient": { + "description": "Smooth density decrease from center to edge", + "density_center": 1.0, + "density_edge": 0.4, + "gradient_function": "logarithmic", + "use_cases": "Diffusion halos, weathering profiles" + } + }, + + "pattern_assignment": { + "method": "random_selection", + "equal_probability": true, + "description": "Each region gets a random pattern from available_patterns" + }, + + "feature_placement_workflow": { + "1": "Region created with random pattern", + "2": "Pattern determines density distribution within region", + "3": "For each tile needing feature placement:", + "4": " - Check region mass (strength)", + "5": " - Check local biome", + "6": " - Select compatible feature based on mass + biome", + "7": " - Place feature if density allows" + } + } +} \ No newline at end of file diff --git a/gameData/Regions/stone_regions.json b/gameData/Regions/stone_regions.json new file mode 100644 index 0000000..e38bb04 --- /dev/null +++ b/gameData/Regions/stone_regions.json @@ -0,0 +1,92 @@ +{ + "stone_region_system": { + "resource_type": "construction_materials", + "description": "Construction stone regions with biome-compatible feature selection", + + "features": { + "granite_quarry": { + "display_name": "Granite Quarry", + "compatible_biomes": ["hills", "rocky_plateau", "alpine"], + "incompatible_biomes": ["wetlands", "coastal_plain"], + "pattern": "concentrated", + "probability": 0.20, + "quality_base": "premium", + "extraction_difficulty": "hard", + "budget_impact": 4, + "geological_requirements": ["plutonic_igneous_intrusion"] + }, + + "limestone_quarry": { + "display_name": "Limestone Quarry", + "compatible_biomes": ["hills", "grassland", "temperate_forest"], + "incompatible_biomes": ["alpine", "hot_desert"], + "pattern": "uniform", + "probability": 0.25, + "quality_base": "standard", + "extraction_difficulty": "medium", + "budget_impact": 3, + "geological_requirements": ["marine_carbonate_precipitation"] + }, + + "sandstone_quarry": { + "display_name": "Sandstone Quarry", + "compatible_biomes": ["grassland", "scrubland", "temperate_forest"], + "incompatible_biomes": ["alpine", "wetlands"], + "pattern": "uniform", + "probability": 0.20, + "quality_base": "standard", + "extraction_difficulty": "easy", + "budget_impact": 2, + "geological_requirements": ["clastic_sedimentary_formation"] + }, + + "marble_deposit": { + "display_name": "Marble Deposit", + "compatible_biomes": ["hills", "rocky_plateau"], + "incompatible_biomes": ["wetlands", "coastal_plain", "hot_desert"], + "pattern": "concentrated", + "probability": 0.10, + "quality_base": "premium", + "extraction_difficulty": "hard", + "budget_impact": 4, + "geological_requirements": ["limestone_metamorphism"] + }, + + "clay_pit": { + "display_name": "Clay Pit", + "compatible_biomes": ["temperate_forest", "grassland", "coastal_plain"], + "incompatible_biomes": ["alpine", "rocky_plateau", "hot_desert"], + "pattern": "uniform", + "probability": 0.15, + "quality_base": "standard", + "extraction_difficulty": "very_easy", + "budget_impact": 1, + "geological_requirements": ["weathering_accumulation"] + }, + + "sand_deposit": { + "display_name": "Sand Deposit", + "compatible_biomes": ["coastal_plain", "grassland", "scrubland"], + "incompatible_biomes": ["alpine", "rocky_plateau"], + "pattern": "uniform", + "probability": 0.08, + "quality_base": "standard", + "extraction_difficulty": "very_easy", + "budget_impact": 1, + "geological_requirements": ["weathering_erosion_accumulation"] + }, + + "gravel_pit": { + "display_name": "Gravel Pit", + "compatible_biomes": ["temperate_forest", "grassland", "hills"], + "incompatible_biomes": ["hot_desert", "wetlands"], + "pattern": "clustered", + "probability": 0.02, + "quality_base": "standard", + "extraction_difficulty": "very_easy", + "budget_impact": 1, + "geological_requirements": ["fluvial_glacial_accumulation"] + } + } + } +} \ No newline at end of file diff --git a/gameData/Regions/uranium_regions.json b/gameData/Regions/uranium_regions.json new file mode 100644 index 0000000..d2487e6 --- /dev/null +++ b/gameData/Regions/uranium_regions.json @@ -0,0 +1,68 @@ +{ + "uranium_region_system": { + "resource_type": "uranium_ore", + "description": "Uranium deposit regions with biome-compatible feature selection", + + "features": { + "pitchblende_vein": { + "display_name": "Pitchblende Vein", + "compatible_biomes": ["hills", "rocky_plateau", "cold_desert"], + "incompatible_biomes": ["wetlands", "tropical_rainforest", "coastal_plain"], + "pattern": "concentrated", + "probability": 0.25, + "quality_base": "premium", + "extraction_difficulty": "very_hard", + "budget_impact": 6, + "geological_requirements": ["hydrothermal_uranium_concentration"] + }, + + "uranium_roll_front": { + "display_name": "Uranium Roll Front", + "compatible_biomes": ["grassland", "scrubland", "cold_desert"], + "incompatible_biomes": ["wetlands", "alpine", "tropical_rainforest"], + "pattern": "ring", + "probability": 0.30, + "quality_base": "standard", + "extraction_difficulty": "hard", + "budget_impact": 4, + "geological_requirements": ["groundwater_uranium_precipitation"] + }, + + "carnotite_deposit": { + "display_name": "Carnotite Deposit", + "compatible_biomes": ["scrubland", "cold_desert", "grassland"], + "incompatible_biomes": ["wetlands", "tropical_rainforest", "temperate_forest"], + "pattern": "uniform", + "probability": 0.25, + "quality_base": "standard", + "extraction_difficulty": "medium", + "budget_impact": 3, + "geological_requirements": ["sedimentary_uranium_vanadium"] + }, + + "uraninite_placer": { + "display_name": "Uraninite Placer", + "compatible_biomes": ["grassland", "scrubland"], + "incompatible_biomes": ["wetlands", "alpine", "tropical_rainforest"], + "pattern": "clustered", + "probability": 0.15, + "quality_base": "premium", + "extraction_difficulty": "medium", + "budget_impact": 3, + "geological_requirements": ["alluvial_uranium_concentration"] + }, + + "phosphate_uranium": { + "display_name": "Phosphate Uranium", + "compatible_biomes": ["grassland", "scrubland", "coastal_plain"], + "incompatible_biomes": ["alpine", "rocky_plateau"], + "pattern": "uniform", + "probability": 0.05, + "quality_base": "low", + "extraction_difficulty": "very_hard", + "budget_impact": 2, + "geological_requirements": ["phosphate_uranium_association"] + } + } + } +} \ No newline at end of file diff --git a/gameData/WorldGeneration/Regular_world.json b/gameData/WorldGeneration/Regular_world.json index c52f70c..0c62dea 100644 --- a/gameData/WorldGeneration/Regular_world.json +++ b/gameData/WorldGeneration/Regular_world.json @@ -3,6 +3,7 @@ "description": "Complete planetary formation simulation over 4.65 billion years", "total_duration_years": 4650000000, "phases": [ + // ===== PHASE 1: PLANETARY ACCRETION (30 cycles × 100M years = 3.0 Ga) ===== { "name": "planetary_accretion", "description": "Initial planetary formation through meteorite bombardment", @@ -91,14 +92,9 @@ "applies_to_all_region_types": true } } - ], - "expected_results": { - "final_surface_elevation_meters": -15000, - "temperature_range_celsius": {"min": 1000, "max": 1500}, - "core_established": true, - "crater_based_geology": true - } + ] }, + // ===== PHASE 2: TECTONIC FORMATION (25 cycles × 100M years = 2.5 Ga) ===== { "name": "tectonic_formation", "description": "Formation of tectonic plates and crustal thickening", @@ -192,16 +188,9 @@ "applies_to_all_region_types": true } } - ], - "expected_results": { - "surface_elevation_change": {"from": -15000, "to": -5000}, - "crustal_thickening_meters": 10000, - "stable_tectonic_regions": {"min": 15, "max": 25}, - "mountain_ranges_formed": true, - "rift_valleys_formed": true, - "oceanic_continental_distinction": true - } + ] }, + // ===== PHASE 3: GEOLOGICAL PREPARATION (25 cycles × 20M years = 0.5 Ga) ===== { "name": "geological_preparation", "description": "Sea level rise and geological basin formation (preparation for future hydrology)", @@ -319,18 +308,9 @@ "applies_to_all_region_types": true } } - ], - "expected_results": { - "surface_elevation_change": {"from": -5000, "to": 0}, - "sea_level_modern": true, - "geological_basins_formed": true, - "erosion_valleys_carved": true, - "climate_temperature_stabilized": true, - "coastal_zones_prepared": true, - "note": "This phase prepares terrain for Phase 6 detailed hydrology simulation", - "tectonic_velocity_factor": 0.8 - } + ] }, + // ===== PHASE 4: CARBONIFEROUS PERIOD (35 cycles × 10M years = 0.35 Ga) ===== { "name": "carboniferous_period", "description": "Dynamic forest evolution and coal formation through geological cycles", @@ -432,17 +412,9 @@ "temperature_destruction_max": 50.0 } } - ], - "expected_results": { - "dynamic_forest_evolution": true, - "multiple_forest_generations": true, - "coal_deposit_diversity": true, - "oil_formation_underwater": true, - "natural_gas_production": true, - "geological_storytelling": "Each coal seam represents specific forest periods", - "tectonic_velocity_factor": 0.6 - } + ] }, + // ===== PHASE 5: PRE-FAUNAL STABILIZATION (15 cycles × 10M years = 0.15 Ga) ===== { "name": "pre_faunal_stabilization", "description": "Final geological maturation and climate stabilization", @@ -539,229 +511,378 @@ "temperature_variance_reduction": 0.9 } } - ], - "expected_results": { - "geological_maturity_complete": true, - "hydrocarbon_deposits_in_traps": true, - "surface_coal_seams_exposed": true, - "soil_types_developed": true, - "climate_zones_stable": true, - "ready_for_industrial_gameplay": true, - "tectonic_velocity_factor": 0.48 - } + ] }, + // ===== PHASE 6A: LANDMASS ANALYSIS & ITCZ PREPARATION (1 cycle × 1M years) ===== + { + "name": "landmass_analysis_and_itcz_preparation", + "description": "Analyze continental masses from existing TectonicRegions and create Inter-Tropical Convergence Zones", + "duration_cycles": 1, + "years_per_cycle": 1000000, + "steps": [ + { + "name": "continental_mass_analysis", + "process_type": "analyze_continental_masses", + "parameters": { + "_comment": "Uses existing TectonicRegions to identify continental masses for ITCZ placement", + "continental_grouping": { + "proximity_threshold": 100, + "minimum_region_count": 2, + "mass_calculation_method": "area_weighted", + "continental_type_filter": ["continental", "volcanic"] + }, + "landmass_requirements": { + "minimum_total_area": 5000, + "minimum_individual_region_area": 1000, + "connectivity_analysis": true + }, + "equatorial_filtering": { + "latitude_band": [0.40, 0.60], + "strict_equatorial_requirement": false, + "latitude_scoring_weight": 0.7 + } + } + }, + { + "name": "ocean_basin_detection", + "process_type": "detect_ocean_basins", + "parameters": { + "_comment": "Inverse analysis to identify ocean masses from continental positions", + "ocean_detection_method": "inverse_continental_analysis", + "minimum_ocean_size": 5000, + "coastal_connectivity_check": true, + "ocean_temperature_estimation": { + "latitude_based": true, + "equator_temp": 28.0, + "pole_temp": 2.0, + "thermal_gradient": "cosine_distribution" + }, + "evaporation_potential_calculation": { + "temperature_factor": true, + "surface_area_factor": true, + "wind_exposure_factor": true + } + } + }, + { + "name": "itcz_zone_creation", + "process_type": "create_itcz_convergence_zones", + "parameters": { + "_comment": "Create ITCZ zones on qualifying equatorial landmasses", + "itcz_requirements": { + "latitude_band": [0.45, 0.55], + "min_landmass_size": 10000, + "max_ocean_distance": 800, + "continental_heating_threshold": 5000 + }, + "itcz_zone_properties": { + "center_calculation": "continental_center_of_mass", + "gravitational_range_formula": "sqrt(landmass_area) * 50", + "mass_calculation": "landmass_total_area", + "amplification_factor": 3.0, + "intensity_falloff": "inverse_square_law" + }, + "multiple_itcz_handling": { + "allow_multiple_zones": true, + "minimum_separation_distance": 500, + "interaction_between_zones": false + } + } + }, + { + "name": "climate_infrastructure_preparation", + "process_type": "prepare_climate_simulation_infrastructure", + "parameters": { + "_comment": "Clean slate preparation for WindRegion-based simulation", + "data_cleanup": { + "clear_legacy_wind_data": true, + "clear_legacy_humidity_data": true, + "preserve_temperature_gradients": true, + "preserve_elevation_data": true + }, + "token_system_initialization": { + "initialize_token_counters": true, + "token_types": ["wind", "rain", "highWind", "flood", "hurricane"], + "reset_all_tokens": true + }, + "performance_optimization": { + "pre_allocate_wind_region_pool": true, + "max_concurrent_wind_regions": 200, + "spatial_indexing_setup": true + } + } + } + ] + }, + // ===== PHASE 6B: CLIMATE SIMULATION & BIOME GENERATION (300 cycles × 100K years = 30M years) ===== { "name": "climate_simulation_and_biome_generation", - "description": "Physics-based climate simulation and hydrological system with biome classification", - "duration_cycles": 500, + "description": "Advanced climate simulation using mobile WindRegions and ITCZ zones for realistic weather patterns", + "duration_cycles": 300, "years_per_cycle": 100000, "steps": [ { - "name": "initial_climate_conditions", - "process_type": "set_initial_climate", + "name": "wind_region_spawning_system", + "process_type": "spawn_mobile_wind_regions", "parameters": { - "base_temperature_calculation": "latitude_elevation_based", - "equator_temperature_celsius": 30.0, - "pole_temperature_celsius": -30.0, - "elevation_lapse_rate": 0.006, - "initial_humidity": 0.5, - "initial_wind_intensity": 0 - } - }, - { - "name": "iterative_climate_convergence", - "process_type": "climate_physics_simulation", - "parameters": { - "max_iterations": 500, - "convergence_threshold": 0.01, - "convergence_check_frequency": 50, - "wind_calculation": { - "wind_from_temperature_gradients": true, - "wind_transport_factor": 0.1, - "max_wind_intensity": 15 + "_comment": "Mobile WindRegions spawn from ocean masses with biased distribution", + "spawn_system": { + "spawn_locations": "ocean_masses_only", + "spawn_frequency_formula": "water_mass_size / 1000", + "spawn_distribution": "random_within_water_region_biased_toward_center", + "max_concurrent_regions": 200, + "initial_strength_formula": "water_temperature * evaporation_factor" }, - "heat_moisture_transport": { - "heat_transfer_rate": 0.05, - "moisture_transfer_rate": 0.03, - "wind_direction_vector_calculation": true + "wind_region_properties": { + "initial_wind_strength": 1.0, + "initial_wetness": 0.0, + "wind_tokens": 100, + "rain_tokens": 0, + "decay_per_move": 0.02, + "decay_per_tile": 0.01, + "minimum_survival_threshold": 0.1 }, - "terrain_dissipation": { - "mountain_barrier_threshold": 500.0, - "strong_mountain_dissipation": 0.3, - "moderate_hill_dissipation": 0.7, - "ocean_wind_preservation": 0.95, - "land_wind_dissipation": 0.7, - "forest_humidity_bonus": 1.1 + "ocean_moisture_gain": { + "ocean_moisture_rate": 0.1, + "temperature_factor": true, + "evaporation_efficiency": 1.0 } } }, { - "name": "ocean_evaporation_system", - "process_type": "process_ocean_evaporation", + "name": "planetary_circulation_and_movement", + "process_type": "apply_planetary_circulation", "parameters": { - "ocean_evaporation_rate": 0.1, - "temperature_factor": 30.0, - "sea_level_detection": true, - "evaporation_to_humidity_conversion": true + "_comment": "Planetary rotation bands based on real atmospheric data", + "planetary_circulation_bands": { + "polar_jet_north": { + "latitude_range": [0.10, 0.25], + "direction": "west_to_east", + "strength": 1.8 + }, + "calm_transition_1": { + "latitude_range": [0.25, 0.40], + "movement": "chaos_plus_procedural" + }, + "equatorial_trades": { + "latitude_range": [0.40, 0.60], + "direction": "east_to_west", + "strength": 1.5 + }, + "calm_transition_2": { + "latitude_range": [0.60, 0.75], + "movement": "chaos_plus_procedural" + }, + "polar_jet_south": { + "latitude_range": [0.75, 0.95], + "direction": "west_to_east", + "strength": 1.8 + } + }, + "movement_calculation": { + "planetary_circulation_weight": 0.6, + "equator_to_pole_bias_weight": 0.2, + "terrain_deflection_weight": 0.1, + "random_variation_weight": 0.1 + }, + "movement_physics": { + "velocity_damping": 0.95, + "terrain_interaction": true, + "boundary_wrapping": "spherical_world" + } } }, { - "name": "precipitation_and_water_accumulation", - "process_type": "calculate_precipitation", + "name": "wind_region_evolution_and_interactions", + "process_type": "evolve_wind_regions", "parameters": { - "precipitation_factor": 0.8, - "orographic_effect": { + "_comment": "WindRegion interactions including repulsion system and ITCZ effects", + "repulsion_system": { "enabled": true, - "elevation_modifier_max": 3000.0, - "orographic_multiplier": 0.5 + "repulsion_calculation": "spatial_competition_proxy", + "acceleration_factor": 1.0, + "maximum_interaction_distance": 50.0, + "_design_note": "Prevents region stacking while creating realistic dispersion patterns", + "_alternative_algorithms": { + "density_based_drift": false, + "no_interaction": false, + "collision_division": false + } }, - "water_accumulation": { - "max_water_level": 255, - "humidity_reduction_after_precipitation": 0.7 + "itcz_gravitational_effects": { + "enabled": true, + "attraction_formula": "itcz.mass / (distance * distance)", + "gravitational_metaphor": "influence_strength_not_literal_physics", + "amplification_calculation": { + "proximity_factor": "(itcz.range - distance) / itcz.range", + "max_amplification": 3.0, + "wind_strength_multiplier": true, + "wetness_multiplier": true + } + }, + "regional_evolution": { + "wind_strength_decay": true, + "moisture_accumulation": true, + "death_threshold": 0.1, + "lifecycle_management": true } } }, { - "name": "hydrological_simulation", - "process_type": "simulate_water_flow_and_erosion", + "name": "token_distribution_and_climate_zones", + "process_type": "distribute_climate_tokens", "parameters": { - "water_flow": { - "flow_rate_factor": 0.1, - "steepest_descent_algorithm": true, - "water_surface_elevation_calculation": true + "_comment": "Token-based climate zone classification system", + "basic_token_distribution": { + "wind_token_factor": 10, + "rain_token_factor": 10, + "tokens_per_tile_visit": true, + "accumulation_system": true }, - "river_erosion": { - "erosion_threshold": 10, - "erosion_factor": 0.001, - "bell_curve_erosion": { - "enabled": true, - "bell_curve_radius": 3, - "valley_formation_factor": 0.5, - "center_erosion_multiplier": 2.0 + "climate_zone_thresholds": { + "high_wind_threshold": 2.0, + "flood_threshold": 1.5, + "hurricane_wind_threshold": 2.5, + "hurricane_rain_threshold": 2.0 + }, + "special_climate_tokens": { + "high_wind_tokens": { + "description": "Hostile to forests", + "biome_effect": "prevents_forest_growth", + "token_value": 1 }, - "sediment_transport": { - "sediment_factor": 0.3, - "deposition_threshold": 50, - "deposition_rate": 0.2 + "flood_tokens": { + "description": "Forces wetlands/marshes", + "biome_effect": "mandatory_wetlands", + "token_value": 1 + }, + "hurricane_tokens": { + "description": "Specialized hurricane biome", + "biome_effect": "storm_resistant_vegetation", + "token_value": 1 } }, - "river_network_formation": { - "automatic_river_marking": true, - "flow_volume_tracking": true, - "delta_formation": { - "enabled": true, - "delta_radius": 5, - "delta_elevation_bonus": 10.0, - "sediment_richness": 1.5 - } + "token_persistence": { + "accumulation_method": "additive", + "decay_rate": 0.0, + "permanent_climate_record": true } } }, { - "name": "emergent_climate_patterns", - "process_type": "establish_climate_zones", + "name": "biome_classification_from_tokens", + "process_type": "classify_biomes_from_climate_tokens", "parameters": { - "coastal_breeze_formation": true, - "valley_wind_development": true, - "rain_shadow_effects": true, - "continental_interior_drying": true, - "tropical_humidity_retention": true, - "climate_feature_documentation": true + "_comment": "Load biome system from external definitions - all rules and modifiers defined in biome files", + "biome_system_source": "gameData/Biomes/biome_index.json", + "load_all_biome_definitions": true, + "use_external_classification_rules": true, + "use_external_resource_modifiers": true, + "fallback_biome": "scrubland" } }, { - "name": "biome_classification", - "process_type": "classify_biomes", + "name": "temporal_token_dissipation", + "process_type": "apply_token_dissipation", "parameters": { - "biome_types": { - "water_bodies": { - "tropical_ocean": {"temp_min": 25, "depth_min": -1000}, - "temperate_ocean": {"temp_min": 5, "temp_max": 25, "depth_min": -1000}, - "polar_ocean": {"temp_max": 5, "depth_min": -1000} - }, - "ice_snow": { - "tundra": {"temp_max": -10}, - "alpine": {"temp_max": 0, "elevation_min": 2000} - }, - "deserts": { - "hot_desert": {"temp_min": 20, "humidity_max": 0.3}, - "cold_desert": {"temp_min": 10, "humidity_max": 0.2} - }, - "forests": { - "tropical_rainforest": {"temp_min": 25, "humidity_min": 0.7, "requires_forest_feature": true}, - "temperate_forest": {"temp_min": 15, "humidity_min": 0.5, "requires_forest_feature": true}, - "boreal_forest": {"temp_max": 5, "requires_forest_feature": true}, - "dry_forest": {"humidity_max": 0.4, "requires_forest_feature": true} - }, - "grasslands": { - "grassland": {"temp_min": 10, "humidity_min": 0.5}, - "steppe": {"humidity_min": 0.3}, - "scrubland": "default_fallback" - } + "_comment": "Random token dissipation - high for normal tokens (variation), low for catastrophe tokens (preserve special zones)", + "rain_tokens": { + "dissipation_range": [5, 25], + "dissipation_frequency": 0.12 }, - "biome_resource_modifiers": { - "tropical_rainforest": {"wood": 2.0, "biodiversity": 3.0, "industrial_suitability": 0.3}, - "temperate_forest": {"wood": 1.5, "industrial_suitability": 0.7}, - "grassland": {"agriculture": 1.8, "industrial_suitability": 0.9}, - "hot_desert": {"solar_potential": 2.5, "water_scarcity": 0.1}, - "mountains": {"mineral_richness": 1.5, "transportation_difficulty": 2.0} - } - } - }, - { - "name": "forest_evolution_integration", - "process_type": "integrate_forest_with_climate", - "parameters": { - "forest_climate_adaptation": true, - "geological_forest_destruction": { - "volcanic_destruction": true, - "climate_change_destruction": true, - "preserved_forest_to_biome": true + "wind_tokens": { + "dissipation_range": [3, 15], + "dissipation_frequency": 0.10 }, - "new_forest_emergence": { - "favorable_climate_seeding": true, - "forest_biome_correlation": true + "highWind_tokens": { + "dissipation_range": [2, 8], + "dissipation_frequency": 0.08 }, - "final_forest_distribution": { - "geological_history_weight": 0.4, - "current_climate_weight": 0.6 + "flood_tokens": { + "dissipation_range": [1, 2], + "dissipation_frequency": 0.02 + }, + "hurricane_tokens": { + "dissipation_range": [1, 2], + "dissipation_frequency": 0.015 } } } - ], - "expected_results": { - "realistic_climate_patterns": { - "coastal_breezes": true, - "valley_winds": true, - "rain_shadows": true, - "continental_effects": true - }, - "hydrological_features": { - "natural_river_networks": true, - "v_shaped_valleys": true, - "alluvial_fans": true, - "delta_systems": true, - "lake_formation": true, - "canyon_cutting": true - }, - "biome_diversity": { - "multiple_climate_zones": true, - "realistic_biome_distribution": true, - "resource_modifier_application": true, - "industrial_suitability_mapping": true - }, - "performance_characteristics": { - "estimated_runtime_seconds": "5-15", - "memory_usage_mb": "<120", - "climate_convergence": true - }, - "ready_for_gameplay": { - "environmental_challenges": true, - "resource_accessibility": true, - "strategic_locations": true, - "transportation_routes": true + ] + }, + // ===== PHASE 7: BUDGET ASSIGNMENT ===== + { + "name": "budget_assignment", + "description": "Random budget score distribution for economic gameplay", + "duration_cycles": 1, + "years_per_cycle": 1000000, + "steps": [ + { + "name": "assign_budget_scores", + "process_type": "random_budget_assignment", + "parameters": { + "distribution": "normal", + "mean": 0.0, + "std_dev": 3.0, + "range": [-10, 10] + } } - } + ] + }, + // ===== PHASE 7: BUDGET & FEATURES ===== + { + "name": "budget_and_features", + "description": "Random budget assignment and biome-appropriate natural features placement", + "duration_cycles": 1, + "years_per_cycle": 1000000, + "steps": [ + { + "name": "assign_budget_scores", + "process_type": "random_budget_assignment", + "parameters": { + "distribution": "normal", + "mean": 0.0, + "std_dev": 3.0, + "range": [-10, 10] + } + }, + { + "name": "place_natural_features", + "process_type": "biome_based_feature_placement", + "parameters": { + "chance": 0.05, + "feature_sources": [ + "gameData/MapFeatures/geological_formations.json", + "gameData/MapFeatures/natural_landmarks.json", + "gameData/MapFeatures/water_features.json", + "gameData/MapFeatures/volcanic_features.json", + "gameData/MapFeatures/underground_features.json", + "gameData/MapFeatures/forest_features.json", + "gameData/MapFeatures/coastal_features.json" + ], + "biome_compatibility": { + "tropical_rainforest": ["giant_tree", "ancient_grove", "bamboo_grove", "fruit_orchard", "carboniferous_forest", "underground_river"], + "hot_desert": ["canyon", "cliff", "sinkhole", "oasis", "volcano", "lava_field", "obsidian_field"], + "temperate_forest": ["forest_clearing", "ancient_grove", "medicinal_grove", "mushroom_grove", "carboniferous_forest", "underground_lake"], + "grassland": ["plateau", "natural_bridge", "sinkhole", "lake", "spring"], + "tundra": ["geyser", "sinkhole", "cliff", "lake", "crater", "fumarole", "deep_cavern"], + "alpine": ["canyon", "cliff", "gorge", "volcano", "caldera", "crystal_cavern", "volcanic_vent"], + "cold_desert": ["canyon", "cliff", "sinkhole", "hoodoo", "crater", "obsidian_field"], + "hills": ["cave", "spring", "plateau", "gorge", "cave_network", "bat_cave"], + "rocky_plateau": ["canyon", "cliff", "natural_bridge", "mesa", "rock_spire", "monolith"], + "hurricane_zone": ["cave", "gorge", "marsh", "central_hill_swamp", "bat_cave"], + "wetlands": ["central_hill_swamp", "islands_swamp", "hilly_swampy", "underground_lake", "delta"], + "storm_prairie": ["plateau", "sinkhole", "natural_bridge", "hoodoo", "monolith"], + "badlands": ["canyon", "cliff", "gorge", "mesa", "sinkhole", "lava_field"], + "coastal_plain": ["delta", "pond", "marsh", "estuary", "natural_harbor"], + "cliffs": ["sea_cave", "cliff", "natural_arch", "blowhole", "sea_stack"], + "sandy_coast": ["beach_dunes", "delta", "natural_harbor", "tidal_pool", "estuary"], + "rocky_shore": ["sea_cave", "tidal_pool", "sea_stack", "blowhole", "coral_reef"], + "scrubland": ["cave", "plateau", "spring", "sinkhole", "canyon", "monolith", "rock_spire"] + } + } + } + ] } ] } diff --git a/gameconfig.json b/gameconfig.json new file mode 100644 index 0000000..05af2f8 --- /dev/null +++ b/gameconfig.json @@ -0,0 +1,110 @@ +{ + "metadata": { + "version": "1.0.0", + "created": "2025-01-27", + "description": "Warfactory system configuration - infrastructure only", + "hash": "sha256:placeholder" + }, + + "coordination": { + "enabled": true, + "module_deployment_timeout": 30000, + "health_check_interval": 5000, + "hot_reload": { + "enabled": true, + "watch_directories": ["modules/", "config/"], + "extensions": [".so", ".json"] + } + }, + + "modules": { + "debug_world_gen": { + "enabled": true, + "priority": 1, + "frequency": 1.0, + "library_path": "modules/debug_world_gen/build/libdebug_world_gen.so", + "config_file": "config/debug_world_gen.json" + }, + + "tank": { + "enabled": true, + "priority": 2, + "frequency": 60.0, + "library_path": "modules/tank/build/libtank.so", + "config_file": "config/tank.json" + }, + + "economy": { + "enabled": true, + "priority": 3, + "frequency": 0.1, + "library_path": "modules/economy/build/libeconomy.so", + "config_file": "config/economy.json" + }, + + "factory": { + "enabled": true, + "priority": 4, + "frequency": 60.0, + "library_path": "modules/factory/build/libfactory.so", + "config_file": "config/factory.json" + }, + + "logistic": { + "enabled": true, + "priority": 5, + "frequency": 1.0, + "library_path": "modules/logistic/build/liblogistic.so", + "config_file": "config/logistic.json" + } + }, + + "engine": { + "type": "DEBUG", + "target_fps": 60, + "step_by_step": false, + "verbose_logging": true, + "performance_monitoring": true, + "module_system": { + "type": "SEQUENTIAL", + "thread_pool_size": 4, + "task_queue_size": 1000 + } + }, + + "performance": { + "targets": { + "v1_client_fps": 30, + "v2_client_fps": 60, + "v1_server_players": 10, + "v2_server_players": 100, + "iteration_cycle_seconds": 5, + "hot_reload_ms": 1 + }, + "optimization": { + "simd": false, + "cluster_distribution": false, + "memory_pooling": true, + "cache_friendly_data": true + } + }, + + "debugging": { + "sanitizers": { + "address": true, + "undefined_behavior": true, + "leak": true + }, + "profiling": { + "enabled": true, + "per_module_metrics": true, + "memory_tracking": true + }, + "logging": { + "level": "DEBUG", + "file_output": true, + "console_output": true, + "json_structured": true + } + } +} \ No newline at end of file diff --git a/src/modules/world-generation/CLAUDE.md b/src/modules/world-generation/CLAUDE.md new file mode 100644 index 0000000..9e801f7 --- /dev/null +++ b/src/modules/world-generation/CLAUDE.md @@ -0,0 +1,57 @@ +# World Generation Module + +**Responsabilité** : Génération procédurale de la WorldMap avec biomes et features géographiques. + +## Description + +Ce module génère la carte mondiale diplomatique/stratégique en utilisant des algorithmes procéduraux configurables. Il gère les biomes, le terrain, et les features géographiques selon les configurations définies dans gameData/. + +## Architecture + +### Interface +- **WorldGenerationModule** : Hérite d'IModule +- **GMap** : Structure de données pour stocker la worldmap en mémoire +- **Configuration** : Via const IDataNode& depuis gameData/ + +### Données de Configuration +- `gameData/WorldGeneration/` - Algorithmes et paramètres génération +- `gameData/Biomes/` - Définitions des biomes +- `gameData/Terrain/` - Types de terrain disponibles +- `gameData/MapFeatures/` - Features géographiques (montagnes, rivières, etc.) + +### Format JSON +```json +{ + "world_map": { + "size": {"width": 1000, "height": 1000}, + "tiles": [ + {"x": 0, "y": 0, "terrain": "plains", "biome": "temperate", "elevation": 100} + ], + "features": [ + {"type": "river", "coordinates": [[x1,y1], [x2,y2]]} + ] + } +} +``` + +## Contraintes Modules +- **200-300 lignes max** pour logique métier +- **JSON uniquement** pour communication +- **Hot-reload ready** avec getState()/setState() +- **Autonome** : `cd src/modules/world-generation/ && cmake .` + +## Build Commands +```bash +cd src/modules/world-generation/ +cmake . # Configuration +make world-generation # Build .so library +make world-generation-test # Build standalone test +./build/bin/world-generation-test # Test standalone +``` + +## Dependencies +- nlohmann/json pour JSON processing +- Core interfaces (IModule, IDataNode) depuis ../../core/include + +## Hot-Reload +Le module préserve l'état de la map générée à travers les reloads via getState()/setState(). \ No newline at end of file diff --git a/src/modules/world-generation/CMakeLists.txt b/src/modules/world-generation/CMakeLists.txt new file mode 100644 index 0000000..a326c5c --- /dev/null +++ b/src/modules/world-generation/CMakeLists.txt @@ -0,0 +1,71 @@ +cmake_minimum_required(VERSION 3.20) +project(world-generation VERSION 1.0.0) + +# C++ Standard +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# Defensive programming by default +set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE) + +# AddressSanitizer and UndefinedBehaviorSanitizer by default +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer -g") +set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fsanitize=address -fsanitize=undefined") + +# FetchContent for dependencies +include(FetchContent) + +FetchContent_Declare( + nlohmann_json + GIT_REPOSITORY https://github.com/nlohmann/json.git + GIT_TAG v3.11.2 +) +FetchContent_MakeAvailable(nlohmann_json) + +# Include directories +target_include_directories(world-generation PRIVATE include) +target_include_directories(world-generation PRIVATE ../../core/include) + +# Source files +set(SOURCES + src/WorldGenerationModule.cpp + src/main.cpp +) + +# Headers +set(HEADERS + include/WorldGeneration.h + include/GMap.h +) + +# Create shared library (.so) for hot-reload +add_library(world-generation SHARED ${SOURCES} ${HEADERS}) + +# Link libraries +target_link_libraries(world-generation PRIVATE nlohmann_json::nlohmann_json) + +# Create standalone executable for testing +add_executable(world-generation-test ${SOURCES}) +target_link_libraries(world-generation-test PRIVATE nlohmann_json::nlohmann_json) + +# Include directories for test executable +target_include_directories(world-generation-test PRIVATE include) +target_include_directories(world-generation-test PRIVATE ../../core/include) + +# Compile definitions for testing +target_compile_definitions(world-generation-test PRIVATE TESTING) + +# Build directory +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) + +# Install targets +install(TARGETS world-generation DESTINATION lib) +install(FILES ${HEADERS} DESTINATION include/world-generation) + +# Apply defensive programming (if available) +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/WarfactoryDefenses.cmake") + include(../../../cmake/WarfactoryDefenses.cmake) + apply_warfactory_defenses(world-generation) + apply_warfactory_defenses(world-generation-test) +endif() \ No newline at end of file diff --git a/src/modules/world-generation/WORLDGEN_ANALYSIS.md b/src/modules/world-generation/WORLDGEN_ANALYSIS.md new file mode 100644 index 0000000..3c0df15 --- /dev/null +++ b/src/modules/world-generation/WORLDGEN_ANALYSIS.md @@ -0,0 +1,651 @@ +# Worldmap Generation System - Technical Analysis Report + +## Executive Summary + +The Warfactory worldmap generation system employs a revolutionary **budget-based procedural generation** approach with **regional influences** to create a realistic, balanced world map. The system uses a **-10 to +10 scoring system** where each tile's features automatically balance risks and rewards, combined with **regional tendencies** that create specialized geographical zones based on real-world geological and historical patterns. + +**Key Innovation**: The budget system ensures automatic risk/reward balancing - valuable resources are naturally accompanied by proportional constraints, while regional influences create coherent geographical specialization. + +## Architecture Overview + +### Core Components + +#### 1. WorldGenerationModule (`WorldGeneration.h`) +- **Responsibility**: Global worldmap creation using procedural algorithms +- **Output**: Complete world terrain, biomes, elevation data +- **Technology**: Noise functions, biome classification, elevation modeling + +#### 2. WorldFeatureModule (`WorldFeature.h`) +- **Responsibility**: Placement of 218+ geographical features using budget system +- **Output**: Features categorized by type with budget scores (-10 to +10) +- **Technology**: Budget scoring, regional probability modifiers, feature suitability analysis + +### Multi-Scale Architecture + +``` +Global World Map (Diplomatic/Strategic Level) +├── Terrain Generation (Base) +├── Biome Classification (Climate Zones) +├── Elevation Modeling (Topographical) +└── Feature Placement (Geographical Elements) + ├── Geological Features + ├── Aquatic Features + ├── Terrestrial Features + ├── Coastal Features + ├── Industrial Historic Features + └── Anomaly Features +``` + +## Budget Scoring System (-10 to +10) + +### Philosophy +Each tile receives a **target score** that determines its overall "potential". The system automatically balances valuable resources with proportional constraints to maintain gameplay equilibrium. + +### Score Distribution Strategy +- **30%** of tiles at score 0 (neutral terrain) +- **40%** of tiles at scores ±1 to ±3 (common variations) +- **20%** of tiles at scores ±4 to ±6 (remarkable zones) +- **8%** of tiles at scores ±7 to ±8 (exceptional zones) +- **2%** of tiles at scores ±9 to ±10 (legendary zones) + +### Global Geographical Biases +- **Mountainous zones**: +1 point (natural mineral concentration) +- **Coastal zones**: +0.5 point (access and sediments) +- **Historical industrial zones**: -1 point (inherited pollution) + +## Complete Feature Categorization + +### 1. Geological Features + +#### Basic Minerals (+1 point each) +- Iron ore deposits +- Copper veins +- Coal seams +- Lead deposits +- Sulfur formations +- Phosphorus nodes +- Natron fields + +#### Precious Minerals +- **+2 points**: Bauxite, Tin, Magnesium, Chrome, Antimony, Zinc +- **+3 points**: Titanium, Tungsten, Silver, Thorium +- **+4 points**: Gold, Lithium +- **+5 points**: Platinum, Uranium +- **+6 points**: Iridium + +#### Geological Formations +- **Caves (+1)**: Natural shelter, hidden resources +- **Thermal springs (+1)**: Geothermal energy source +- **Salt deposits (+1)**: Chemical resource +- **Meteorite impact (+5)**: Concentrated rare metals +- **Petrified forest (+2)**: Silica, geological attraction +- **Hot water geysers (+2)**: Energy, thermal tourism +- **Fairy chimneys (+1)**: Unique erosive formation +- **Natural arch (+1)**: Rock bridge, landmark +- **Isolated rocky pillar (+1)**: Erosive formation, nesting +- **Mesa (+1)**: Isolated plateau, defensive position + +### 2. Aquatic Features + +#### Water Bodies +- **Lake (+1)**: Fresh water, transport +- **Lake with central island (+2)**: Defensive position, mystery +- **Pond (+1)**: Local water resource +- **River delta (+2)**: Fertile lands, navigation routes +- **Fjord (+1)**: Protected natural port +- **Waterfall (+1)**: Hydraulic energy +- **River source (+2)**: Pure water, strategic position +- **River island (+1)**: Defensive position on waterway +- **Archipelago (+3)**: Multiple defensive positions, fishing +- **Atoll (+2)**: Protected lagoon, coral reef +- **Isolated cove (+2)**: Hidden port, storm protection +- **Cove with islet (+3)**: Protected anchorage, mystery +- **Skerry (+1)**: Rocky islet, difficult navigation +- **Tombolo (+2)**: Island connected by sandbar + +#### Special Aquatic Features +- **Marshland (0)**: Resources +2, terrain difficulties -2 +- **Dried lake (0)**: Salt +2, aridity -2 +- **Geyser (+2)**: Geothermal energy, attraction +- **Mountain oasis (+3)**: Precious water in arid zone +2, strategic position +2, access -1 + +### 3. Terrestrial Features + +#### Landforms +- **Canyon (0)**: Protection +2, difficult access -2 +- **Elevated plateau (+1)**: Dominant position, winds +- **Enclosed valley (+1)**: Protection, microclimate +- **Fertile plain (+2)**: Excellent agriculture +- **Steppe (0)**: Pastures +1, aridity -1 +- **Mobile dunes (-1)**: Terrain instability +- **Oasis (+3)**: Precious water in arid zone +- **Mountain pass (+1)**: Strategic passage +- **Glacial cirque (+1)**: Natural amphitheater +- **Gorge (0)**: Narrow passage +1, limited access -1 +- **Glacier (+1)**: Fresh water reserve, difficult terrain +- **Marshy hill (0)**: Elevated position +1, humidity -1 +- **Caldera (+3)**: Fertile volcanic soil, geothermal +- **Isthmus (+2)**: Control of land connection +- **Isolated valley (+2)**: Total protection, self-sufficiency +- **Isolated mountain (+1)**: Landmark, dominant position +- **Giant crater (+4)**: Spectacular formation, minerals +- **Desert plateau (0)**: Elevated position +1, aridity -1 +- **Badlands (-1)**: Severe erosion, poor soil +- **Ice oasis (+2)**: Water in arctic zone +- **Abyss (-2)**: Natural danger, underground access + +### 4. Coastal Features + +#### Coastal Landforms +- **Protected bay (+2)**: Excellent natural port +- **Cliffs (0)**: Defense +2, access -2 +- **Sandy beach (+1)**: Landing, tourism +- **Coral reef (+1)**: Natural protection +- **Estuary (+2)**: River-maritime commerce +- **Peninsula (+1)**: Defensive position +- **Strait (+2)**: Control of maritime passage +- **Coastal island (+2)**: Maritime outpost, defense +- **Coastal cliffs (+1)**: Natural defense, elevated position +- **Coastal rift (+1)**: Geological formation, limited access + +### 5. Industrial Historic Features + +#### Historic Industrial Sites +- **Terikon (0)**: Pollution -2, scrap +2 +- **Ghost town (-1)**: Infrastructure +2, dangers -3 +- **Abandoned textile factory (0)**: Machinery +2, asbestos -2 +- **Defunct thermal power plant (-1)**: Infrastructure +3, pollution -4 +- **Steel mill ruins (+1)**: Massive metal scrap +3, contamination -2 +- **Abandoned refinery (-2)**: Infrastructure +2, toxic pollution -4 +- **Chemical complex (-3)**: Equipment +3, severe contamination -6 +- **Industrial mill (+1)**: Machinery +2, hydraulic wheel +1, decay -2 +- **Abandoned brickyard (+1)**: Local clay +2, furnaces +1, fumes -2 +- **Glass factory ruins (+1)**: Silica sand +2, equipment +1, debris -2 +- **Defunct paper mill (0)**: Machinery +2, river pollution -2 +- **Illegal distillery (+1)**: Copper equipment +2, isolation +1, reputation -2 +- **Abandoned sawmill (+1)**: Tools +3, stored wood +1, rust -3 + +#### Vehicle Graveyards +- **Tank graveyard (+2)**: Military metal scrap +- **Car cemetery (+1)**: Civil metal scrap +- **Aircraft graveyard (+3)**: Rare aviation alloys +- **Open-air landfill (-1)**: Pollution -3, scrap +2 +- **Train wreck (+2)**: Massive steel +3, historical accident -1 +- **Ship graveyard (+2)**: Naval steel +3, corrosion -1 +- **Electronic dump (+1)**: Rare metals +3, toxicity -2 +- **Abandoned gas station (0)**: Underground tanks +1, soil contamination -1 + +#### Abandoned Military Sites +- **Abandoned Cold War base (+1)**: Bunkers +3, contamination -2 +- **Ancient war zone (WW1) (0)**: Dangerous munitions -2, scrap +2 +- **Buried Nazi bunker (+2)**: Fortifications +3, history -1 +- **Missile launch site (+3)**: Infrastructure +4, contamination -1 +- **Inactive minefield (-2)**: Residual danger -3, demining +1 +- **Abandoned naval base (+2)**: Port installations +3, rust -1 +- **Military airfield (+2)**: Runway +3, hangars +1, residual fuel -2 +- **Munitions depot (-1)**: Dangerous explosives -4, metals +3 +- **Abandoned radar (+1)**: Electronic equipment +2, elevated position +1, obsolescence -2 + +### 6. Cultural & Natural Sites + +#### Cultural Heritage +- **Indigenous tribe (+2)**: Local knowledge, guides +- **Abandoned village (0)**: Buildings +1, isolation -1 +- **Monastery ruins (+1)**: Historical archives, elevated position +- **Archaeological site (+2)**: Artifacts, scientific value +- **Abandoned lighthouse (+1)**: Strategic coastal position +- **Fortress castle (+2)**: Defensive position, cut stone +- **Astronomical observatory (+1)**: Precision optics, isolated site +- **Historical cemetery (+1)**: Heritage, central position +- **Abandoned university (+2)**: Laboratories +3, libraries +1, decay -2 +- **Hospital ruins (0)**: Medical equipment +2, contamination -2 +- **Defunct prison (+1)**: Security +3, reputation -2 +- **Gothic cathedral (+2)**: Architecture +3, tourism +1, maintenance -2 +- **Historical windmill (+1)**: Ancient mechanics +2, windy position +1, obsolescence -2 +- **Abandoned collective farm (0)**: Hangars +2, land +1, decay -3 + +### 7. Biomes & Ecosystems + +#### Forest Types +- **Temperate forest (+1)**: Wood, biodiversity +- **Boreal forest (+1)**: Conifers, acidic soils +- **Tropical forest (+2)**: Biodiversity, exotic woods +- **Mixed forest (+1)**: Wood diversity, ecological balance +- **Cloud forest (+2)**: Constant humidity, rare species +- **Equatorial jungle (+2)**: Exotic resources +3, accessibility -1 + +#### Grasslands & Plains +- **Prairie (+1)**: Agriculture, livestock +- **Savanna (0)**: Pastures +1, drought -1 +- **Steppe grassland (0)**: Livestock +1, strong winds -1 +- **Pampa (+1)**: Fertile lands, constant winds +- **Chaparral (0)**: Fire resistance +1, brush -1 + +#### Extreme Environments +- **Tundra (0)**: Permafrost +0, extreme cold -1, isolation +1 +- **Taiga (+1)**: Massive wood, furs +- **Hot desert (-1)**: Aridity -2, exposed minerals +1 +- **Cold desert (-1)**: Cold -1, isolation +0 +- **Salt desert (-1)**: Hostile -3, salt extraction +2 +- **Ice sheet (-2)**: Extreme isolation -3, arctic fishing +1 + +#### Specialized Ecosystems +- **Mangrove (+2)**: Coastal protection, unique ecosystem +- **Alpine zone (0)**: Elevated position +2, difficult access -2 +- **Salt marsh (+1)**: Natural salt, terrain difficulties +- **Moorland (0)**: Poor soil -1, peat +1 +- **Mediterranean scrubland (+1)**: Aromatic plants, fires -1 +- **Wetland (+1)**: Natural filtration, biodiversity +- **Floodplain (0)**: Fertility +2, floods -2 +- **Continental shelf (+1)**: Fishing, maritime position +- **Barrier reef (+3)**: Protection +2, marine biodiversity +2, navigation -1 +- **Glacial valley (+1)**: Fertile soil +2, harsh climate -1 + +### 8. Geological Anomalies + +#### Crystal & Mineral Formations +- **Crystalline formations (+2)**: Unique minerals +- **Rare clay deposits (+2)**: Specialized materials +- **Silica sands (+1)**: Glass manufacturing +- **Quartz deposits (+2)**: Laser optics +- **Diamond veins (+4)**: Precision tools, industrial optics +- **Various precious stones (+2)**: Laser technology, electronics +- **Amber deposits (+3)**: Fossil resin, scientific inclusions +- **Oil shale (+2)**: Unconventional hydrocarbons + +#### Geological Phenomena +- **Methane geysers (+2)**: Energy, explosion risk +- **Salt dome (+3)**: Underground storage, chemical resource +- **Peat bog (+1)**: Organic fuel, preservation +- **Ancient lava flow (+2)**: Volcanic rocks, fertile lands +- **Impact crater (+4)**: Rare metals, unique geological formation +- **Active geological fault (-1)**: Instability +0, exposed minerals +1 +- **Karst (0)**: Caves +2, collapses -2 +- **Doline (-1)**: Natural collapse, underground access +- **Cave entrance (+2)**: Exploration, natural shelter +- **Surface cave (+1)**: Visible shelter, storage +- **Hell's pit (-3)**: Deep abyss, dangerous emanations + +### 9. Climate & Meteorological Elements + +#### Weather Phenomena +- **Tornado zone (-2)**: Danger -3, wind energy +1 +- **Wind corridor (+1)**: Constant wind energy +- **Fog zone (-1)**: Reduced visibility -2, humidity +1 +- **Warm microclimate (+1)**: Extended agriculture +- **Cold pocket (-1)**: Permanent frost, natural preservation +- **Dead calm zone (0)**: Difficult navigation -1, tranquility +1 + +### 10. Modern Anthropogenic Elements + +#### Infrastructure +- **Abandoned highway (+1)**: Asphalt +2, pollution -1 +- **Highway bridge (+2)**: Strategic passage +3, maintenance -1 +- **Railway tunnel (+2)**: Mountain passage +3, maintenance -1 +- **High-voltage line (+1)**: Electrical infrastructure +2, danger -1 +- **Broken wind turbine (0)**: Mechanical parts +2, obstruction -2 +- **Relay antenna (+1)**: Communication +2, elevated position +1, obsolescence -2 +- **Buried pipeline (+1)**: Infrastructure +2, leak risk -1 +- **Controlled landfill (-1)**: Recovery +2, pollution -3 + +### 11. Mysterious & Rare Elements + +#### Unexplained Phenomena +- **Stone circle (+2)**: Historical mystery, landmark +- **Isolated monolith (+3)**: Unexplained formation, attraction +- **Radio silence zone (-1)**: Unexplained phenomenon -2, isolation +1 +- **Magnetic anomaly (+2)**: Rare minerals +3, instrument disruption -1 +- **Natural radioactive source (-2)**: Danger -4, scientific research +2 + +## Resource Integration Patterns + +### 1. Integrated vs Standalone Resources + +#### Features with Integrated Resources +- **Terikon**: Industrial scrap integrated into feature definition +- **Ancient ruins**: Recoverable materials as part of structure +- **Industrial complexes**: Machinery and infrastructure as feature elements +- **River deltas**: Fertile sediments as inherent property + +#### Standalone Resource Deposits +- **Pure mineral patches**: Iron, copper, coal deposits independent of features +- **Oil/gas fields**: Energy resource patches with own extraction mechanics +- **Precious metal veins**: Gold, platinum as dedicated geological formations + +### 2. Resource-Feature Synergy + +#### Complementary Placement +- **Iron near industrial ruins**: Historical mining creates both resources and contamination +- **Thermal springs near volcanic minerals**: Geological activity creates multiple benefits +- **Clay deposits near abandoned brickworks**: Historical industry aligned with natural resources + +#### Balanced Combinations +- **Uranium + contamination**: Valuable resource offset by safety hazards +- **Fertile soil + flood risk**: Agricultural potential balanced by natural disasters +- **Strategic position + access difficulty**: Military value offset by logistical challenges + +## Regional Influences System + +### 1. Geological Specialization Zones + +#### Petroleum Basins (Persian Gulf, North Sea) +- **Petroleum**: probability ×5 +- **Natural gas**: probability ×3 +- **Marshy terrain**: ×2 +- **Natural maritime access**: inherent bonus + +#### Historic Mining Regions (Ruhr, Donbass, Urals) +- **Iron and coal**: probability ×3-4 +- **Terikons**: probability ×8 (highly characteristic) +- **Industrial vestiges**: ×2 +- **Inherited mining pollution**: ×3 + +#### Forest/Mountain Regions (Alps, Carpathians, Taiga) +- **Dense forest and hunting**: probability ×3-4 +- **Caves and springs**: ×2-3 +- **Steep slopes**: ×2 +- **Geological instability**: ×1.5 + +#### Post-Nuclear Zones (Extended Chernobyl, test sites) +- **Radioactive pollution**: probability ×10 +- **Accessible uranium**: ×3 +- **Abandoned structures**: ×3 +- **Characteristic mutant vegetation**: special markers + +#### Coastal Regions (Coastlines, deltas) +- **Maritime access**: natural bonus +- **Sediments and clays**: ×2 +- **Wetlands**: ×1.5 +- **Coastal erosion**: specific constraint + +### 2. Transition Zones + +#### Progressive Influence +Regional influence diminishes with distance from center, creating realistic mixed zones. + +#### Superposition Effects +Multiple influences can combine: +- **Mountain + ancient mining basin** = precious metals in difficult terrain +- **Coastal + industrial historic** = ports with pollution legacy +- **Forest + post-nuclear** = contaminated wilderness areas + +### 3. Fixed Historical Sites + +#### Iconic Locations with Fixed Characteristics +- **Chernobyl**: Fixed score -10 (massive radiation, dead zone) +- **Persian Gulf**: Fixed score +8 (abundant oil, infrastructure) +- **Siberian diamond region**: Fixed score +9 (diamonds + gold + extreme difficulties) +- **Atacama Desert**: Fixed score -7 (extreme aridity, rare minerals) +- **Ruhr Region**: Fixed score +3 (industrial wealth) + +## Procedural Generation Requirements + +### 1. Core Algorithms + +#### Deterministic Generation +```cpp +// Seed-based deterministic generation per tile +uint32_t tile_seed = global_seed ^ (tile_x << 16) ^ tile_y; +// Ensures exact terrain reproduction +``` + +#### Multi-Layer Noise Functions +- **Elevation generation**: Perlin noise for realistic topography +- **Climate modeling**: Temperature and humidity gradients +- **Resource distribution**: Probability maps based on geological realism +- **Feature placement**: Weighted random selection based on budget targets + +### 2. Budget Balancing Algorithm + +#### Target Score Achievement +```cpp +// Pseudo-algorithm for budget balancing +float target_score = calculateTargetScore(x, y, regional_bias); +vector combinations = generateCombinations(target_score); +FeatureCombination selected = selectBestFit(combinations, terrain_constraints); +``` + +#### Constraint Satisfaction +- **Terrain compatibility**: Features must match geological realism +- **Regional probability**: Apply regional influence multipliers +- **Mutual exclusion**: Some features cannot coexist +- **Spatial distribution**: Avoid over-clustering of similar features + +### 3. Discovery System Architecture + +#### Layered Visibility System + +##### Layer 1: Visible Elements +- Terrain relief and rock formations +- Waterways and springs +- Surface vegetation and forest cover +- Surface ruins and structures + +##### Layer 2: Geological Prospecting +- **Geological vehicle**: Reveals underground deposits, hydrocarbon reserves, deep water +- **Range**: 3×3 chunks from position +- **Duration**: 2-5 minutes based on depth + +##### Layer 3: Magnetometric Exploration +- **Magnetometric vehicle**: Detects magnetic anomalies, buried metal structures, monoliths +- **Range**: 1×1 chunk high precision +- **Duration**: 1-3 minutes + +##### Layer 4: CBRN Analysis +- **CBRN vehicle**: Reveals invisible contamination, radiation, chemical pollution +- **Safety**: Crew protection required +- **Duration**: 3-8 minutes based on danger level + +## Technical Implementation Requirements + +### 1. Module Architecture + +#### WorldGenerationModule Responsibilities +- **Terrain base generation**: Elevation, basic terrain types +- **Biome classification**: Climate-based biome assignment +- **Seed management**: Deterministic reproduction +- **Configuration loading**: From gameData/ hierarchy + +#### WorldFeatureModule Responsibilities +- **Feature placement**: 218+ geographical features using budget system +- **Budget calculation**: -10 to +10 scoring for each tile +- **Regional influence**: Probability modifiers based on geographical zones +- **Discovery system**: Layered visibility and exploration requirements + +### 2. Data Structures + +#### Tile Structure +```cpp +struct Tile { + uint16_t terrain_type; // 2 bytes (65k terrain types possible) + uint8_t elevation; // 1 byte (0-255 height) + uint16_t building_id; // 2 bytes (ref to building) + uint16_t flags; // 2 bytes (passable, destructible, etc.) + uint8_t padding; // 1 byte (memory alignment) +}; // = 8 bytes per tile +``` + +#### Feature Structure +```cpp +struct WorldFeature { + string feature_id; + string feature_type; + FeatureCategory category; + int x, y; // World coordinates + float budget_score; // -10 to +10 budget scoring + json properties; // Feature-specific properties + vector> affected_tiles; // Tiles covered by feature +}; +``` + +### 3. Performance Specifications + +#### Memory Footprint per Chunk (64×64 tiles) +- **Terrain**: 32KB (always loaded) +- **Resources**: 0-16KB (sparse, on-demand) +- **Metadata**: 1-5KB (buildings and features) +- **Total**: 33-53KB per chunk (highly reasonable) + +#### Generation Performance +- **Streaming generation**: Create chunks on-demand +- **Persistent storage**: Save once generated with seed +- **Reproduction guarantee**: Same seed = identical terrain +- **Hot-reload friendly**: State preservation across module reloads + +### 4. Configuration System + +#### gameData/ Hierarchy +``` +gameData/ +├── WorldGeneration/ # Generation algorithms and parameters +├── Biomes/ # Biome definitions and properties +├── Terrain/ # Terrain type definitions +├── MapFeatures/ # Geographical features database +└── RegionalInfluences/ # Regional probability modifiers +``` + +#### JSON Configuration Format +```json +{ + "feature_types": { + "terikon": { + "category": "INDUSTRIAL_HISTORIC", + "budget_score": 0, + "components": [ + {"type": "industrial_waste", "score": 1}, + {"type": "mining_pollution", "score": -2} + ], + "regional_multipliers": { + "mining_historic": 8.0, + "industrial_legacy": 3.0 + }, + "terrain_requirements": ["flat", "historical_mining"], + "mutual_exclusions": ["pristine_nature", "urban_center"] + } + } +} +``` + +## Code Examples & Algorithms + +### 1. Budget Score Calculation + +```cpp +float WorldFeatureModule::calculateFeatureBudgetScore(const string& featureType, int x, int y) const { + float base_score = feature_definitions[featureType].base_score; + float regional_modifier = calculateRegionalInfluence(featureType, x, y); + float terrain_modifier = calculateTerrainSuitability(featureType, x, y); + + return base_score * regional_modifier * terrain_modifier; +} +``` + +### 2. Regional Influence Application + +```cpp +float calculateRegionalInfluence(const string& featureType, int x, int y) const { + float influence = 1.0f; + + for (const auto& region : active_regions) { + float distance = calculateDistance(x, y, region.center_x, region.center_y); + float weight = region.calculateInfluenceWeight(distance); + + if (region.feature_multipliers.count(featureType)) { + influence *= (1.0f + (region.feature_multipliers[featureType] - 1.0f) * weight); + } + } + + return influence; +} +``` + +### 3. Feature Combination Generation + +```cpp +vector generateCombinations(float target_score) { + vector combinations; + + // Single feature solutions + for (const auto& feature : available_features) { + if (abs(feature.score - target_score) < tolerance) { + combinations.push_back({feature}); + } + } + + // Multi-feature combinations + for (int count = 2; count <= max_features_per_tile; count++) { + auto multi_combinations = generateMultiFeatureCombinations(target_score, count); + combinations.insert(combinations.end(), multi_combinations.begin(), multi_combinations.end()); + } + + return combinations; +} +``` + +## Gameplay Mechanics Integration + +### 1. Economic Specialization +- **Petroleum basins** naturally become energy centers +- **Historic mining zones** evolve into metallurgical centers +- **Forest regions** specialize in wood construction and hunting + +### 2. Strategic Territory Control +- **Regional control**: Certain regions become strategically vital +- **Targeted exploration**: "Seeking iron → head to historic mining mountains" +- **Specialized challenges**: Each region imposes unique technical constraints + +### 3. Risk/Reward Learning +- **Visual pattern recognition**: Players learn regional indicators +- **Terikons** = probable historic mining zone = iron but pollution +- **Abnormal vegetation** = contamination = danger but potential rare resources + +### 4. Temporal Evolution +- **Player actions modify scores**: Decontamination, resource depletion, industrial accidents +- **Natural processes**: Forest regeneration, contamination erosion, sedimentation +- **Dynamic rebalancing**: World evolves based on player activities + +## Implementation Priority & Roadmap + +### Phase 1: Core Generation (Foundation) +1. **Basic terrain generation**: Elevation, terrain types, biomes +2. **Simple feature placement**: Major geological and aquatic features +3. **Budget system framework**: Basic scoring without regional influences +4. **Deterministic reproduction**: Seed-based generation + +### Phase 2: Advanced Features (Expansion) +1. **Regional influence system**: Geological and historical zone specialization +2. **Complete feature catalog**: All 218+ features with proper categorization +3. **Discovery system**: Layered visibility and exploration mechanics +4. **Advanced balancing**: Complex feature interactions and constraints + +### Phase 3: Integration & Optimization (Polish) +1. **Performance optimization**: Streaming, caching, memory management +2. **Gameplay integration**: Economic systems, strategic mechanics +3. **Temporal evolution**: Dynamic world changes based on player actions +4. **Advanced algorithms**: Machine learning for pattern recognition and optimization + +## Development Guidelines + +### Module Constraints +- **200-300 lines maximum** per module (strict architectural requirement) +- **JSON-only communication** between modules +- **Hot-reload compatibility** with state preservation +- **Autonomous builds**: `cd src/modules/world-generation/ && cmake .` + +### Testing Strategy +- **Deterministic verification**: Same seed produces identical results +- **Budget balance validation**: Statistical distribution matches targets +- **Regional influence testing**: Probability multipliers work correctly +- **Feature placement validation**: No invalid combinations or overlaps + +### Configuration-Driven Development +- **External data files**: All features, rules, and parameters in gameData/ +- **Easy iteration**: Modify JSON configs without code recompilation +- **Designer-friendly**: Non-programmers can adjust gameplay balance +- **Version control**: Track configuration changes separately from code + +--- + +**Technical Conclusion**: The Warfactory worldmap generation system represents a sophisticated approach to procedural world creation, combining realistic geological patterns with innovative budget-based balancing. The modular architecture ensures maintainability while the regional influence system creates compelling geographical specialization that emerges naturally from real-world patterns. + +The system successfully bridges the gap between procedural generation flexibility and historical/geographical authenticity, creating a world that feels both familiar and strategically interesting for players to explore and exploit. \ No newline at end of file diff --git a/src/modules/world-generation/include/FeatureManager.h b/src/modules/world-generation/include/FeatureManager.h new file mode 100644 index 0000000..bd47cd9 --- /dev/null +++ b/src/modules/world-generation/include/FeatureManager.h @@ -0,0 +1,244 @@ +#pragma once + +#include "WorldFeature.h" +#include "FeatureSet.h" +#include "GMap.h" +#include +#include +#include + +using json = nlohmann::json; + +namespace warfactory { + +/** + * @brief Helper for generation algorithms - handles feature placement complexity + * + * Provides simple interface for generation algorithms while hiding all internal + * complexity of feature placement, feature set management, budget calculations, + * and resource integration. Does NOT do generation itself - just helps algorithms. + */ +class FeatureManager { +private: + GMap* world_map; // Reference to world map (not owned) + + // Configuration cache (loaded once, used repeatedly) + std::unordered_map feature_type_configs; // Feature definitions + std::unordered_map base_budget_scores; // Type -> budget score + + // Feature set optimization cache + std::unordered_map, uint32_t> feature_set_cache; // Deduplication + + // ======================================== + // INTERNAL COMPLEXITY - Hidden from users + // ======================================== + + /** + * @brief Create WorldFeature from type and position (internal) + */ + WorldFeature createFeatureInstance(const std::string& feature_type, int center_x, int center_y) const; + + /** + * @brief Update affected tiles with new feature set (internal) + */ + void updateAffectedTiles(const WorldFeature& feature); + + /** + * @brief Calculate budget impact without placing (internal) + */ + float calculateBudgetImpact(const std::string& feature_type, int x, int y) const; + + /** + * @brief Check terrain/biome/elevation compatibility (internal) + */ + bool checkTerrainCompatibility(const std::string& feature_type, int x, int y) const; + + /** + * @brief Generate integrated resources for feature (internal) + */ + void generateIntegratedResources(WorldFeature& feature) const; + +public: + /** + * @brief Constructor + */ + FeatureManager(); + + /** + * @brief Destructor + */ + ~FeatureManager() = default; + + // ======================================== + // INITIALIZATION - Simple setup + // ======================================== + + /** + * @brief Set reference to world map + * @param map Mutable reference to world map + */ + void setWorldMap(GMap* map); + + /** + * @brief Load feature definitions (call once) + * @param feature_configs JSON configuration for all feature types + */ + void loadFeatureDefinitions(const json& feature_configs); + + // ======================================== + // CORE INTERFACE - Helper for generation algorithms + // ======================================== + + /** + * @brief Check if feature can be placed at location + * @param feature_type Feature type name (e.g., "terikon", "scrap_metal") + * @param x X coordinate + * @param y Y coordinate + * @return true if feature can be placed (terrain compatible, space available, etc.) + */ + bool canPlaceFeature(const std::string& feature_type, int x, int y) const; + + /** + * @brief Place single feature at coordinates (handles all complexity) + * @param feature_type Feature type name + * @param center_x Center X coordinate + * @param center_y Center Y coordinate + * @return Feature ID if placed successfully, 0 if failed + * + * Internally handles: + * - Creating WorldFeature with resources + * - Finding affected tiles + * - Creating/updating FeatureSets + * - Updating tile feature_set_ids + * - Budget score recalculation + */ + uint32_t placeFeature(const std::string& feature_type, int center_x, int center_y); + + /** + * @brief Remove feature from map (handles cleanup) + * @param feature_id Feature ID to remove + * @return true if feature was removed successfully + * + * Internally handles: + * - Removing from GMap::features + * - Updating affected tiles + * - Cleaning up unused FeatureSets + * - Budget score recalculation + */ + bool removeFeature(uint32_t feature_id); + + // ======================================== + // UTILITY QUERIES - For algorithm decision making + // ======================================== + + /** + * @brief Get budget impact of placing feature (without placing) + * @param feature_type Feature type name + * @param x X coordinate + * @param y Y coordinate + * @return Budget score impact (positive/negative) + */ + float getBudgetImpact(const std::string& feature_type, int x, int y) const; + + /** + * @brief Check if feature type exists in configuration + * @param feature_type Feature type name + * @return true if feature type is defined + */ + bool isFeatureTypeValid(const std::string& feature_type) const; + + /** + * @brief Get feature at specific coordinates + * @param x X coordinate + * @param y Y coordinate + * @return Vector of feature IDs at location + */ + std::vector getFeaturesAt(int x, int y) const; + + /** + * @brief Check if location has any features + * @param x X coordinate + * @param y Y coordinate + * @return true if tile has features + */ + bool hasFeatures(int x, int y) const; + + /** + * @brief Get number of features at location + * @param x X coordinate + * @param y Y coordinate + * @return Feature count at tile + */ + size_t getFeatureCount(int x, int y) const; + + // ======================================== + // CONFIGURATION QUERIES - For algorithm parameters + // ======================================== + + /** + * @brief Get base budget score for feature type + * @param feature_type Feature type name + * @return Base budget score (-10 to +10) + */ + float getBaseBudgetScore(const std::string& feature_type) const; + + /** + * @brief Get feature category for type + * @param feature_type Feature type name + * @return Feature category + */ + FeatureCategory getFeatureCategory(const std::string& feature_type) const; + + /** + * @brief Get available feature types for category + * @param category Feature category + * @return Vector of feature type names + */ + std::vector getFeatureTypesForCategory(FeatureCategory category) const; + + // ======================================== + // OPTIMIZATION AND MAINTENANCE + // ======================================== + + /** + * @brief Optimize feature set storage (remove unused sets) + * @return Number of feature sets cleaned up + */ + int optimizeFeatureSets(); + + /** + * @brief Get statistics for debugging/monitoring + * @return JSON with feature counts, memory usage, etc. + */ + json getStats() const; + + /** + * @brief Validate all features and sets consistency + * @return JSON with validation results + */ + json validateConsistency() const; + + // ======================================== + // FEATURE SET MANAGEMENT - Advanced helpers + // ======================================== + + /** + * @brief Place multiple features as coordinated set + * @param feature_types Vector of feature type names + * @param center_x Center X coordinate + * @param center_y Center Y coordinate + * @return Feature set ID if placed successfully, 0 if failed + */ + uint32_t placeFeatureGroup(const std::vector& feature_types, int center_x, int center_y); + + /** + * @brief Check if feature group can be placed + * @param feature_types Vector of feature type names + * @param center_x Center X coordinate + * @param center_y Center Y coordinate + * @return true if all features in group can be placed + */ + bool canPlaceFeatureGroup(const std::vector& feature_types, int center_x, int center_y) const; +}; + +} // namespace warfactory \ No newline at end of file diff --git a/src/modules/world-generation/include/FeatureSet.h b/src/modules/world-generation/include/FeatureSet.h new file mode 100644 index 0000000..1a4cb49 --- /dev/null +++ b/src/modules/world-generation/include/FeatureSet.h @@ -0,0 +1,210 @@ +#pragma once + +#include +#include +#include + +using json = nlohmann::json; + +namespace warfactory { + +// Forward declarations +class GMap; + +/** + * @brief Immutable feature set for tile feature collections + * + * Encapsulates a collection of features with caching and usage tracking. + * Once created, the feature collection cannot be modified, ensuring consistency + * and enabling aggressive caching optimizations. + */ +class FeatureSet { +private: + // ======================================== + // IMMUTABLE FEATURE DATA + // ======================================== + std::vector feature_ids; // Feature IDs in this set (immutable) + uint32_t primary_feature_id; // Most significant feature (0 = none) + + // ======================================== + // USAGE TRACKING (mutable for tracking) + // ======================================== + mutable std::unordered_set used_by_tiles; // Tile indices using this set + + // ======================================== + // PERFORMANCE CACHE (mutable for lazy evaluation) + // ======================================== + mutable float cached_budget_score; // Cached total budget score + mutable bool budget_cache_valid; // Cache validity flag + +public: + /** + * @brief Constructor - creates immutable feature set + * @param features Vector of feature IDs + * @param primary_feature Primary feature ID (0 = auto-determine) + */ + explicit FeatureSet(const std::vector& features, uint32_t primary_feature = 0); + + /** + * @brief Constructor - single feature set + * @param feature_id Single feature ID + */ + explicit FeatureSet(uint32_t feature_id); + + /** + * @brief Destructor + */ + ~FeatureSet() = default; + + // ======================================== + // FEATURE ACCESS - Read-only interface + // ======================================== + + /** + * @brief Get all feature IDs in set + * @return Immutable reference to feature vector + */ + const std::vector& getFeatureIds() const { return feature_ids; } + + /** + * @brief Get primary feature ID + * @return Primary feature ID (0 if none) + */ + uint32_t getPrimaryFeatureId() const { return primary_feature_id; } + + /** + * @brief Check if set contains specific feature + * @param feature_id Feature ID to check + * @return true if feature is in set + */ + bool hasFeature(uint32_t feature_id) const; + + /** + * @brief Get number of features in set + * @return Feature count + */ + size_t getFeatureCount() const { return feature_ids.size(); } + + /** + * @brief Check if set is empty + * @return true if no features + */ + bool isEmpty() const { return feature_ids.empty(); } + + // ======================================== + // BUDGET CALCULATIONS - Cached for performance + // ======================================== + + /** + * @brief Calculate total budget score for this feature set + * @param world_map Reference to world map for feature lookups + * @return Total budget contribution (cached after first call) + */ + float getBudgetScore(const GMap* world_map) const; + + /** + * @brief Invalidate budget cache (call when features change globally) + */ + void invalidateBudgetCache() const; + + // ======================================== + // USAGE TRACKING - For memory management + // ======================================== + + /** + * @brief Mark tile as using this feature set + * @param tile_index Tile index that uses this set + */ + void addUsage(uint32_t tile_index) const; + + /** + * @brief Remove tile usage of this feature set + * @param tile_index Tile index that no longer uses this set + */ + void removeUsage(uint32_t tile_index) const; + + /** + * @brief Get number of tiles using this set + * @return Usage count + */ + size_t getUsageCount() const { return used_by_tiles.size(); } + + /** + * @brief Check if any tiles are using this set + * @return true if set is in use + */ + bool isInUse() const { return !used_by_tiles.empty(); } + + /** + * @brief Get tiles using this set + * @return Set of tile indices + */ + const std::unordered_set& getUsedByTiles() const { return used_by_tiles; } + + // ======================================== + // COMPARISON AND HASHING - For deduplication + // ======================================== + + /** + * @brief Check if two feature sets are identical + * @param other Other feature set + * @return true if feature collections are identical + */ + bool operator==(const FeatureSet& other) const; + + /** + * @brief Check if two feature sets are different + * @param other Other feature set + * @return true if feature collections differ + */ + bool operator!=(const FeatureSet& other) const { return !(*this == other); } + + /** + * @brief Generate hash for this feature set + * @return Hash value for deduplication + */ + size_t getHash() const; + + // ======================================== + // UTILITIES AND DEBUGGING + // ======================================== + + /** + * @brief Get debug information about this set + * @return JSON with set details and usage statistics + */ + json getDebugInfo() const; + + /** + * @brief Validate feature set consistency + * @param world_map Reference to world map for validation + * @return true if set is valid + */ + bool validate(const GMap* world_map) const; + + /** + * @brief Get memory footprint of this set + * @return Memory usage in bytes + */ + size_t getMemoryFootprint() const; + +private: + /** + * @brief Determine primary feature from feature list + * @param world_map Reference to world map for feature lookups + * @return Feature ID with highest budget score + */ + uint32_t determinePrimaryFeature(const GMap* world_map) const; +}; + +} // namespace warfactory + +// Hash function for FeatureSet (enables use in unordered containers) +namespace std { + template<> + struct hash { + size_t operator()(const warfactory::FeatureSet& feature_set) const { + return feature_set.getHash(); + } + }; +} \ No newline at end of file diff --git a/src/modules/world-generation/include/GMap.h b/src/modules/world-generation/include/GMap.h new file mode 100644 index 0000000..f820743 --- /dev/null +++ b/src/modules/world-generation/include/GMap.h @@ -0,0 +1,333 @@ +#pragma once + +#include "WorldTile.h" +#include +#include +#include +#include + +using json = nlohmann::json; + +namespace warfactory { + +// Forward declarations +struct WorldFeature; + +/** + * @brief Global world map data structure with budget system and regional influences + * + * Implements the revolutionary budget-based generation system from analysis: + * - Automatic risk/reward balancing through -10 to +10 scoring + * - Regional influences that create specialized geographical zones + * - Separation of terrain (always loaded) and resources (on-demand) + * - Support for 218+ feature types with budget integration + * - Integration with WorldTile class for encapsulated tile logic + */ +class GMap { +private: + int width, height; + uint64_t world_seed; // Global generation seed + + // ======================================== + // TILE DATA - Optimized 24-byte structure + // ======================================== + std::vector tiles; // Linear array: index = y * width + x + + // ======================================== + // GLOBAL MAPS - Referenced by tiles + // ======================================== + + // Feature sets - collections of features for tiles + std::unordered_map> feature_sets; // set_id -> feature_ids + uint32_t next_feature_set_id; + + // Individual features - referenced by feature sets + std::unordered_map features; + uint32_t next_feature_id; + + // Regional influences - complex influence data + std::unordered_map regional_influences; // influence_id -> influence_data + uint32_t next_regional_influence_id; + + // Feature type definitions (loaded from configuration) + std::unordered_map feature_definitions; + + // Budget scoring metadata + std::unordered_map budget_score_distribution; // Score -> tile count + + // ======================================== + // INTERNAL HELPERS - Data access optimization + // ======================================== + + /** + * @brief Get tile index from coordinates + */ + uint32_t getTileIndex(int x, int y) const { return y * width + x; } + + /** + * @brief Get coordinates from tile index + */ + std::pair getCoordinatesFromIndex(uint32_t index) const { + return {index % width, index / width}; + } + +public: + /** + * @brief Construct world map with specified dimensions and seed + * @param w Map width in tiles + * @param h Map height in tiles + * @param seed World generation seed for deterministic results + */ + GMap(int w, int h, uint64_t seed = 0); + + /** + * @brief Destructor - ensures proper cleanup + */ + ~GMap(); + + // ======================================== + // BASIC ACCESSORS + // ======================================== + int getWidth() const { return width; } + int getHeight() const { return height; } + uint64_t getWorldSeed() const { return world_seed; } + + /** + * @brief Get lightweight tile wrapper for easy access + */ + WorldTile getTile(int x, int y); + WorldTile getTile(int x, int y) const; + + /** + * @brief Check if coordinates are valid + */ + bool isValidCoordinate(int x, int y) const; + + // ======================================== + // DIRECT TILE DATA ACCESS - For WorldTile wrapper + // ======================================== + + // Direct access to tile data (used by WorldTile) + WorldTileData& getTileData(uint32_t tile_index) { return tiles[tile_index]; } + const WorldTileData& getTileData(uint32_t tile_index) const { return tiles[tile_index]; } + + // ======================================== + // FEATURE SET MANAGEMENT + // ======================================== + + /** + * @brief Create new feature set + * @param feature_ids Vector of feature IDs for this set + * @return New feature set ID + */ + uint32_t createFeatureSet(const std::vector& feature_ids); + + /** + * @brief Get feature IDs from feature set + * @param set_id Feature set ID + * @return Vector of feature IDs (empty if set doesn't exist) + */ + std::vector getFeatureSet(uint32_t set_id) const; + + /** + * @brief Check if feature set exists + */ + bool hasFeatureSet(uint32_t set_id) const; + + /** + * @brief Get or create feature set for feature combination + * @param feature_ids Vector of feature IDs + * @return Feature set ID (existing or newly created) + */ + uint32_t getOrCreateFeatureSet(const std::vector& feature_ids); + + // ======================================== + // REGIONAL INFLUENCE MANAGEMENT + // ======================================== + + /** + * @brief Create regional influence + * @param influence_data JSON data describing the influence + * @return New regional influence ID + */ + uint32_t createRegionalInfluence(const json& influence_data); + + /** + * @brief Get regional influence data + * @param influence_id Regional influence ID + * @return JSON influence data (null if doesn't exist) + */ + json getRegionalInfluence(uint32_t influence_id) const; + + // ======================================== + // INITIALIZATION + // ======================================== + + /** + * @brief Initialize tiles array (called by constructor) + */ + void initializeTiles(); + + // Budget system methods + /** + * @brief Set target budget score for a tile + */ + void setTargetBudgetScore(int x, int y, float target_score); + + /** + * @brief Calculate actual budget score for a tile (delegates to WorldTile) + */ + float calculateActualBudgetScore(int x, int y) const; + + /** + * @brief Update actual budget scores for all tiles + */ + void updateAllBudgetScores(); + + /** + * @brief Get budget score distribution statistics + */ + json getBudgetScoreDistribution() const; + + /** + * @brief Balance budget for a specific tile + */ + bool balanceTileBudget(int x, int y); + + /** + * @brief Balance budgets for entire map + */ + void balanceAllBudgets(); + + // Regional influence methods + /** + * @brief Add regional influence zone + */ + void addRegionalInfluence(RegionalInfluence influence, const std::vector>& area); + + /** + * @brief Get regional influence at coordinates + */ + RegionalInfluence getRegionalInfluence(int x, int y) const; + + /** + * @brief Get feature probability modifier for location + */ + float getFeatureProbabilityModifier(int x, int y, const std::string& feature_type) const; + + // Resource patch methods + /** + * @brief Add resource patch to the map + */ + uint32_t addResourcePatch(const ResourcePatch& patch); + + /** + * @brief Get resource patch by ID + */ + const ResourcePatch* getResourcePatch(uint32_t patch_id) const; + + /** + * @brief Get mutable resource patch by ID + */ + ResourcePatch* getResourcePatchMutable(uint32_t patch_id); + + /** + * @brief Get all resource patches affecting a tile + */ + std::vector getResourcePatchesAt(int x, int y) const; + + /** + * @brief Remove resource patch + */ + bool removeResourcePatch(uint32_t patch_id); + + /** + * @brief Get all resource patches + */ + const std::unordered_map& getResourcePatches() const { return resource_patches; } + + // Feature management methods + /** + * @brief Add feature to the map + */ + uint32_t addFeature(const WorldFeature& feature); + + /** + * @brief Get feature by ID + */ + const WorldFeature* getFeature(uint32_t feature_id) const; + + /** + * @brief Get mutable feature by ID + */ + WorldFeature* getFeatureMutable(uint32_t feature_id); + + /** + * @brief Remove feature from map + */ + bool removeFeature(uint32_t feature_id); + + /** + * @brief Get all features + */ + const std::unordered_map& getFeatures() const { return features; } + + /** + * @brief Set feature type definitions + */ + void setFeatureDefinitions(const std::unordered_map& definitions); + + /** + * @brief Get feature type definitions + */ + const std::unordered_map& getFeatureDefinitions() const { return feature_definitions; } + + // Serialization methods + /** + * @brief Export entire map to JSON + */ + json toJson() const; + + /** + * @brief Import map from JSON data + */ + void fromJson(const json& data); + + /** + * @brief Export region to JSON for networking/storage + */ + json exportRegion(int start_x, int start_y, int region_width, int region_height) const; + + /** + * @brief Import region from JSON (for streaming/networking) + */ + void importRegion(const json& region_data, int start_x, int start_y); + + // Utility methods + /** + * @brief Clear all data and reset to default state + */ + void clear(); + + /** + * @brief Generate deterministic tile seed for procedural generation + */ + uint32_t getTileSeed(int x, int y) const; + + /** + * @brief Validate map consistency + */ + bool validate() const; + + /** + * @brief Get memory usage statistics + */ + json getMemoryStats() const; + + /** + * @brief Optimize memory usage (remove unused patches, compact vectors) + */ + void optimizeMemory(); +}; + +} // namespace warfactory \ No newline at end of file diff --git a/src/modules/world-generation/include/IGenerationLayer.h b/src/modules/world-generation/include/IGenerationLayer.h new file mode 100644 index 0000000..38538ce --- /dev/null +++ b/src/modules/world-generation/include/IGenerationLayer.h @@ -0,0 +1,249 @@ +#pragma once + +#include +#include + +using json = nlohmann::json; + +namespace warfactory { + +// Forward declarations +class GMap; +struct PlanetaryCore; + +/** + * @brief Interface for step-by-step world generation layers + * + * Enables cycle-by-cycle execution of geological, climate, and resource generation + * phases with progress tracking and debugging capabilities. + */ +class IGenerationLayer { +public: + virtual ~IGenerationLayer() = default; + + // ======================================== + // STEP-BY-STEP EXECUTION + // ======================================== + + /** + * @brief Execute one step/cycle of generation + * @param map World map to modify + * @param core Planetary core for mass conservation + * @param config Layer-specific configuration + * @return true if layer has more steps to execute + */ + virtual bool executeStep(GMap& map, PlanetaryCore& core, const json& config) = 0; + + /** + * @brief Check if layer has more steps to execute + * @return true if more steps available + */ + virtual bool hasMoreSteps() const = 0; + + /** + * @brief Reset layer to initial state + */ + virtual void reset() = 0; + + // ======================================== + // PROGRESS TRACKING + // ======================================== + + /** + * @brief Get current step number (0-based) + * @return Current step index + */ + virtual int getCurrentStep() const = 0; + + /** + * @brief Get total number of steps in this layer + * @return Total step count + */ + virtual int getTotalSteps() const = 0; + + /** + * @brief Get human-readable description of current step + * @return Step description (e.g., "Phase 2 Cycle 15") + */ + virtual std::string getStepDescription() const = 0; + + /** + * @brief Get layer completion progress + * @return Progress as percentage (0.0-1.0) + */ + virtual float getProgress() const = 0; + + // ======================================== + // LAYER METADATA + // ======================================== + + /** + * @brief Get layer name for identification + * @return Layer name (e.g., "Geological", "Climate") + */ + virtual std::string getName() const = 0; + + /** + * @brief Get estimated time for this layer + * @return Estimated seconds for completion + */ + virtual float getEstimatedDuration() const = 0; + + /** + * @brief Check if layer is currently active + * @return true if layer is executing + */ + virtual bool isActive() const = 0; + + /** + * @brief Check if layer execution is complete + * @return true if all steps finished + */ + virtual bool isComplete() const = 0; + + // ======================================== + // CONFIGURATION AND VALIDATION + // ======================================== + + /** + * @brief Validate configuration before execution + * @param config Configuration JSON to validate + * @return true if configuration is valid + */ + virtual bool validateConfig(const json& config) const = 0; + + /** + * @brief Get default configuration for this layer + * @return Default JSON configuration + */ + virtual json getDefaultConfig() const = 0; + + /** + * @brief Get required configuration parameters + * @return Vector of required parameter names + */ + virtual std::vector getRequiredConfigParams() const = 0; + + // ======================================== + // DEBUGGING AND MONITORING + // ======================================== + + /** + * @brief Get detailed status information + * @return JSON with current state details + */ + virtual json getDetailedStatus() const = 0; + + /** + * @brief Get performance metrics for this layer + * @return JSON with timing and performance data + */ + virtual json getPerformanceMetrics() const = 0; + + /** + * @brief Enable/disable detailed logging + * @param enabled Whether to enable verbose logging + */ + virtual void setVerboseLogging(bool enabled) = 0; + + /** + * @brief Check if layer can be paused mid-execution + * @return true if pausable + */ + virtual bool isPausable() const = 0; + + /** + * @brief Pause layer execution + */ + virtual void pause() = 0; + + /** + * @brief Resume layer execution + */ + virtual void resume() = 0; +}; + +/** + * @brief Base implementation with common functionality + * + * Provides standard implementations for common layer operations. + * Derived layers only need to implement generation-specific logic. + */ +class GenerationLayerBase : public IGenerationLayer { +protected: + // State tracking + int current_step = 0; + int total_steps = 0; + bool active = false; + bool complete = false; + bool paused = false; + bool verbose_logging = false; + + // Performance tracking + mutable float execution_time = 0.0f; + mutable int steps_executed = 0; + + // Layer metadata + std::string layer_name; + float estimated_duration = 0.0f; + +public: + /** + * @brief Constructor + * @param name Layer name + * @param steps Total number of steps + * @param duration Estimated duration in seconds + */ + GenerationLayerBase(const std::string& name, int steps, float duration); + + // ======================================== + // COMMON IMPLEMENTATIONS + // ======================================== + + float getProgress() const override; + std::string getName() const override { return layer_name; } + float getEstimatedDuration() const override { return estimated_duration; } + bool isActive() const override { return active; } + bool isComplete() const override { return complete; } + int getCurrentStep() const override { return current_step; } + int getTotalSteps() const override { return total_steps; } + + void reset() override; + void pause() override { paused = true; } + void resume() override { paused = false; } + bool isPausable() const override { return true; } + void setVerboseLogging(bool enabled) override { verbose_logging = enabled; } + + json getPerformanceMetrics() const override; + json getDetailedStatus() const override; + + // ======================================== + // TO BE IMPLEMENTED BY DERIVED CLASSES + // ======================================== + + virtual bool executeStep(GMap& map, PlanetaryCore& core, const json& config) override = 0; + virtual std::string getStepDescription() const override = 0; + virtual bool validateConfig(const json& config) const override = 0; + virtual json getDefaultConfig() const override = 0; + virtual std::vector getRequiredConfigParams() const override = 0; + +protected: + /** + * @brief Mark step as complete and advance + * @return true if more steps available + */ + bool advanceStep(); + + /** + * @brief Mark layer as complete + */ + void markComplete(); + + /** + * @brief Log message if verbose logging enabled + * @param message Message to log + */ + void logVerbose(const std::string& message) const; +}; + +} // namespace warfactory \ No newline at end of file diff --git a/src/modules/world-generation/include/PlanetaryCore.h b/src/modules/world-generation/include/PlanetaryCore.h new file mode 100644 index 0000000..f071162 --- /dev/null +++ b/src/modules/world-generation/include/PlanetaryCore.h @@ -0,0 +1,259 @@ +#pragma once + +#include + +using json = nlohmann::json; + +namespace warfactory { + +/** + * @brief Planetary core system for mass conservation + * + * Manages planetary mass conservation by accumulating eroded material + * and releasing it through volcanic activity when core reaches saturation. + */ +struct PlanetaryCore { + // ======================================== + // MASS TRACKING + // ======================================== + float core_mass; // Accumulated eroded material (kg) + float surface_mass; // Current surface terrain mass (kg) + float total_planetary_mass; // Constant after Phase 1 (kg) + + // ======================================== + // VOLCANIC SYSTEM + // ======================================== + float max_core_capacity; // Core saturation threshold (kg) + float volcanic_overflow_rate; // Rate of material expulsion (0.1-0.3) + float pending_volcanic_material; // Material queued for volcanic release (kg) + int pending_volcanic_events; // Number of queued eruptions + + // ======================================== + // CONFIGURATION PARAMETERS + // ======================================== + float volcanic_event_mass_threshold; // Minimum mass per volcanic event (kg) + float volcanic_density_factor; // Material density for eruption radius calculation + float core_pressure_buildup_rate; // Rate of pressure increase + + // ======================================== + // DERIVED VALUES + // ======================================== + + /** + * @brief Get core pressure ratio (0.0-1.0+) + * @return core_mass / max_core_capacity + */ + float getCorePressureRatio() const { + return core_mass / max_core_capacity; + } + + /** + * @brief Check if core is approaching saturation + * @return true if pressure ratio > 0.8 + */ + bool isNearSaturation() const { + return getCorePressureRatio() > 0.8f; + } + + /** + * @brief Check if core overflow is occurring + * @return true if core_mass > max_core_capacity + */ + bool isOverflowing() const { + return core_mass > max_core_capacity; + } + + /** + * @brief Get overflow amount + * @return Amount of mass above capacity (0 if no overflow) + */ + float getOverflowAmount() const { + return std::max(0.0f, core_mass - max_core_capacity); + } + + /** + * @brief Validate mass conservation + * @return true if total mass is conserved + */ + bool validateMassConservation() const { + float total_current = core_mass + surface_mass + pending_volcanic_material; + float tolerance = total_planetary_mass * 0.001f; // 0.1% tolerance + return std::abs(total_current - total_planetary_mass) < tolerance; + } + + // ======================================== + // CONSTRUCTION AND INITIALIZATION + // ======================================== + + /** + * @brief Default constructor + */ + PlanetaryCore() : + core_mass(0.0f), + surface_mass(0.0f), + total_planetary_mass(0.0f), + max_core_capacity(0.0f), + volcanic_overflow_rate(0.2f), + pending_volcanic_material(0.0f), + pending_volcanic_events(0), + volcanic_event_mass_threshold(1000000.0f), // 1M kg per event + volcanic_density_factor(100000.0f), // 100k kg/m² + core_pressure_buildup_rate(0.1f) + {} + + /** + * @brief Initialize core for world generation + * @param initial_surface_mass Starting surface mass + * @param capacity_ratio Core capacity as ratio of total mass (0.3-0.7) + */ + void initialize(float initial_surface_mass, float capacity_ratio = 0.5f) { + surface_mass = initial_surface_mass; + total_planetary_mass = initial_surface_mass; + core_mass = 0.0f; + max_core_capacity = total_planetary_mass * capacity_ratio; + pending_volcanic_material = 0.0f; + pending_volcanic_events = 0; + } + + // ======================================== + // MASS TRANSFER OPERATIONS + // ======================================== + + /** + * @brief Transfer eroded material to core + * @param erosion_amount Amount of material eroded (kg) + */ + void addErodedMaterial(float erosion_amount) { + core_mass += erosion_amount; + surface_mass -= erosion_amount; + } + + /** + * @brief Add meteorite material to system (Phase 1 only) + * @param meteorite_mass Mass of meteorite impact (kg) + */ + void addMeteoriteMaterial(float meteorite_mass) { + surface_mass += meteorite_mass; + total_planetary_mass += meteorite_mass; + + // Update core capacity proportionally + max_core_capacity = total_planetary_mass * (max_core_capacity / (total_planetary_mass - meteorite_mass)); + } + + /** + * @brief Release volcanic material to surface + * @param volcanic_amount Amount of material to release (kg) + */ + void releaseVolcanicMaterial(float volcanic_amount) { + if (volcanic_amount <= pending_volcanic_material) { + pending_volcanic_material -= volcanic_amount; + surface_mass += volcanic_amount; + } + } + + // ======================================== + // VOLCANIC OVERFLOW PROCESSING + // ======================================== + + /** + * @brief Process core overflow and generate volcanic events + */ + void processOverflow() { + if (!isOverflowing()) return; + + float overflow = getOverflowAmount(); + float volcanic_expulsion = overflow * volcanic_overflow_rate; + + // Transfer mass from core to pending volcanic events + core_mass -= volcanic_expulsion; + pending_volcanic_material += volcanic_expulsion; + + // Queue volcanic events proportional to overflow + int new_events = static_cast(volcanic_expulsion / volcanic_event_mass_threshold); + pending_volcanic_events += new_events; + } + + /** + * @brief Get material amount for next volcanic event + * @return Material amount per event (kg) + */ + float getNextVolcanicEventMaterial() const { + if (pending_volcanic_events <= 0) return 0.0f; + return pending_volcanic_material / pending_volcanic_events; + } + + /** + * @brief Consume one volcanic event + * @return Material amount released (kg) + */ + float consumeVolcanicEvent() { + if (pending_volcanic_events <= 0) return 0.0f; + + float event_material = getNextVolcanicEventMaterial(); + pending_volcanic_events--; + + return event_material; + } + + // ======================================== + // STATISTICS AND MONITORING + // ======================================== + + /** + * @brief Get core statistics + * @return JSON with detailed core information + */ + json getStatistics() const { + return json{ + {"core_mass", core_mass}, + {"surface_mass", surface_mass}, + {"total_planetary_mass", total_planetary_mass}, + {"max_core_capacity", max_core_capacity}, + {"pending_volcanic_material", pending_volcanic_material}, + {"pending_volcanic_events", pending_volcanic_events}, + {"core_pressure_ratio", getCorePressureRatio()}, + {"is_near_saturation", isNearSaturation()}, + {"is_overflowing", isOverflowing()}, + {"overflow_amount", getOverflowAmount()}, + {"mass_conservation_valid", validateMassConservation()} + }; + } + + /** + * @brief Export core state to JSON + * @return JSON representation + */ + json toJson() const { + return json{ + {"core_mass", core_mass}, + {"surface_mass", surface_mass}, + {"total_planetary_mass", total_planetary_mass}, + {"max_core_capacity", max_core_capacity}, + {"volcanic_overflow_rate", volcanic_overflow_rate}, + {"pending_volcanic_material", pending_volcanic_material}, + {"pending_volcanic_events", pending_volcanic_events}, + {"volcanic_event_mass_threshold", volcanic_event_mass_threshold}, + {"volcanic_density_factor", volcanic_density_factor}, + {"core_pressure_buildup_rate", core_pressure_buildup_rate} + }; + } + + /** + * @brief Import core state from JSON + * @param data JSON data to import + */ + void fromJson(const json& data) { + core_mass = data.value("core_mass", 0.0f); + surface_mass = data.value("surface_mass", 0.0f); + total_planetary_mass = data.value("total_planetary_mass", 0.0f); + max_core_capacity = data.value("max_core_capacity", 0.0f); + volcanic_overflow_rate = data.value("volcanic_overflow_rate", 0.2f); + pending_volcanic_material = data.value("pending_volcanic_material", 0.0f); + pending_volcanic_events = data.value("pending_volcanic_events", 0); + volcanic_event_mass_threshold = data.value("volcanic_event_mass_threshold", 1000000.0f); + volcanic_density_factor = data.value("volcanic_density_factor", 100000.0f); + core_pressure_buildup_rate = data.value("core_pressure_buildup_rate", 0.1f); + } +}; + +} // namespace warfactory \ No newline at end of file diff --git a/src/modules/world-generation/include/WorldFeature.h b/src/modules/world-generation/include/WorldFeature.h new file mode 100644 index 0000000..ad29573 --- /dev/null +++ b/src/modules/world-generation/include/WorldFeature.h @@ -0,0 +1,354 @@ +#pragma once + +#include "IModule.h" +#include "GMap.h" +#include +#include +#include +#include +#include + +using json = nlohmann::json; + +namespace warfactory { + +/** + * @brief Feature categories based on WORLDGEN_ANALYSIS.md comprehensive analysis + */ +enum class FeatureCategory { + // Natural geological formations + GEOLOGICAL_FORMATIONS, // Caves, thermal springs, salt deposits, meteorites, geysers + GEOLOGICAL_RESOURCES, // Basic minerals (iron, copper, coal) and precious (gold, uranium, iridium) + + // Water-related features + AQUATIC_NATURAL, // Lakes, ponds, river deltas, fjords, waterfalls, springs + AQUATIC_SPECIAL, // Marshlands, dried lakes, geysers, mountain oases + + // Land formations + TERRESTRIAL_LANDFORMS, // Canyons, plateaus, valleys, plains, dunes, glaciers + TERRESTRIAL_SPECIAL, // Oases, mountain passes, craters, calderas, badlands + + // Coastal and maritime + COASTAL_NATURAL, // Protected bays, cliffs, beaches, coral reefs, estuaries + COASTAL_FORMATIONS, // Peninsulas, straits, coastal islands, rifts + + // Historical industrial sites + INDUSTRIAL_ABANDONED, // Terikons, ghost towns, textile mills, power plants, steelworks + INDUSTRIAL_CHEMICAL, // Refineries, chemical complexes, distilleries, glass works + + // Vehicle graveyards and scrap sites + VEHICLE_GRAVEYARDS, // Tank, car, plane, train, boat cemeteries, electronic dumps + SCRAP_SITES, // Open-air dumps, service stations, electronic waste + + // Abandoned military installations + MILITARY_COLD_WAR, // Cold War bases, missile sites, naval bases, airfields + MILITARY_HISTORICAL, // WWI sites, Nazi bunkers, inactive minefields, munition depots + + // Cultural and archaeological + CULTURAL_ANCIENT, // Ancient ruins, medieval vestiges, archaeological sites + CULTURAL_HISTORICAL, // Historical monuments, cultural landmarks + + // Natural ecosystems and biomes + BIOMES_FOREST, // Dense forests, boreal forests, tropical rainforests + BIOMES_GRASSLAND, // Steppes, pampas, prairies, savannas + BIOMES_EXTREME, // Deserts, arctic tundra, volcanic areas, wetlands + + // Geological anomalies and special formations + GEOLOGICAL_ANOMALIES, // Magnetic anomalies, monoliths, radio silence zones + GEOLOGICAL_EXTREME, // Active fault lines, karst formations, amber deposits + + // Climate and weather phenomena + CLIMATE_PHENOMENA, // Cloud forests, chaparral, permafrost zones + WEATHER_PATTERNS, // Microclimate zones, wind corridors + + // Modern infrastructure (abandoned or ruins) + INFRASTRUCTURE_TRANSPORT, // Abandoned roads, rail lines, bridges, tunnels + INFRASTRUCTURE_UTILITY, // Power lines, communication towers, pipelines + + // Mysterious and unexplained phenomena + MYSTERIOUS_PHENOMENA, // Unexplained formations, anomalous zones, strange sites + + CATEGORY_COUNT = 18 +}; + +/** + * @brief Resource integration types within features + */ +enum class ResourceIntegrationType { + STANDALONE_DEPOSIT, // Pure resource patch (iron ore, copper vein) + FEATURE_INTEGRATED, // Resource within feature (meteorite metals, scrap in ruins) + FEATURE_BYPRODUCT, // Secondary resource from feature (amber inclusions) + FEATURE_HIDDEN, // Concealed resource requiring exploration + FEATURE_PROCESSING // Resource requiring processing/refinement +}; + +/** + * @brief World feature with integrated resources and budget scoring + */ +struct WorldFeature { + uint32_t feature_id; // Unique feature identifier + std::string feature_type; // Specific feature type name + FeatureCategory category; // Primary feature category + + // Location and extent + int center_x, center_y; // Feature center coordinates + std::vector> affected_tiles; // All tiles covered by feature + + // Budget system integration + float base_budget_score; // Base score for this feature type + float adjusted_budget_score; // Score adjusted for regional influences + float calculated_budget_contribution; // Actual contribution to tile budget + + // Resource integration + std::vector> integrated_resources; + std::unordered_map resource_quantities; // Resource ID -> quantity + + // Feature properties and metadata + json feature_properties; // Feature-specific data + json discovery_requirements; // Requirements to discover/access + + // Regional and probability data + RegionalInfluence required_influence; // Regional influence that enables this feature + float base_probability; // Base generation probability + float regional_probability_modifier; // Regional modifier (e.g., 8× for terikons in mining zones) + + // Gameplay mechanics + bool requires_exploration; // True if hidden resources/properties exist + bool modifies_terrain; // True if feature changes terrain traversability + bool provides_strategic_value; // True if feature has military/strategic importance + + /** + * @brief Convert feature to JSON representation + */ + json toJson() const; + + /** + * @brief Create feature from JSON data + */ + static WorldFeature fromJson(const json& data); + + /** + * @brief Calculate total budget contribution including all resources + */ + float calculateTotalBudgetContribution() const; + + /** + * @brief Get resource quantity for specific type + */ + uint64_t getResourceQuantity(uint16_t resource_type_id) const; + + /** + * @brief Check if feature provides specific resource + */ + bool providesResource(uint16_t resource_type_id) const; +}; + +/** + * @brief World feature placement and budget balancing module + * + * Implements the revolutionary budget-based feature generation system from analysis: + * - Places 218+ feature types across 18 categories + * - Integrates resources directly into features (meteorite metals, scrap in ruins) + * - Implements -10 to +10 budget scoring with automatic risk/reward balancing + * - Applies regional influences (8× terikon probability in mining zones) + * - Manages discovery system with visible/hidden feature properties + * + * Configuration loaded from gameData/: + * - MapFeatures/ - Feature type definitions and properties + * - Ressources/ - Resource type definitions and integration patterns + * - WorldGeneration/ - Budget scoring rules and regional influences + * - Biomes/ - Biome-feature compatibility matrices + */ +class WorldFeatureModule : public IModule { +private: + // Feature management + std::vector placed_features; + std::unordered_map feature_id_to_index; + uint32_t next_feature_id; + + // World reference and generation state + GMap* world_map; // Mutable reference for budget modifications + uint64_t feature_seed; + bool features_generated; + bool budget_balanced; + + // Configuration data + std::unordered_map feature_type_definitions; + std::unordered_map resource_type_definitions; + std::unordered_map> features_by_category; + + // Budget system data + std::unordered_map target_budget_distribution; // Target % per score + std::unordered_map actual_budget_distribution; // Actual tile count per score + + /** + * @brief Load all feature and resource definitions from configuration + */ + void loadFeatureDefinitions(const IDataNode& config); + + /** + * @brief Load resource integration patterns + */ + void loadResourceIntegrationPatterns(const IDataNode& config); + + /** + * @brief Calculate feature placement probability for location + */ + float calculateFeaturePlacementProbability(const std::string& feature_type, int x, int y) const; + + /** + * @brief Place features by category with budget balancing + */ + void placeFeatureCategory(FeatureCategory category); + + /** + * @brief Attempt to place single feature at location + */ + bool attemptFeaturePlacement(const std::string& feature_type, int x, int y); + + /** + * @brief Calculate budget impact of placing feature at location + */ + float calculateBudgetImpact(const std::string& feature_type, int x, int y) const; + + /** + * @brief Balance tile budgets by adding/removing features + */ + void balanceRegionBudgets(); + + /** + * @brief Check biome-feature compatibility + */ + bool isFeatureCompatibleWithBiome(const std::string& feature_type, BiomeType biome) const; + + /** + * @brief Generate integrated resources for feature + */ + void generateIntegratedResources(WorldFeature& feature); + + /** + * @brief Apply regional probability modifiers + */ + float applyRegionalModifiers(const std::string& feature_type, int x, int y, float base_probability) const; + +public: + /** + * @brief Constructor + */ + WorldFeatureModule(); + + /** + * @brief Destructor + */ + virtual ~WorldFeatureModule() = default; + + // IModule interface implementation + void setConfiguration(const IDataNode& configNode, IIO* io, ITaskScheduler* scheduler) override; + const IDataNode& getConfiguration() override; + json process(const json& input) override; + void shutdown() override; + json getState() override; + void setState(const json& state) override; + json getHealthStatus() override; + std::string getType() const override; + + /** + * @brief Set reference to world map for feature placement + * @param map Mutable reference to generated world map + */ + void setWorldMap(GMap* map); + + /** + * @brief Generate and place all features with budget balancing + * @return JSON status with budget distribution and feature statistics + */ + json generateFeaturesWithBudgetBalancing(); + + /** + * @brief Place features for specific category + * @param category Feature category to place + * @return JSON status of placement for category + */ + json placeFeaturesForCategory(FeatureCategory category); + + /** + * @brief Get features in region with resource information + * @param startX Starting X coordinate + * @param startY Starting Y coordinate + * @param width Region width + * @param height Region height + * @param include_hidden Include features requiring exploration + * @return JSON array of features with resources + */ + json getFeaturesInRegion(int startX, int startY, int width, int height, bool include_hidden = false) const; + + /** + * @brief Get features at specific coordinates + * @param x World X coordinate + * @param y World Y coordinate + * @param include_hidden Include hidden feature properties + * @return JSON array of features at location + */ + json getFeaturesAt(int x, int y, bool include_hidden = false) const; + + /** + * @brief Get features by category with resource breakdown + * @param category Feature category to filter by + * @return JSON array of features with integrated resource data + */ + json getFeaturesByCategory(FeatureCategory category) const; + + /** + * @brief Get current budget score distribution + * @return JSON with target vs actual budget distribution + */ + json getBudgetScoreDistribution() const; + + /** + * @brief Check if budget is balanced according to target distribution + * @return true if budget distribution matches targets within tolerance + */ + bool isBudgetBalanced() const; + + /** + * @brief Force budget rebalancing for specific region + * @param startX Starting X coordinate + * @param startY Starting Y coordinate + * @param width Region width + * @param height Region height + * @return JSON status of rebalancing operation + */ + json rebalanceRegionBudget(int startX, int startY, int width, int height); + + /** + * @brief Get available feature types by category + * @return JSON mapping of categories to available feature types + */ + json getAvailableFeatureTypes() const; + + /** + * @brief Get comprehensive feature and resource statistics + * @return JSON with feature counts, resource distribution, budget analysis + */ + json getComprehensiveStats() const; + + /** + * @brief Set feature generation seed for deterministic results + * @param seed New seed value + */ + void setFeatureSeed(uint64_t seed); + + /** + * @brief Get current feature generation seed + * @return Current seed value + */ + uint64_t getFeatureSeed() const; + + /** + * @brief Check if features have been generated and budget balanced + * @return true if complete generation finished successfully + */ + bool isGenerationComplete() const; +}; + +} // namespace warfactory \ No newline at end of file diff --git a/src/modules/world-generation/include/WorldGeneration.h b/src/modules/world-generation/include/WorldGeneration.h new file mode 100644 index 0000000..0112981 --- /dev/null +++ b/src/modules/world-generation/include/WorldGeneration.h @@ -0,0 +1,143 @@ +#pragma once + +#include "IModule.h" +#include "GMap.h" +#include +#include +#include + +using json = nlohmann::json; + +namespace warfactory { + +/** + * @brief World generation module for creating the global world map + * + * This module generates the complete world map using procedural algorithms. + * It handles terrain generation, biome placement, elevation calculation, + * and geographical feature placement. + * + * Configuration is loaded from gameData/: + * - WorldGeneration/ - Generation algorithms and parameters + * - Biomes/ - Biome definitions and properties + * - Terrain/ - Terrain type definitions + * - MapFeatures/ - Geographical features + */ +class WorldGenerationModule : public IModule { +private: + std::unique_ptr worldMap; + uint64_t generationSeed; + bool isWorldGenerated; + + /** + * @brief Load generation parameters from configuration + */ + void loadGenerationConfig(const IDataNode& config); + + /** + * @brief Generate terrain using procedural algorithms + */ + void generateTerrain(); + + /** + * @brief Apply biomes based on temperature and humidity + */ + void generateBiomes(); + + /** + * @brief Calculate elevation using noise functions + */ + void generateElevation(); + + /** + * @brief Place geographical features (rivers, mountains, etc.) + */ + void generateFeatures(); + +public: + /** + * @brief Constructor + */ + WorldGenerationModule(); + + /** + * @brief Destructor + */ + virtual ~WorldGenerationModule() = default; + + // IModule interface implementation + void setConfiguration(const IDataNode& configNode, IIO* io, ITaskScheduler* scheduler) override; + const IDataNode& getConfiguration() override; + json process(const json& input) override; + void shutdown() override; + json getState() override; + void setState(const json& state) override; + json getHealthStatus() override; + std::string getType() const override; + + /** + * @brief Generate the complete world map + * @return JSON status of generation + */ + json generateWorldMap(); + + /** + * @brief Get terrain type at world coordinates + * @param x World X coordinate + * @param y World Y coordinate + * @return Terrain type string + */ + std::string getTerrainAt(int x, int y) const; + + /** + * @brief Get biome type at world coordinates + * @param x World X coordinate + * @param y World Y coordinate + * @return Biome type string + */ + std::string getBiomeAt(int x, int y) const; + + /** + * @brief Get elevation at world coordinates + * @param x World X coordinate + * @param y World Y coordinate + * @return Elevation value + */ + float getElevationAt(int x, int y) const; + + /** + * @brief Get world map dimensions + * @return JSON with width and height + */ + json getWorldDimensions() const; + + /** + * @brief Export region of the world map + * @param startX Starting X coordinate + * @param startY Starting Y coordinate + * @param width Region width + * @param height Region height + * @return JSON representation of the region + */ + json exportRegion(int startX, int startY, int width, int height) const; + + /** + * @brief Set generation seed for deterministic results + * @param seed New seed value + */ + void setSeed(uint64_t seed); + + /** + * @brief Get current generation seed + * @return Current seed value + */ + uint64_t getSeed() const; + + /** + * @brief Check if world has been generated + * @return true if world is generated, false otherwise + */ + bool isGenerated() const; +}; + +} // namespace warfactory \ No newline at end of file diff --git a/src/modules/world-generation/include/WorldGenerationModule.h b/src/modules/world-generation/include/WorldGenerationModule.h new file mode 100644 index 0000000..281a590 --- /dev/null +++ b/src/modules/world-generation/include/WorldGenerationModule.h @@ -0,0 +1,385 @@ +#pragma once + +#include "IGenerationLayer.h" +#include "GMap.h" +#include +#include +#include +#include + +using json = nlohmann::json; + +namespace warfactory { + +// Forward declarations +struct PlanetaryCore; + +/** + * @brief World generation orchestrator with step-by-step execution + * + * Manages multiple generation layers and provides cycle-by-cycle execution + * with progress tracking, debugging, and configuration management. + */ +class WorldGenerationModule { +private: + // ======================================== + // GENERATION STATE + // ======================================== + std::unique_ptr world_map; + std::unique_ptr planetary_core; + + // Layer management + std::vector> layers; + int current_layer_index = 0; + + // Configuration + json global_config; + uint64_t world_seed = 0; + + // Execution state + bool generation_active = false; + bool generation_complete = false; + bool generation_paused = false; + + // Performance tracking + std::chrono::steady_clock::time_point start_time; + std::chrono::steady_clock::time_point last_step_time; + float total_execution_time = 0.0f; + int total_steps_executed = 0; + +public: + /** + * @brief Constructor + * @param width World map width + * @param height World map height + * @param seed World generation seed + */ + WorldGenerationModule(int width, int height, uint64_t seed = 0); + + /** + * @brief Destructor + */ + ~WorldGenerationModule(); + + // ======================================== + // LAYER MANAGEMENT + // ======================================== + + /** + * @brief Add generation layer to pipeline + * @param layer Layer to add (ownership transferred) + */ + void addLayer(std::unique_ptr layer); + + /** + * @brief Remove all layers + */ + void clearLayers(); + + /** + * @brief Get number of registered layers + * @return Layer count + */ + size_t getLayerCount() const { return layers.size(); } + + /** + * @brief Get current active layer + * @return Current layer pointer or nullptr + */ + IGenerationLayer* getCurrentLayer() const; + + /** + * @brief Get layer by index + * @param index Layer index + * @return Layer pointer or nullptr if invalid index + */ + IGenerationLayer* getLayer(size_t index) const; + + // ======================================== + // STEP-BY-STEP EXECUTION + // ======================================== + + /** + * @brief Execute next generation step + * @return true if more steps available + */ + bool executeNextStep(); + + /** + * @brief Execute multiple steps + * @param step_count Number of steps to execute + * @return Number of steps actually executed + */ + int executeSteps(int step_count); + + /** + * @brief Execute current layer completely + * @return true if layer completed successfully + */ + bool executeCurrentLayer(); + + /** + * @brief Execute all remaining layers + * @return true if generation completed successfully + */ + bool executeAll(); + + // ======================================== + // EXECUTION CONTROL + // ======================================== + + /** + * @brief Start generation from beginning + */ + void startGeneration(); + + /** + * @brief Pause generation + */ + void pauseGeneration(); + + /** + * @brief Resume generation + */ + void resumeGeneration(); + + /** + * @brief Stop and reset generation + */ + void stopGeneration(); + + /** + * @brief Reset to initial state + */ + void reset(); + + // ======================================== + // PROGRESS TRACKING + // ======================================== + + /** + * @brief Get overall generation progress + * @return Progress percentage (0.0-1.0) + */ + float getOverallProgress() const; + + /** + * @brief Get current layer progress + * @return Progress percentage (0.0-1.0) + */ + float getCurrentLayerProgress() const; + + /** + * @brief Get current step description + * @return Human-readable step description + */ + std::string getCurrentStepDescription() const; + + /** + * @brief Get estimated remaining time + * @return Estimated seconds remaining + */ + float getEstimatedRemainingTime() const; + + /** + * @brief Get total estimated duration + * @return Estimated total seconds + */ + float getTotalEstimatedDuration() const; + + // ======================================== + // STATE QUERIES + // ======================================== + + bool isGenerationActive() const { return generation_active; } + bool isGenerationComplete() const { return generation_complete; } + bool isGenerationPaused() const { return generation_paused; } + bool hasMoreSteps() const; + + int getCurrentLayerIndex() const { return current_layer_index; } + int getTotalStepsExecuted() const { return total_steps_executed; } + float getTotalExecutionTime() const { return total_execution_time; } + + // ======================================== + // CONFIGURATION + // ======================================== + + /** + * @brief Set global configuration + * @param config JSON configuration + */ + void setConfiguration(const json& config); + + /** + * @brief Get current configuration + * @return Current JSON configuration + */ + const json& getConfiguration() const { return global_config; } + + /** + * @brief Set world generation seed + * @param seed New seed value + */ + void setWorldSeed(uint64_t seed); + + /** + * @brief Get world generation seed + * @return Current seed + */ + uint64_t getWorldSeed() const { return world_seed; } + + /** + * @brief Validate all layer configurations + * @return true if all configurations valid + */ + bool validateConfigurations() const; + + // ======================================== + // WORLD ACCESS + // ======================================== + + /** + * @brief Get generated world map + * @return World map reference + */ + const GMap& getWorldMap() const; + + /** + * @brief Get mutable world map (for testing/debugging) + * @return Mutable world map reference + */ + GMap& getWorldMapMutable(); + + /** + * @brief Get planetary core state + * @return Planetary core reference + */ + const PlanetaryCore& getPlanetaryCore() const; + + // ======================================== + // DEBUGGING AND MONITORING + // ======================================== + + /** + * @brief Get detailed generation status + * @return JSON with complete status information + */ + json getDetailedStatus() const; + + /** + * @brief Get performance metrics + * @return JSON with performance data + */ + json getPerformanceMetrics() const; + + /** + * @brief Enable verbose logging for all layers + * @param enabled Whether to enable verbose output + */ + void setVerboseLogging(bool enabled); + + /** + * @brief Export current state for debugging + * @return JSON with complete world state + */ + json exportDebugState() const; + + /** + * @brief Import state for debugging/testing + * @param state Debug state to import + */ + void importDebugState(const json& state); + + // ======================================== + // CONVENIENCE METHODS + // ======================================== + + /** + * @brief Generate world with standard layers + * @param config Optional configuration override + * @return true if generation successful + */ + bool generateStandardWorld(const json& config = json{}); + + /** + * @brief Generate world step-by-step with callback + * @param callback Function called after each step + * @return true if generation successful + */ + bool generateWithCallback(std::function callback); + +private: + // ======================================== + // INTERNAL HELPERS + // ======================================== + + /** + * @brief Initialize planetary core + */ + void initializePlanetaryCore(); + + /** + * @brief Setup standard generation layers + */ + void setupStandardLayers(); + + /** + * @brief Update execution timing + */ + void updateTiming(); + + /** + * @brief Advance to next layer + * @return true if more layers available + */ + bool advanceToNextLayer(); + + /** + * @brief Calculate overall progress across all layers + * @return Combined progress (0.0-1.0) + */ + float calculateOverallProgress() const; +}; + +/** + * @brief Factory for creating standard layer configurations + */ +namespace StandardLayers { + /** + * @brief Create geological generation layer + * @return Geological layer with default configuration + */ + std::unique_ptr createGeologicalLayer(); + + /** + * @brief Create climate simulation layer + * @return Climate layer with default configuration + */ + std::unique_ptr createClimateLayer(); + + /** + * @brief Create biome classification layer + * @return Biome layer with default configuration + */ + std::unique_ptr createBiomeLayer(); + + /** + * @brief Create budget assignment layer + * @return Budget layer with default configuration + */ + std::unique_ptr createBudgetLayer(); + + /** + * @brief Create resource generation layer + * @return Resource layer with default configuration + */ + std::unique_ptr createResourceLayer(); + + /** + * @brief Create complete standard pipeline + * @return Vector of all standard layers + */ + std::vector> createStandardPipeline(); +} + +} // namespace warfactory \ No newline at end of file diff --git a/src/modules/world-generation/include/WorldTile.h b/src/modules/world-generation/include/WorldTile.h new file mode 100644 index 0000000..6d5fee2 --- /dev/null +++ b/src/modules/world-generation/include/WorldTile.h @@ -0,0 +1,375 @@ +#pragma once + +#include +#include +#include +#include +#include + +using json = nlohmann::json; + +namespace warfactory { + +// Forward declarations +struct ResourcePatch; +struct WorldFeature; +enum class RegionalInfluence; +enum class BiomeType; +enum class ExplorationLevel; +class GMap; + +/** + * @brief Optimized tile data structure - 24 bytes per tile + * + * Compact structure with terrain data and feature set references. + * Geological simulation ready with extended ranges for planetary formation. + * Features accessed via feature_set_id in global map for memory efficiency. + */ +struct WorldTileData { + // ======================================== + // TERRAIN DATA (11 bytes) - Always accessed, geological simulation ready + // ======================================== + uint16_t terrain_type_id; // Terrain type (65k possible types) + uint16_t biome_type_id; // Biome classification + uint16_t elevation; // Elevation: 0-65535 = -11km to +32km (geological range) + int16_t temperature; // Temperature: -32768 to +32767 = -3276°C to +3276°C (0.1°C increments) + uint8_t humidity; // Humidity: 0-255 = 0-100% (0.4% increments) + uint8_t wind_data; // Wind: 4 bits direction (0-15) + 4 bits intensity (0-15) + uint8_t water_level; // Accumulated water level (0-255, for river formation) + + // ======================================== + // METADATA (21 bytes) - Generation and gameplay + // ======================================== + int8_t target_budget_score; // Target budget score: -10 to +10 + uint32_t regional_influence_id; // → RegionalInfluenceData in global map + uint8_t influence_strength; // Regional influence strength: 0-255 + uint32_t tile_flags; // Tile properties: PASSABLE, EXPLORED, etc. + uint32_t feature_set_id; // → FeatureSet in global map (0 = no features) + uint8_t padding2[7]; // Align structure to 32 bytes (11 + 14 + 7 = 32) + + /** + * @brief Constructor with default values + */ + WorldTileData(); + + /** + * @brief Convert tile data to JSON + */ + json toJson() const; + + /** + * @brief Load tile data from JSON + */ + void fromJson(const json& data); + + // ======================================== + // TERRAIN VALUE CONVERSION HELPERS + // ======================================== + + /** + * @brief Convert elevation to meters (geological range: -11km to +32km) + */ + float getElevationMeters() const { return (elevation - 11000.0f) / 1.524f; } + + /** + * @brief Set elevation from meters + */ + void setElevationMeters(float meters) { + elevation = static_cast(std::clamp((meters + 11000.0f) * 1.524f, 0.0f, 65535.0f)); + } + + /** + * @brief Convert temperature to Celsius (0.1°C precision, range: -3276°C to +3276°C) + */ + float getTemperatureCelsius() const { return temperature * 0.1f; } + + /** + * @brief Set temperature from Celsius + */ + void setTemperatureCelsius(float celsius) { + temperature = static_cast(std::clamp(celsius * 10.0f, -32768.0f, 32767.0f)); + } + + /** + * @brief Convert humidity to percentage (0.0-1.0) + */ + float getHumidityPercent() const { return humidity / 255.0f; } + + /** + * @brief Set humidity from percentage (0.0-1.0) + */ + void setHumidityPercent(float percent) { humidity = static_cast(std::clamp(percent * 255.0f, 0.0f, 255.0f)); } + + /** + * @brief Get wind direction (0-15, where 0=North, 4=East, 8=South, 12=West) + */ + uint8_t getWindDirection() const { return (wind_data >> 4) & 0x0F; } + + /** + * @brief Set wind direction (0-15) + */ + void setWindDirection(uint8_t direction) { + wind_data = (wind_data & 0x0F) | ((direction & 0x0F) << 4); + } + + /** + * @brief Get wind intensity (0-15, where 0=calm, 15=hurricane) + */ + uint8_t getWindIntensity() const { return wind_data & 0x0F; } + + /** + * @brief Set wind intensity (0-15) + */ + void setWindIntensity(uint8_t intensity) { + wind_data = (wind_data & 0xF0) | (intensity & 0x0F); + } + + /** + * @brief Get wind vector in X,Y components (normalized -1.0 to 1.0) + */ + std::pair getWindVector() const { + uint8_t direction = getWindDirection(); + float intensity = getWindIntensity() / 15.0f; + float angle = direction * (2.0f * 3.14159f / 16.0f); // 16 directions + return {intensity * sin(angle), intensity * cos(angle)}; // X=East, Y=North + } + + /** + * @brief Set wind from vector components + */ + void setWindVector(float wind_x, float wind_y) { + float intensity = sqrt(wind_x * wind_x + wind_y * wind_y); + float angle = atan2(wind_x, wind_y); // X=East, Y=North + if (angle < 0) angle += 2.0f * 3.14159f; + + uint8_t direction = static_cast((angle * 16.0f) / (2.0f * 3.14159f)) % 16; + uint8_t intensity_value = static_cast(std::clamp(intensity * 15.0f, 0.0f, 15.0f)); + + setWindDirection(direction); + setWindIntensity(intensity_value); + } + + /** + * @brief Get accumulated water level (0-255, for hydrological simulation) + */ + uint8_t getWaterLevel() const { return water_level; } + + /** + * @brief Set accumulated water level (0-255) + */ + void setWaterLevel(uint8_t level) { water_level = level; } + + /** + * @brief Add water to current level (with overflow protection) + */ + void addWater(uint8_t amount) { + uint16_t new_level = static_cast(water_level) + amount; + water_level = static_cast(std::min(new_level, 255u)); + } + + /** + * @brief Remove water from current level (with underflow protection) + */ + void removeWater(uint8_t amount) { + if (water_level >= amount) { + water_level -= amount; + } else { + water_level = 0; + } + } + + /** + * @brief Get effective water surface elevation (elevation + water_level) + */ + float getWaterSurfaceElevation() const { + return getElevationMeters() + (water_level * 10.0f); // 10m per water level unit + } +}; + +/** + * @brief Lightweight tile wrapper with simple interface for world generation + * + * Provides easy access to tile data through GMap delegation. Acts as a smart wrapper + * around tile index with simple methods for terrain, features, and gameplay data. + */ +class WorldTile { +private: + uint32_t tile_index; // Linear index in GMap (y * width + x) + GMap* parent_map; // Reference to parent map for data access + +public: + /** + * @brief Constructor - creates lightweight wrapper + * @param index Linear tile index in parent map + * @param map Parent GMap reference + */ + WorldTile(uint32_t index, GMap* map); + + /** + * @brief Default constructor - invalid tile + */ + WorldTile(); + + /** + * @brief Check if tile is valid + */ + bool isValid() const { return parent_map != nullptr; } + + /** + * @brief Get tile coordinates + */ + std::pair getCoordinates() const; + + /** + * @brief Get tile index + */ + uint32_t getIndex() const { return tile_index; } + + // ======================================== + // BASIC TERRAIN ACCESS - Delegate to GMap + // ======================================== + + // Terrain type and biome + uint16_t getTerrainTypeId() const; + uint16_t getBiomeTypeId() const; + void setTerrainTypeId(uint16_t type_id); + void setBiomeTypeId(uint16_t biome_id); + + // Elevation (in meters, auto-converted from uint8_t) + float getElevation() const; + void setElevation(float elevation_meters); + + // Temperature (in Celsius, auto-converted from uint8_t) + float getTemperature() const; + void setTemperature(float temperature_celsius); + + // Humidity (0.0-1.0, auto-converted from uint8_t) + float getHumidity() const; + void setHumidity(float humidity_percent); + + // Wind data (direction 0-15, intensity 0-15) + uint8_t getWindDirection() const; + void setWindDirection(uint8_t direction); + uint8_t getWindIntensity() const; + void setWindIntensity(uint8_t intensity); + std::pair getWindVector() const; + void setWindVector(float wind_x, float wind_y); + + // Water level (0-255, for hydrological simulation) + uint8_t getWaterLevel() const; + void setWaterLevel(uint8_t level); + void addWater(uint8_t amount); + void removeWater(uint8_t amount); + float getWaterSurfaceElevation() const; + + // ======================================== + // REGIONAL INFLUENCE - Via global maps + // ======================================== + + uint32_t getRegionalInfluenceId() const; + void setRegionalInfluenceId(uint32_t influence_id); + uint8_t getInfluenceStrength() const; + void setInfluenceStrength(uint8_t strength); + float getFeatureProbabilityModifier(const std::string& feature_type) const; + + // ======================================== + // BUDGET SYSTEM - Simple scoring + // ======================================== + + int8_t getTargetBudgetScore() const; + void setTargetBudgetScore(int8_t target_score); + float calculateActualBudgetScore() const; + bool isBudgetBalanced(int8_t tolerance = 1) const; + + // ======================================== + // FEATURE MANAGEMENT - Via feature sets + // ======================================== + + uint32_t getFeatureSetId() const; + void setFeatureSetId(uint32_t feature_set_id); + std::vector getFeatureIds() const; + bool hasFeature(uint32_t feature_id) const; + size_t getFeatureCount() const; + + // Feature compatibility for generation + bool canAcceptFeatureType(const std::string& feature_type) const; + bool canAcceptFeatureSet(uint32_t feature_set_id) const; + + // ======================================== + // RESOURCE MANAGEMENT - Via features integration + // ======================================== + + // Resources are integrated into features (as per analysis) + uint64_t getTotalResourceQuantity(uint16_t resource_type_id) const; + bool providesResource(uint16_t resource_type_id) const; + std::vector getAvailableResourceTypes() const; + + // ======================================== + // TERRAIN COMPATIBILITY - Generation helpers + // ======================================== + + bool isTerrainCompatible(const std::string& feature_type) const; + bool isBiomeCompatible(const std::string& feature_type) const; + bool isElevationCompatible(const std::string& feature_type) const; + float getTraversability() const; + bool isPassable() const; + + // ======================================== + // TILE FLAGS - State management + // ======================================== + + void setFlag(uint32_t flag, bool value); + bool getFlag(uint32_t flag) const; + uint32_t getFlags() const; + + // ======================================== + // DISCOVERY SYSTEM - Layered visibility + // ======================================== + + json getVisibleProperties() const; + json getDiscoverableProperties(ExplorationLevel level) const; + json getHiddenProperties() const; + + // ======================================== + // SERIALIZATION & UTILITIES + // ======================================== + + json toJson() const; + void fromJson(const json& json_data); + json exportForNetwork() const; +}; + +/** + * @brief Tile flag constants + */ +namespace TileFlags { + const uint32_t PASSABLE = 1 << 0; // Tile allows movement + const uint32_t DESTRUCTIBLE = 1 << 1; // Features can be destroyed + const uint32_t EXPLORED = 1 << 2; // Tile has been explored + const uint32_t GEOLOGICALLY_SURVEYED = 1 << 3; // Geological exploration done + const uint32_t MAGNETOMETRICALLY_SURVEYED = 1 << 4; // Magnetic exploration done + const uint32_t CBRN_SURVEYED = 1 << 5; // CBRN exploration done + const uint32_t CONTAMINATED = 1 << 6; // Tile has contamination + const uint32_t STRATEGIC_VALUE = 1 << 7; // Tile has strategic importance + const uint32_t WATER_PRESENT = 1 << 8; // Tile has water features + const uint32_t RESOURCE_RICH = 1 << 9; // Tile has significant resources + const uint32_t FEATURE_RICH = 1 << 10; // Tile has multiple features + const uint32_t BUDGET_BALANCED = 1 << 11; // Budget score is balanced + const uint32_t REQUIRES_SPECIAL_EQUIPMENT = 1 << 12; // Special vehicles needed + const uint32_t HISTORICALLY_SIGNIFICANT = 1 << 13; // Cultural/historical value + const uint32_t ENVIRONMENTALLY_PROTECTED = 1 << 14; // Protected area + const uint32_t MILITARILY_CONTROLLED = 1 << 15; // Under military control +} + +/** + * @brief Exploration level requirements + */ +enum class ExplorationLevel { + VISUAL = 0, // Standard reconnaissance (visible features) + GEOLOGICAL = 1, // Geological vehicle required + MAGNETOMETRIC = 2, // Magnetometric vehicle required + CBRN = 3, // CBRN vehicle required + MAXIMUM = 4 // All exploration completed +}; + +} // namespace warfactory \ No newline at end of file diff --git a/src/modules/world-generation/src/main.cpp b/src/modules/world-generation/src/main.cpp new file mode 100644 index 0000000..5f64797 --- /dev/null +++ b/src/modules/world-generation/src/main.cpp @@ -0,0 +1,67 @@ +#include "WorldGeneration.h" +#include +#include + +using json = nlohmann::json; +using namespace warfactory; + +#ifdef TESTING +/** + * @brief Standalone test mode for world-feature module + */ +int main() { + std::cout << "WorldGeneration Module - Standalone Test Mode" << std::endl; + + try { + // Create module instance + WorldGenerationModule worldGeneration; + + // Test basic functionality + std::cout << "Module type: " << worldGeneration.getType() << std::endl; + + // Test world generation + json generationResult = worldGeneration.generateWorldMap(); + std::cout << "World generation result: " << generationResult.dump(2) << std::endl; + + // Test coordinate queries + if (worldGeneration.isGenerated()) { + std::string terrain = worldGeneration.getTerrainAt(100, 100); + std::string biome = worldGeneration.getBiomeAt(100, 100); + float elevation = worldGeneration.getElevationAt(100, 100); + + std::cout << "At (100,100): terrain=" << terrain + << ", biome=" << biome + << ", elevation=" << elevation << std::endl; + } + + // Test health status + json health = worldGeneration.getHealthStatus(); + std::cout << "Health status: " << health.dump(2) << std::endl; + + std::cout << "All tests completed successfully!" << std::endl; + + } catch (const std::exception& e) { + std::cerr << "Test failed with exception: " << e.what() << std::endl; + return 1; + } + + return 0; +} + +#else +/** + * @brief Hot-reload module entry point + * + * This function is called by the module loader for hot-reload. + * It should return a new instance of the module. + */ +extern "C" { + IModule* createModule() { + return new WorldGenerationModule(); + } + + void destroyModule(IModule* module) { + delete module; + } +} +#endif \ No newline at end of file