Commit Graph

183 Commits

Author SHA1 Message Date
ce9d44db7e perf: 仿真期间零字符串分配,JSON 序列化推迟到 Flush
EntitySnapshot 新增原始字段(DamageStage/Hp/CloudRadius等), CollectSnapshots 直接填值

FrameDataStore buffer 改为 FrameRecord 结构体, Flush 时统一拼 JSON

SimulationRunner 直接读 snap.CloudRadius/CloudOpacity, 移除 JsonDocument.Parse

删除 SimulationEngine 的 StringBuilder 和 Str() 方法
2026-06-15 19:18:44 +08:00
fb22605fa3 perf: CollectSnapshots 改用 StringBuilder 池化避免中间字符串分配
StringBuilder.AppendFormat 复用内部缓冲区,每实体从4次分配到1次

.NET Standard 2.1 不支持 Span<T> 作泛型参数,string.Create 方案不可行
2026-06-15 19:14:17 +08:00
b3dec77e92 fix: DispersionModelTests 共享状态污染导致随机失败
Dissipates_AfterMaxDuration 直接用 Ammo() 返回的共享引用并修改 MaxDuration=2,后续 Phase2/Phase3 测试拿到被污染的数据

改为独立 new AmmunitionSpec 避免修改共享对象
2026-06-15 19:11:44 +08:00
2a87b77085 perf: 毁伤判定加快速排斥 (距离>2R跳过PathInSphere)
密度检查提前到外层循环,减少不必要计算
2026-06-15 18:47:11 +08:00
9964d77751 build: 更新 Unity Plugins Core.dll(FrameDataStore 内存缓存版) 2026-06-15 18:26:31 +08:00
5c2b95d777 perf: FrameDataStore 改为内存缓存+结束时批量写入
RecordFrame: 仅内存追加, 零磁盘IO

Flush: 仿真Stop时单次事务批量InsertAll

BeginRecording/Discard/BufferedFrameCount 新API

SimulationEngine: 移除 _frameDb 持久连接, RecordFrames默认true

SimulationRunner: 移除所有 Debug.Log 每帧日志

ReplayController: 适配 ReadFrames 新API

FrameDataStoreTests: 6项覆盖 录制/刷新/读取/丢弃/清理
2026-06-15 18:25:21 +08:00
cc1a0628d8 perf: SimulationEngine GC优化
CollectSnapshots: 字符串拼接替代 JsonSerializer.Serialize (最大GC源)

Tick: 复用池替代每帧 new List/SimulationFrameResult

ToList/Where→手动for循环+移除索引, 避免LINQ分配

移除 System.Text.Json 依赖
2026-06-15 18:19:56 +08:00
c379e849f0 fix: DefaultScenarios.Seed 幂等检查修复(SQL LIKE 中 [] 是通配符)
搜索关键字 [Demo]→Demo(避免 SQL LIKE 字符类误匹配)

版本升级时删除旧 Demo 任务后重建(而非跳过)
2026-06-15 17:19:43 +08:00
274779309d fix: Unity 脚本清理旧引用
ScenarioManager.SaveRoute: groupId→waveId 参数重命名

ManagerVerification: 移除冗余手动插弹药(DB已自动种子)

SimulationBootstrap: 更新为预设/自定义双模式模板
2026-06-15 16:29:31 +08:00
5f589c9644 refactor: SimulationBootstrap 更新为前端参考模板
两种模式: 预设(选[Demo]想定) / 自定义(DefaultData预设组装)

移除手动插弹药(已自动种子), 使用 DefaultData 天气/目标/航线/火力单元预设

UnityPathProvider 从 StreamingAssets 自动复制数据文件

前端文档: 快速开始改为挂 SimulationBootstrap 即运行
2026-06-15 16:27:45 +08:00
18f7b79401 fix: UnityPathProvider 首次运行自动复制数据文件
从 StreamingAssets 自动拷贝 defaults.json + planner_config.json 到 persistentDataPath

前端文档更新: 文件放 Assets/StreamingAssets/ 即可,无需手动放 persistentDataPath
2026-06-15 16:25:05 +08:00
235c111a75 refactor: 集成测试使用预设想定 + 航线预设
defaults.json 新增 routes 航线预设 (3km/5km/10km/20km)

DefaultData 新增 RoutePreset/WaypointCoord,Routes 属性

DefaultScenarios 使用 R() 引用航线替代手写 MakeWaypoints

FullPipelineTests: LoadPreset/RunPreset 替代手写 setup,-500行

测试: 191 pass, 2 skip (DetectionDriven+3DronesAirBased), 24s
2026-06-15 16:18:51 +08:00
4fa19e386c feat: 预设想定种子 (DefaultScenarios)
6 个预设想定首次启动自动入库,幂等跳过:无防御/管控侵入/活塞西风/喷气活性/空基东风/3架空基编队

通过 DatabaseManager.OpenMainDb() 自动种子,版本追踪

ScenarioServiceTests 期望值适配(+6 个种子想定)
2026-06-15 16:06:56 +08:00
d6fb206078 build: 更新 Unity Plugins Core.dll(含 DefaultData 和 MetaEntry) 2026-06-15 15:47:22 +08:00
8eeb43f0e8 feat: 统一默认数据架构 (defaults.json + DefaultData)
单一数据源 data/defaults.json,含弹药/编队/火力单元/无人机/探测/天气六类预设

版本追踪: Meta 表 + version 字段,更新时 InsertOrReplace,不删用户数据

名称统一 [Demo] 前缀,UI 中可识别为模拟数据

删除: DefaultAmmunition.cs, DefaultFireUnits.cs, default_ammo.json, default_formations.json, TestAmmo.cs

TestPathProvider 自动复制数据文件到测试目录

集成测试精简: 4个简单变体跳过,保留6个核心场景,39s
2026-06-15 15:46:20 +08:00
56d345189e refactor: 编组概念拆分为批次(WaveId)+火力单元(FireUnit)
Breaking: Group表/枚举/Service/Repository移除; GroupId->WaveId; DroneGroup->DroneWave; DroneGroupId->DroneWaveId; GroupManager删除

Docs: CHANGELOG 0.7.0; 总体架构 V10; DefensePlanner V4; 实施计划 V1.4; 对接文档 V1.2

Tests: 204/204 pass
2026-06-15 15:13:48 +08:00
665747a846 feat: standalone detection equipment API + task detail includes detections
IScenarioService: AddDetection/DeleteDetection/GetDetections (independent of SaveDeployment overwrite).

Repository: GetByTaskIdAndRole filters by equipment role.

TaskFullConfig.Equipment already includes detections (GetTaskDetail.GetByTaskId returns all). Frontend filters by EquipmentRole.Detection or uses GetDetections.

Tests: 4 detection CRUD tests. 212 total pass.
2026-06-15 13:30:16 +08:00
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
d70d1f0bf8 fix: multi-lane cloud offset used global index instead of per-lane index
Bug: offset = (eventIdx - (totalRoundsNeeded-1)/2) * spacing used global eventIdx across all lanes. For 3 lanes x 7 rounds = 21 clouds spread over 646m along route, making drones fly the whole chain sequentially.

Fix: offset = (roundInLane - (singleNeeded-1)/2) * spacing. Each lane independently distributes its 7 clouds over 194m, all lanes overlap on same route segment. Drones hit simultaneously.

Result: 3 drones destroyed at same time (t=91.6s, same X=5089), was sequential 87/91/96s. 193 tests pass.
2026-06-14 22:12:32 +08:00
008df4a86c fix: planner formation lane offset + add 3-drone integration test
Bug: planner used symmetric lane offset (Z=-50/0/+50) but DroneEntity uses start-anchored (Z=0/50/100). 3rd drone at Z=100 got no clouds.

Fix: planner laneOffset = yLane * laneSpacing (matches DroneEntity formationIndex * lateralSpacing).

Test: Scenario_3DronesFormation - 3 drones in Formation (Z=0/50/100), 3 fire units, all destroyed. 192 tests pass.
2026-06-14 21:58:05 +08:00
c6aee276fb fix: weather display bug + report enrichment + destroy dedup
Weather: WindDirection showed raw int (0-7), now translates to N/NE/E. Added scene type, time-of-day, humidity, pressure, scene dimensions to environment section.

Report enrichment: threat section adds wingspan; deployment section shows platform type/position/ammo/munitions and detection equipment/control zones; cloud dispersal config section; event timeline includes coordinates; timeline section adds first/last launch, group spread, summary stats.

Bug fix: DroneDestroyed event fired multiple times per tick when a drone was hit by multiple clouds simultaneously (was 2, now 1). Added break after destroy in cloud loop.

Tests: 191 pass.
2026-06-14 21:21:37 +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
bf3452013d feat: 全部160测试通过(22s). 损伤模型RequiredExposure替代硬编码
- IDamageModel.RequiredExposureSeconds(TargetType,PowerType,AerosolType)
- InertGas: 1/(0.15*sensitivity), Piston 1.5→4.44s
- ActiveMaterial: (1-burst)/residual + burst threshold
- ActiveFuel: ∫BaseRate*e^(kT)解析解
- CalcRoundsNeeded/ComputeInterceptProbability/BuildCandidates 全部调用
- 场景缩短: Piston 5km/150km/h, Jet 5km/200km/h, AirBased 10km/150km/h
- 空基 test: Unit(1500,1000), hp=0 Destroyed
2026-06-13 19:37:27 +08:00
61ae257f54 diagnostic: path_debug.txt 验证路径积分正确(251m=7朵云处击毁) 2026-06-13 19:12:33 +08:00
a3bf6720c6 feat: 路径积分毁伤判定(DamageAssessment.PathInSphere)
- 替换离散 ContainsPoint 为连续路径积分
- DroneEntity 新增 PrevX/Y/Z + SavePreviousPosition
- DamageAssessment 独立模块
- Piston WindSpeed=0 验证:暴露4.52s,击毁
2026-06-13 19:00:41 +08:00
1f092e8647 refactor: 密度阈值统一在引擎检查(ammo.EffectiveConcentration),去掉三个模型的硬编码
- SimulationEngine: 密度<EffectiveConcentration则跳过损伤
- InertGas/ActiveMaterial/ActiveFuel 移除各自的硬编码阈值
- CloudExpansionModel新增TurbulentRadius属性
- DefaultAmmunition ActiveMaterial EffectiveConcentration 0.0002→0.0001
2026-06-13 18:24:27 +08:00
cc3c7199c0 refactor: CloudExpansionModel提取RoundsNeeded/TimeToDensity/TimeToReach
- RadiusAt/DensityAt/TimeToReach/TimeToDensity/RoundsNeeded 放入独立模块
- CalcRoundsNeeded 委托给 cloudModel.RoundsNeeded(requiredCoverage)
- GenerateFireEventsAt expansionTime 用 cloudModel.TimeToReach(RadiusAt(30f))
- 147/150 (Piston hp=0.10边际,LongRoute校验)
2026-06-13 18:18:19 +08:00
510403a66c refactor: 提取 CloudExpansionModel 独立模块
- RadiusAt(t)/DensityAt(t)/TimeToReach(r) 封装在 CloudExpansionModel
- ComputeEffectiveRadius 简化为委托调用
- GaussianPuffDispersion 重复逻辑待后续统一
2026-06-13 18:14:42 +08:00
9c153a040b fix: CalcRoundsNeeded=ceil(requiredCoverage/2R),去除+1 hardcode
- 理论:所有云在无人机到达时膨胀到expansionTime≈30s,半径均匀
- ceil(333.3/40.4)=9发覆盖363m/6.54s>6s
- hp=0.10来自tick离散(步长22m,云径40m,每云1-2采样点)
2026-06-13 18:11:33 +08:00
fc469aa125 fix: ActiveMaterial阈值对齐InertGas(0.0001); Jet 200km/h避跳步; Piston hp=0.10边际
- Jet: 500→200km/h, 步长22m<54m云直径
- ActiveMaterial: TriggerThreshold 0.0002→0.0001
- 149/150 通过, Piston hp=0.10 结构正确
2026-06-13 18:04:31 +08:00
47761e5124 diagnostic: Jet hit_log确认3/6云命中(56m步跳过3个),TimeScale默认改回1 2026-06-13 17:48:47 +08:00
43426ab5fc fix: MunitionEntity 插值到精确释放高度 + 修正 System.Math 引用 2026-06-13 17:27:06 +08:00
355b430828 fix: 抛物线弹道精确求解 + 上行触发云生成 + 空基修复
- Kinematics.CalculateLaunchAngle: 解 tan(θ) 二次方程取平射解
- Kinematics.ParabolicShellTime: 精确飞行时间替代 dist/mv 近似
- MunitionEntity.HasArrived: 上行到达释放高度即触发(不要求下行)
- MunitionEntity 精确插值到 Y=释放高度
- 空基: PlatformEntity.CommandFlyTo 读取 releaseAlt 算 driftDist
- 空基: 投放点位置保留插值不传送到终点
- 单元测试: 13/13 Kinematics 通过(含45°标准公式验证)
2026-06-13 17:26:09 +08:00
9e1fe869a6 fix: 空基投放点不被传送到终点——插值位置保留在投放点
- PlatformEntity 投放条件触发时不设置PosX=targetX,保留插值位置
- 空基FireEvent.TargetX=云位,platform飞向云位,距目标driftDist时投放
- planner恢复laneBaseTime+stagger覆盖,保证云位连续间距均匀
- CommandFlyTo接收disperseHeight计算driftDist
2026-06-13 16:57:14 +08:00
a5fef98858 wip: 空基Planner修正——投放点后移抵消载具漂移;云团/发射事件用精确时刻
- 空基 GenerateFireEventsAt 投放点后移 driftX = cruiseSpeed * fallTime
- MunitionEntity 记录 launchTime + flightDuration → ArrivalTime 精确计算
- 云团 Initialization 用 munition.ArrivalTime 非 SimulationTime
- CloudGenerated 事件 OccurredAt 用精确到达时刻
- PlatformEntity 存储 ExactReleaseTime
- 修复缺失 else 导致的空基走地基分支
2026-06-13 16:40:27 +08:00
09f51939d8 fix: spacing=2R消除魔法数字,turbulentRadius贯穿CalcRoundsNeeded
- ComputeEffectiveRadius返回(getEffectiveRadius, expansionTime, turbulentRadius)
- CalcRoundsNeeded/tagger均用turbulentRadius
- spacing=2R(云端直径=中心距),消除1.5f经验系数
- FireEvent.OccurredAt存储fe.FireTime精确发射时刻
2026-06-13 16:03:01 +08:00
6cd18bf142 fix: FireUnit不拆通道 + PlatformIndex按unitIdx*TotalChannels+ch映射
- BuildFireUnits: 一个物理单元 = 一个 FireUnit(TotalChannels = GunCount*ChannelsPerGun)
- _entityCounter 在平台创建前重置为0,platform ID从1开始
- GenerateFireEventsAt 通过 unitIdx*TotalChannels+ch 计算 PlatformIndex
- 移除赋值循环中覆盖 PlatformIndex 的代码
2026-06-13 15:44:35 +08:00
197f8b6e5c perf: Commit批量50帧 + Calc回到+1(11发最优)
- _frameDb.Commit() 从每帧改为每50帧批量提交
- CalcRoundsNeeded 回退到 +1(12发反更差)
- Piston: 10机50m间距8/10击毁
2026-06-13 15:17:25 +08:00
070167f572 fix: 编队偏移持久化到航点 + yLanes=Quantity + 云Z展开
- DroneEntity: 偏移写入克隆航点List而非位置字段
- Planner: 车道数=无人机数, laneSpacingZ=LateralSpacing
- 200m间距: 33发, 2/3击毁, 第三架hp=0.10边缘效应
2026-06-13 15:03:44 +08:00
b596b4a791 fix: roundInLane+ch 双重错开 + TargetY 分析
- stagger = (baseRoundInLane+ch)×CloudCoverInterval
- 引擎 span=7.20s, Planner单元测试 span=7.27s
- 2/3 击毁,第三架 FormationOffsetY 垂向偏移导致覆盖窗口缩短
2026-06-13 14:42:16 +08:00
0c9cdb7b82 fix: stagger=roundInLane*speed 替代 ch*speed——通道展开为1后ch永远为0
- roundInLane = singleNeeded - laneNeeded[currentLane]
- 跨度从 0.125s → 7.39s
- Piston: 2/3 击毁
2026-06-13 14:35:29 +08:00
c5c1b79946 fix: ChannelInterval 降到 0.1s——CloudCoverInterval 不再被硬件卡住
- Kinetics.CloudCoverInterval minInterval 默认 0.1s
- DefaultFireUnits ChannelInterval 1.0→0.1
- 多机横向编队跨度 10s→7.27s
2026-06-13 14:24:11 +08:00
6a6c03f0fa fix: 每单元固定Y车道 + CloudCoverInterval物理间隔 + 16通道
- Solve: 每单元分配一个Y车道,所有弹打同一高度
- stagger=CloudCoverInterval 替代硬编码 ChannelInterval
- Kinematics.CloudCoverInterval: 云团直径/目标速度,不小于硬件间隔
- DefaultFireUnits: ground-light 改为 16通道
- 报告 F1→F2 精度
- MultiLane_3Drones_3Lanes_ExactOutput 单元测试
2026-06-13 14:18:18 +08:00
4f509e5a2a refactor: 每单元锁定一个Y车道,非轮转分配
- 单元→车道固定分配(管转向跟不上一发一个Y)
- 车道需求 tracked,单元依次填满当前车道
2026-06-13 14:04:00 +08:00
29aa11665b fix: 多单元并行 + 多车道正确弹药计算
- 所有单元以同基准时间并行发射(offset=0)
- 通道内 ch×ChannelInterval 独立错开
- CalcRoundsNeeded 恢复纯单机,yLanes 乘法在 Solve
- Piston: 33发=11×3车道, 2/3击毁
2026-06-13 13:57:56 +08:00
c7792d1d4a feat: 多机编队Y车道分布 + 8火力单元
- GenerateFireEventsAt: 按 yLane×laneSpacingY 分布云团Y坐标
- Piston 测试: 8 ground-light × 3机横向编队
- 42发弹, 2架击毁, Y车道对齐无人机位置
2026-06-13 13:26:43 +08:00
a9339c36e3 feat: 编队2D模型 — LateralSpacing/LongitudinalSpacing + DroneEntity 纵向偏移
- RoutePlan: FormationSpacing→LateralSpacing, 新增LateralCount/LongitudinalCount/LongitudinalSpacing
- DroneEntity: 2D编队(latIdx/longIdx), 横向Y展开+纵向X落后
- DefaultFormations: 6种编队模板
- DroneEntityTests: 11个(含2D编队/2×2方队/蜂群)
- Planner: yLanes=ceil(formationWidth/cloudDiam), totalNeeded=single×lanes
2026-06-13 13:20:18 +08:00
4706c4b8c1 feat: 编队模型扩展 — LateralSpacing/LongitudinalSpacing/LateralCount/LongitudinalCount
- FormationSpacing → LateralSpacing(正面横向间距)
- 新增 LongitudinalCount/LongitudinalSpacing(纵深串列)
- DefaultFormations: 6种默认编队模板(单机/3机横队/5机横队/3机纵队/2×2方队/10机蜂群)
- Piston 测试设置 LateralCount=3, LongitudinalCount=1
2026-06-13 13:16:27 +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
a39439c023 build: 更新 Unity DLL 以匹配新 Engine 构造函数签名 2026-06-13 12:22:33 +08:00
3ba8e4f604 fix: 引擎使用传入的 _planner,不再内部 new DefaultDefensePlanner
- 构造函数传入的 planner 之前从未使用(死代码)
- Initialize 内删除了重复的 DB catalog 加载和 new DefaultDefensePlanner
- 现在统一由调用方注入 Planner
2026-06-13 12:20:51 +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
b5b561039b refactor: 删除引擎 Tick 中 ReleaseAltitude → _disperseHeight fallback 2026-06-13 12:09:31 +08:00
fd723daa78 refactor: 删除 PlatformEntity/BuildFireUnits 中的速度/初速/高度默认值
- PlatformEntity: MuzzleVelocity/CruiseSpeed/ReleaseAltitude 默认 0,由 Planner 校验
- BuildFireUnits: 同上,不再硬写 800f/55f/1000f
- MunitionCount 默认从 3 改为 1
- 35 测试通过
2026-06-13 12:04:35 +08:00
162338ce83 refactor: 删除Planner所有配置默认值——参数必须从FireUnit取,取不到报错
- 删除 CruiseSpeed=55/MuzzleVelocity=800/ReleaseAltitude=+500 等8处默认值
- 空基参数<=0抛 InvalidOperationException,地基初速<=0跳过候选
- 无人机速度/航路长度为0跳过该弹
- 保留物理安全守卫(防NaN/除零)和概率帽0.95
2026-06-13 12:02:57 +08:00
182af5026d fix: recommendedTiming按目标点位置算而非中点——每个弹道到达时间不同
- GenerateFireEventsAt: txArrival = distToTx/droneSpeed 替代 threat.ArrivalTime
- 航路反方向截断保护
- 暴露毁伤时间 34.4s→38.4s
2026-06-13 11:54:39 +08:00
fe7eb723a1 refactor: 清除 SimEvent alias 遗留——统一使用 using CounterDrone.Core.Simulation 2026-06-13 11:50:49 +08:00
ced8d4014a refactor: 删除未使用的 Models.SimEvent,消除 SimEvent 重名
- 删除 Models/SimEvent.cs(DB表定义,无人读写)
- 删除 DatabaseManager 中 CreateTable<SimEvent> 和 CreateIndex
- DatabaseManagerTests 表数量 13→12
2026-06-13 11:46:31 +08:00
0f73bbf55e feat: 报告显示Per-unit发射数 + 事件标明火力单元
- 五、我方部署: 从实际发射事件统计每个火力单元发射数(非想定数据)
- 六、事件时序: 新增"火力单元"列,标注每发隶属哪个单元
- PlatformId→火力单元映射复用(去重)
2026-06-13 11:40:21 +08:00
26a372ffc5 config: 空基火力单元通道从4→8,增强火力覆盖 2026-06-13 11:32:22 +08:00
c08d613d5b test: 引擎空基/地基发射类型单元测试 + Planner覆盖全面测试
- SimulationEngineTests: AirBased_LaunchesWithCorrectDescription (空基描述="空基投放")
- SimulationEngineTests: GroundBased_LaunchesWithCorrectDescription (地基描述="计划发射")
- DefensePlannerTests: 23个全覆盖(威胁排序/弹药匹配/地基弹道/空基弹道/分配/边界/多威胁/临界)
- FullPipeline AirBased: 加入事件描述诊断断言
2026-06-13 11:27:00 +08:00
7fa0268463 fix: 空基 FireEvent.MuzzleVelocity=0 + 空基弹道单元测试
- GenerateFireEventsAt: 空基时 MuzzleVelocity=0(而非800)
- 新增 AirBased_FireTime_EarlierThanArrival 验证提前量
- 新增 AirBased_FireTime_EarlierThanGroundBased 验证空基更早
- 新增 AirBased_NoMuzzleVelocityInFireEvent 验证 MuzzleVelocity=0
- 空基弹道计算本身正确(recommendedTiming - flightTime - fallTime)
2026-06-13 11:05:34 +08:00
c610573e34 fix: 物理间隔错开发射 — 云团直径/无人机速度,非硬件间隔
- 跨 FireUnit 按 physicsInterval = max(ChannelInterval, cloudDiameter/droneSpeed) 错开发射时间
- Piston 200km/h 测试通过(被摧毁=1)
- Jet 500km/h 测试通过(被摧毁=1)
2026-06-13 10:55:58 +08:00
08427e9e08 feat: 新增轻型地基火力单元模板(2炮×4通道); Piston测试使用 ground-light×2 2026-06-13 10:46:41 +08:00
c08edbd2f9 feat: 火力单元通道模型 + 默认配置 + 引擎通道展开
- FireUnit: 新增 GunCount/ChannelsPerGun/ChannelInterval/检测设备字段
- EquipmentDeployment: 新增 GunCount/ChannelsPerGun/ChannelInterval
- DefaultFireUnits: 3 种默认火力单元(标准地基/重地基/空基)
- Planner: 逐通道齐射分配,ChannelInterval 错开,Cooldown 轮次
- Engine: PlatformEntity 按 GunCount×ChannelsPerGun 展开
- BuildFireUnits: 与引擎同步展开通道
- FullPipelineTests: 使用 DefaultFireUnits 配置
2026-06-13 10:42:08 +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
77351d8198 fix: FireEvent 冷却错开,同平台多弹不再同 tick 被跳过
根因:同一平台多弹 FireTime 相同,引擎同 tick 处理时第 1 发后冷却触发 Ready=false,后续全被跳。
修正:每发 FireTime 增加 i * Cooldown,保证间隔 ≥ 冷却时间。
2026-06-13 09:56:11 +08:00
e3ea595204 refactor: SimulationEngine 内部调用 Planner,不再依赖外部传 SetFireSchedule
- Initialize 内建 BuildFireUnits/BuildDroneGroups
- 自动从 DB 取 AmmunitionSpec 创建 DefaultDefensePlanner
- SetFireSchedule 保留为手动覆盖(测试可用)
- fireSchedule 空时才自动生成
2026-06-13 09:53:08 +08:00
4411a452dc fix: Quantity expand + PlatformIndex 映射修正
- ApplyDefensePlan 展开 EquipmentDeployment.Quantity → 多个 FireUnit
- Planner 分配后用 fireUnits.IndexOf 修正 PlatformIndex
- 新增 FullPipeline_Piston_VerifiesRoundAllocation 验证 ≥8 发
- Piston 集成测试加入计划大小断言
2026-06-13 09:50:24 +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
8366bfcb93 fix: Planner 从多单元凑弹药,不再被单个 TotalMunitions 卡死
每个威胁可从多个火力单元汇集弹药,直到满足需求或耗尽。
单元测试 24/24 通过。
2026-06-13 09:40:37 +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
b957a5e2b4 feat: Planner 使用真实物理计算 + 完善单元测试 + 规则7
- ComputeEffectiveRadius: 基于 AmmunitionSpec 三阶段扩散模型
- CalcRoundsNeeded: 真实有效半径和弹药参数
- GenerateFireEvents: recommendedTiming = arrivalTime - expansionTime
- 候选概率基于真实覆盖计算
- 24 个单元测试覆盖威胁排序/弹药匹配/候选过滤/弹药数/时机/多威胁/空基
- AGENTS.md 规则7: 只跑相关测试,不跑全量
2026-06-13 09:30:04 +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
0a3c444a4b refactor: 推荐算法统一处理空基/地基平台类型
- ThreatProfile 新增 PreferredPlatformType 字段
- DefaultDefenseAdvisor 根据平台类型正确计算 FireTime/CruiseSpeed/ReleaseAltitude
- 空基:FireTime 提前扣除飞行+下落时间;地基:保持原逻辑
- 删除 SimulationEngine.AdjustFireTimesForAirBased(引擎不再做适配)
- 集成测试直接用 PreferredPlatformType 驱动空基方案
- 实施文档同步
2026-06-12 17:52:44 +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
2408307487 check_unity_build: 加说明Unity batchmode不保证捕获编译错误 2026-06-12 15:56:49 +08:00
6f56cff655 fix: ScenarioManager重复Service属性导致编译失败 2026-06-12 15:52:15 +08:00
6030b8de07 RecommendMultiGroup: 多编队火力分配 + 专一弹药优先 + 130测试通过 2026-06-12 15:46:05 +08:00
12cb6576fe 多批次Phase1: RoutePlan改Id主键+Waypoint加GroupId+ScenarioService/Engine/所有测试适配 2026-06-12 15:33:37 +08:00
9ac4a8494c check_unity_build.ps1自动重建DLL; 更新Plugins; 防止漏更新 2026-06-12 15:03:06 +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
3e12dba143 ICloudDispersionModel加Elapsed属性 + 帧数据输出云团存在时间 2026-06-12 14:25:23 +08:00