refactor AI system
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
#include "ModuleOwnerComponent.h"
|
||||
#include "MovementIntentSystem.h"
|
||||
#include "PositionComponent.h"
|
||||
#include "RepairSystem.h"
|
||||
#include "SalvagerSystem.h"
|
||||
#include "ScrapSystem.h"
|
||||
#include "ShipIdentityComponent.h"
|
||||
#include "ShipSystem.h"
|
||||
@@ -68,6 +70,8 @@ Simulation::Simulation(GameConfig config, unsigned int seed)
|
||||
m_movementIntentSystem = std::make_unique<MovementIntentSystem>();
|
||||
m_dynamicBodySystem = std::make_unique<DynamicBodySystem>();
|
||||
m_scrapSystem = std::make_unique<ScrapSystem>(m_admin);
|
||||
m_salvagerSystem = std::make_unique<SalvagerSystem>(m_admin);
|
||||
m_repairSystem = std::make_unique<RepairSystem>(m_admin);
|
||||
m_waveSystem = std::make_unique<WaveSystem>(m_config, m_rng);
|
||||
m_combatSystem = std::make_unique<CombatSystem>(m_config);
|
||||
|
||||
@@ -169,6 +173,8 @@ void Simulation::reset(unsigned int seed)
|
||||
m_movementIntentSystem = std::make_unique<MovementIntentSystem>();
|
||||
m_dynamicBodySystem = std::make_unique<DynamicBodySystem>();
|
||||
m_scrapSystem = std::make_unique<ScrapSystem>(m_admin);
|
||||
m_salvagerSystem = std::make_unique<SalvagerSystem>(m_admin);
|
||||
m_repairSystem = std::make_unique<RepairSystem>(m_admin);
|
||||
m_waveSystem = std::make_unique<WaveSystem>(m_config, m_rng);
|
||||
m_combatSystem = std::make_unique<CombatSystem>(m_config);
|
||||
|
||||
@@ -238,11 +244,12 @@ void Simulation::tick()
|
||||
}
|
||||
|
||||
m_shipSystem->clearMovementIntents();
|
||||
m_aiSystem->tickHomeReturnBehavior(m_admin); // priority 4
|
||||
m_aiSystem->tickThreatResponseBehavior(m_admin, *m_buildingSystem); // priority 3
|
||||
m_aiSystem->tickRepairBehavior(m_admin, *m_buildingSystem); // priority 2
|
||||
m_aiSystem->tickRepairTools(m_admin);
|
||||
m_aiSystem->tickSalvageBehavior(m_admin, *m_scrapSystem, *m_buildingSystem); // priority 1
|
||||
// Score-based behavior selection: evaluate, select winner, execute (sets
|
||||
// movement intent + preferred module targets only — no world mutation).
|
||||
m_aiSystem->tick(m_admin, *m_buildingSystem, *m_scrapSystem);
|
||||
// Module systems perform the world mutation (collection/delivery, healing).
|
||||
m_salvagerSystem->tick(*m_scrapSystem, *m_buildingSystem);
|
||||
m_repairSystem->tick();
|
||||
|
||||
// Step 8: combat resolution
|
||||
m_combatSystem->tick(m_currentTick, m_admin,
|
||||
|
||||
@@ -27,6 +27,8 @@ class BuildingSystem;
|
||||
class CombatSystem;
|
||||
class DynamicBodySystem;
|
||||
class MovementIntentSystem;
|
||||
class RepairSystem;
|
||||
class SalvagerSystem;
|
||||
class ShipSystem;
|
||||
class ScrapSystem;
|
||||
class WaveSystem;
|
||||
@@ -185,6 +187,8 @@ private:
|
||||
std::unique_ptr<MovementIntentSystem> m_movementIntentSystem;
|
||||
std::unique_ptr<DynamicBodySystem> m_dynamicBodySystem;
|
||||
std::unique_ptr<ScrapSystem> m_scrapSystem;
|
||||
std::unique_ptr<SalvagerSystem> m_salvagerSystem;
|
||||
std::unique_ptr<RepairSystem> m_repairSystem;
|
||||
std::unique_ptr<WaveSystem> m_waveSystem;
|
||||
std::unique_ptr<CombatSystem> m_combatSystem;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user