Commit Graph

37 Commits

Author SHA1 Message Date
11f8cb2c79 feat: detection-driven planning (v0.6.0)
Planner no longer has god-view. It assumes threats enter from detection boundary (unified info network earliest detection point), not route start.

Core: DetectionCalculator (EO attenuated by Visibility, radar/IR unaffected; earliest detection via segment-circle intersection). EquipmentDeployment: drop DetectionRadius, add RadarRange/EORange/IRange/DetectionAccuracy. FireUnit detection fields activated in BuildFireUnits. IDefensePlanner.Plan adds 4th param detectionSources.

Engine: BuildDetectionSources merges standalone detectors + fire-unit self-detection into unified list, passed to planner.

Fix: Solve robustness when GenerateFireEventsAt returns empty (detection boundary too late to intercept).

Tests 193 to 208 (+15). 0 warnings.
2026-06-15 12:52:57 +08:00
3b8fb4ee86 refactor: code cleanup - warnings, dead code, naming
Warnings (9 to 0): events declared nullable, _cache nullable, IDamageModel param nullable.

Dead code removed: DefaultFormations class + FormationTemplate; AlgorithmTypes legacy types (ThreatProfile/DefenseRecommendation/DefenseSolution/MultiGroupRecommendation/RecommendedPlatform/RecommendedDetection); DroneEntity CurrentWaypointIndex/FormationOffsetX/Y/ApplyFormationOffset/wind params; Vector3 operators+Length+DistanceTo; CloudExpansionModel Phase2Duration/TimeToDensity; Kinematics EstimatedShellTime/GaussianConcentration; InterceptCandidate write-only fields (CoverageDuration/FlightTime/ShellFlightTime); ParticleParams EmitRate/ColorHex.

Naming: DefaultDefensePlanner -> DefensePlanner (only impl of IDefensePlanner); inCloudTime -> inCloudDistance (returns meters not seconds); DamageAssessment class summary fixed; wind comments clarified (drone wind removed vs cloud wind active).

Tests: 191 pass, 0 warnings.
2026-06-14 15:52:05 +08:00
8515f7821a feat(v0.5.0): weather into planner + unified physics model
Planner no longer writes local physics formulas. All kinematics/geometry/damage go through shared utility classes (Kinematics/RouteGeometry/CloudExpansionModel/DamageAssessment).

Core: RouteGeometry (route geometry), PlannerConfig + planner_config.json (config externalization). Planner route-aware layout (offset along tangent), cloud overlap 20pct. DroneEntity arc-length driven.

Fixes: PathInSphere cloud-frame correction (root cause), GaussianPuffDispersion hardcoded Sunny, ComputeEffectiveRadius cloud age, planner wind offset, remove drone wind bias.

Tests 167 to 191, 41s. Windy scenarios pass.
2026-06-14 14:49:53 +08:00
5e29536b8b build: 更新 Unity DLL + SqliteConnectionTracker 最终修复 2026-06-13 12:35:04 +08:00
a19dced505 fix: SqliteConnectionTracker — AssemblyReloadEvents.beforeAssemblyReload 安全关闭
- 静态追踪所有 SQLiteConnection,domain reload 前 Dispose 全部
- 替换所有 GC.Collect+WaitForPendingFinalizers 为 Tracker 模式
- DatabaseManager、ScenarioManager、中、SimulationRunner 等全部 Track/Untrack
2026-06-13 12:30:48 +08:00
5c23e92587 fix: OnDisable 加 GC.Collect+WaitForPendingFinalizers 防 SQLite 析构崩溃
- sqlite-net PreparedSqlLiteInsertCommand 析构器在 GC 线程跑 sqlite3_finalize
- Domain reload 时 SQLite native 可能已卸载 → 崩溃
- GC.Collect+WaitForPendingFinalizers 确保析构器在 native 还活着时完成
2026-06-13 12:24:09 +08:00
45387fee73 refactor: 删除所有逻辑fallback——缺失配置报错而非静默跳过
- DefaultDefensePlanner: 空catalog抛ArgumentEx, 缺ammo类型抛InvalidOp
- AmmunitionSpec? → AmmunitionSpec(非空), 删除 ==null 静默返回
- 删除 0.8f射程安全系数, 1.5f时间窗口乘数
- AlgorithmFactory 移除IDefensePlanner(null)注册
- SimulationEngine 构造必须传planner,6个调用点全部更新
2026-06-13 12:19:21 +08:00
fe7eb723a1 refactor: 清除 SimEvent alias 遗留——统一使用 using CounterDrone.Core.Simulation 2026-06-13 11:50:49 +08:00
50ec14bb24 refactor: 引擎自治 — 不再需要外部传 SetFireSchedule
- SimulationEngine.Initialize 内建 BuildFireUnits/BuildDroneGroups → 自动调 Planner
- 删除 FullPipelineTests 中的 BuildFireSchedule/_lastFireSchedule/手动 SetFireSchedule
- Unity Managers 删除手动 SetFireSchedule 调用
- 引擎是 Planner 的唯一调用者,测试和 UI 不再碰火控逻辑
2026-06-13 09:58:11 +08:00
5667aef495 fix: OnDisable + Dispose 替代 OnDestroy + Close,修复 domain reload SQLite 崩溃
OnDisable 在 domain reload 前触发,Dispose() 清理 prepared statements 并调用 GC.SuppressFinalize,阻止 GC finalizer 线程崩溃
2026-06-13 09:42:10 +08:00
2bb8ba2e1e fix: Manager OnDestroy 关闭 SQLite 连接,修复 domain reload 崩溃
- 所有 Manager 在 Awake 保存 _db 引用,OnDestroy 调用 Close()
- ScenarioManager/ModelManager/ReportManager/GroupManager/SimulationRunner 全部修复
- 崩溃原因:domain reload 时 GC finalizer 线程清理 prepared statements,DB 未关闭导致 sqlite3_finalize 竞态
2026-06-13 09:35:53 +08:00
7d080bc929 fix: Unity 测试配置 - 火力单元改为 8×3 发(与集成测试一致) 2026-06-13 09:19:30 +08:00
66537d1621 fix: Unity 脚本编译错误 - 缺少 AVector3 别名和 detail 变量 2026-06-13 09:16:47 +08:00
3a2f68b02b refactor: 删除 SimulationRunner.BuildFireSchedule fallback
- Planner 输出直接传给 Engine.SetFireSchedule
- ManagerVerification/SimulationBootstrap 在 LoadAndStart 前设置 fire schedule
- 引擎不再需要从 CloudDispersal 反推发射计划
2026-06-13 09:15:21 +08:00
317f47280b refactor: DefensePlanner 替代 DefenseAdvisor
- 新增 IDefensePlanner 接口 + DefaultDefensePlanner 实现
- FireUnit 重构为统一平台模型(Type/Position/CruiseSpeed/ReleaseAltitude/MuzzleVelocity)
- DroneGroup 加入威胁指数(类型系数×速度系数)和优先级排序
- 五步流水线:威胁排序→弹药匹配→候选生成→贪心分配→时序生成
- 弹药精确匹配,不降级;临界方案基于50%概率阈值
- 删除 IDefenseAdvisor/DefaultDefenseAdvisor/RecommendMultiGroup
- AlgorithmFactory 注册 IDefensePlanner
- 测试更新:DefensePlannerTests 替代旧测试,FullPipelineTests 适配新 API
- Unity Managers 更新调用
- 125 测试全通过
2026-06-12 18:20:25 +08:00
c4d9ccc4fa feat: 空基平台飞行与投弹功能
- PlatformEntity: 新增状态机 Idle→FlyingToTarget→ReadyToRelease
- EquipmentDeployment: 新增 CruiseSpeed 字段(空基平台巡航速度)
- MunitionEntity: 空投弹药继承载机速度矢量,替代自由落体
- Kinematics: 新增 AirDropPosition/AirDropFallTime/DirectionVelocity 工具方法
- SimulationEngine: 空基平台先飞后投,AdjustFireTimesForAirBased 补偿飞行耗时
- SimulationRunner: 空基平台 3D 可视化(蓝色 Capsule)
- 集成测试 Scenario_AirBased_PlatformFliesAndDrops 通过(8x 加速)
- 实施文档同步进度
2026-06-12 17:38:21 +08:00
b7afe23238 fix: ManagerVerification用固定tickDt替代Editor不稳定的Time.deltaTime 2026-06-12 16:36:03 +08:00
845f8dcd1b 所有Manager Awake改成public + ManagerVerification直调Awake 2026-06-12 16:32:31 +08:00
1bbe5d28c5 fix: 报告生成空列表保护 + 仿真后关闭引擎防DB锁 2026-06-12 16:26:10 +08:00
aa6e4d3508 fix: TargetConfig加GroupId=default匹配RoutePlan 2026-06-12 16:21:02 +08:00
6bbad9155a fix: SimulationRunner也补SendMessage(Awake) 2026-06-12 16:18:25 +08:00
fb6c4c7c12 fix: ManagerVerification手动插入默认弹药, 数据库无JSON时表为空 2026-06-12 16:16:48 +08:00
1eba842487 fix: Edit模式下AddComponent不调Awake, 显式SendMessage 2026-06-12 16:11:51 +08:00
59732d2542 ScenarioManager.Awake加try-catch定位根因 2026-06-12 16:08:18 +08:00
b40392c64a fix: ManagerVerification显式调用Awake避免ContextMenu不触发 2026-06-12 16:06:32 +08:00
5851ce2ea8 fix: ManagerVerification + SimulationBootstrap适配多编队 Route/WaypointGroups 2026-06-12 16:04:49 +08:00
6f56cff655 fix: ScenarioManager重复Service属性导致编译失败 2026-06-12 15:52:15 +08:00
12cb6576fe 多批次Phase1: RoutePlan改Id主键+Waypoint加GroupId+ScenarioService/Engine/所有测试适配 2026-06-12 15:33:37 +08:00
b77c308517 补充GroupManager + 架构文档V8(事件驱动/FireSchedule/三阶段扩散) 2026-06-12 14:52:07 +08:00
f2204bf3b4 fix: SimulationRunner解析函数缺失 + 变量声明丢失 2026-06-12 14:43:07 +08:00
98e16ea720 CloudDispersal加SalvoRounds/Spacing, FireSchedule按间隔展开云团, 拦截成功 2026-06-12 11:32:17 +08:00
2d14c17d9c 默认弹药改为JSON文件导入 + DatabaseManager种子数据 + 测试手动插入, 129测试通过 2026-06-12 11:17:59 +08:00
6a184d9bf8 推荐算法ComputeEffectiveRadius用高斯公式,BuildFireSchedule去掉算法逻辑,129测试通过 2026-06-12 11:03:30 +08:00
8b71351a7b 云团视觉:用算法真实半径+透明度,随扩散渐大渐淡 2026-06-12 09:31:15 +08:00
d3295418b7 fix: 补 _knownMunitions 字段声明 2026-06-11 18:11:17 +08:00
af8b0dac35 补炮弹飞行轨迹可视化 + 到达后清理 2026-06-11 18:10:20 +08:00
1ce560c48a Phase 6: 4个Manager + 全流程验证 + Unity项目结构 2026-06-11 17:41:47 +08:00