diff --git a/CLAUDE.md b/CLAUDE.md index 3e4c032..016294f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Project Overview -**Warfactory** is a Factorio-inspired industrial military simulation game combining factory management with strategic military doctrine. The project is currently in design/documentation phase with comprehensive technical specifications. +**Warfactory** is a Factorio-inspired industrial military simulation game combining factory management with strategic military doctrine. The project has evolved from design/documentation phase to **functional implementation** with a complete 10-engine architecture and comprehensive build system. **Core Philosophy:** - Factory assembly lines as gameplay foundation @@ -36,9 +36,10 @@ The project uses a modular documentation system in `/docs/`: ## Key Technical Concepts ### Engine Architecture -- **Autonomous Engines**: 6 specialized engines (Economy, War, Intelligence, Designer, MacroEntity, Map) +- **Autonomous Engines**: 10 specialized engines (Designer, Economy, Event, Factory, Intelligence, Logistic, MacroEntity, Map, Operation, War) - **Smart Client**: Request/response pattern, no streaming, FOW at chunk granularity - **Performance Target**: 60fps with 1000+ AI companies, 1-2 vehicle designs/tick globally +- **Implementation Status**: All engines have functional stub implementations with threading and main loops ### Map System - **Multi-scale**: World (diplomatic) → Regional (logistics) → Local (factory) → Detail (combat) @@ -60,8 +61,10 @@ Most initial "coherence problems" (P1-P30) were invalidated through clarificatio - Only P7 (engine responsibilities) requires further analysis ### Current Status -- **Phase**: Design documentation complete, technically viable -- **Next Steps**: Implementation planning, engine responsibility clarification +- **Phase**: **Implementation active** - All 10 engines functional with CMake build system +- **Build System**: Comprehensive CMake with defensive programming, sanitizers, and 16 C++ libraries +- **Development Ready**: Fast/full build presets, optimized workflow for daily iteration +- **Next Steps**: Engine logic expansion, inter-engine communication, gameplay features - **Questions Open**: 11 items in `questions-ouvertes.md` for future resolution ## Working with This Project @@ -81,4 +84,67 @@ Most initial "coherence problems" (P1-P30) were invalidated through clarificatio - Start with `vue-ensemble.md` for project vision - Reference `architecture-technique.md` for technical decisions - Check `coherence-problem.md` for resolved design challenges -- Use `questions-ouvertes.md` for known open issues \ No newline at end of file +- Use `questions-ouvertes.md` for known open issues + +## Build System and Development + +### Build Commands +```bash +# Fast development build (minimal sanitizers, ~30s) +cmake -DFAST_BUILD=ON .. && make claude-workflow-fast + +# Full validation build (all sanitizers + static analysis) +cmake -DCMAKE_BUILD_TYPE=Debug .. && make + +# Release build (optimized, stack protection) +cmake .. && make + +# Single engine development +make economy-engine && ./bin/economy-engine +``` + +### Project Structure +``` +├── engines/ # 10 autonomous engines +│ ├── Designer-Engine/ # Vehicle design with AI assistance +│ ├── Economy-Engine/ # Market simulation, pricing +│ ├── Event-Engine/ # Breakthrough system, global events +│ ├── Factory-Engine/ # Factorio-like production +│ ├── Intelligence-Engine/ # Metrics collection, reconnaissance +│ ├── Logistic-Engine/ # Supply chains, transport +│ ├── MacroEntity-Engine/ # Companies, diplomacy, administration +│ ├── Map-Engine/ # Procedural generation, chunks, FOW +│ ├── Operation-Engine/ # Military strategy, AI generals +│ └── War-Engine/ # Combat simulation, frontlines +├── cmake/ # Build system configuration +│ ├── WarfactoryDefenses.cmake # Defensive programming +│ ├── WarfactoryAutomation.cmake # 16 C++ libraries +│ └── WarfactoryAdvancedTools.cmake # Static analysis, testing +├── build/ # Build artifacts (git ignored) +│ └── bin/ # Final executables +└── docs/ # Complete design documentation +``` + +### Development Workflow +1. **Fast iteration**: Use `FAST_BUILD=ON` for daily development +2. **Single engine**: `make economy-engine` for focused work +3. **Full validation**: Debug build with all sanitizers before commit +4. **Engine-specific development**: Work directly in `engines/*/` directories +5. **Incremental builds**: CMake rebuilds only modified files (~2-5s) + +### Dependencies and Libraries +The project includes 16 C++ libraries via FetchContent: +- **Networking**: zeromq, cppzmq, redis-plus-plus, cpprestsdk +- **Logging**: spdlog, fmt +- **Memory**: Microsoft GSL, foonathan/memory +- **Testing**: Catch2, Google Test, Google Benchmark +- **Utilities**: nlohmann/json, fifo_map, junction+turf, pcg-cpp +- **Navigation**: recastnavigation, abseil-cpp +- **Graphics**: imgui, sqlite + +### Defensive Programming Features +- **Sanitizers**: AddressSanitizer, UndefinedBehaviorSanitizer, LeakSanitizer +- **Static Analysis**: Clang Static Analyzer, Cppcheck, PVS-Studio integration +- **Contract Programming**: GSL contracts, custom assertion macros +- **Compiler Hardening**: Stack protection, frame pointers, maximum debug info +- **Memory Safety**: Smart pointers, RAII patterns, leak detection \ No newline at end of file