- Remove old 10-engine system (engines/ directory deleted) - Implement C++ triple interface architecture: * IEngine: Execution coordination (Debug → Production) * IModuleSystem: Strategy pattern (Sequential → Threaded → Cluster) * IModule: Pure game logic interface (200-300 lines per module) * IIO: Communication transport (Intra → Local → Network) - Add autonomous module structure: * modules/factory/: Production logic with autonomous build * modules/economy/: Market simulation with autonomous build * modules/logistic/: Supply chain with autonomous build * Each module: CLAUDE.md + CMakeLists.txt + shared/ + build/ - Benefits for Claude Code development: * Ultra-focused contexts (200 lines vs 50K+ lines) * Autonomous builds (cmake . from module directory) * Hot-swappable infrastructure without logic changes * Parallel development across multiple Claude instances 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
84 lines
2.1 KiB
C++
84 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <memory>
|
|
#include <nlohmann/json.hpp>
|
|
#include "IModuleSystem.h"
|
|
#include "IIO.h"
|
|
|
|
using json = nlohmann::json;
|
|
|
|
namespace warfactory {
|
|
|
|
/**
|
|
* @brief Main engine interface - coordinates everything
|
|
*
|
|
* DebugEngine -> Sequential execution, full logging
|
|
* ProductionEngine -> Optimized execution, minimal overhead
|
|
* TestEngine -> Isolated execution for unit tests
|
|
*/
|
|
class IEngine {
|
|
public:
|
|
virtual ~IEngine() = default;
|
|
|
|
/**
|
|
* @brief Initialize engine with configuration
|
|
* @param configPath Path to engine configuration file
|
|
*/
|
|
virtual void initialize(const std::string& configPath) = 0;
|
|
|
|
/**
|
|
* @brief Set module execution system
|
|
* @param moduleSystem Strategy for running modules
|
|
*/
|
|
virtual void setModuleSystem(std::shared_ptr<IModuleSystem> moduleSystem) = 0;
|
|
|
|
/**
|
|
* @brief Set communication system
|
|
* @param io Communication transport
|
|
*/
|
|
virtual void setIO(std::shared_ptr<IIO> io) = 0;
|
|
|
|
/**
|
|
* @brief Load modules from configuration
|
|
* Will scan module directories and load .so files
|
|
*/
|
|
virtual void loadModules() = 0;
|
|
|
|
/**
|
|
* @brief Start main game loop
|
|
* Blocks until shutdown() called
|
|
*/
|
|
virtual void run() = 0;
|
|
|
|
/**
|
|
* @brief Process single frame/tick
|
|
* For step debugging and testing
|
|
*/
|
|
virtual void step() = 0;
|
|
|
|
/**
|
|
* @brief Stop engine and cleanup all resources
|
|
*/
|
|
virtual void shutdown() = 0;
|
|
|
|
/**
|
|
* @brief Get engine status and metrics
|
|
* @return JSON with performance data, loaded modules, etc.
|
|
*/
|
|
virtual json getStatus() const = 0;
|
|
|
|
/**
|
|
* @brief Get engine type identifier
|
|
*/
|
|
virtual std::string getEngineType() const = 0;
|
|
|
|
/**
|
|
* @brief Handle runtime commands (reload module, change config, etc.)
|
|
* @param command JSON command to execute
|
|
* @return JSON response
|
|
*/
|
|
virtual json handleCommand(const json& command) = 0;
|
|
};
|
|
|
|
} // namespace warfactory
|