Skip to content

Country Record 国家记录

状态:Authoritative Reference v1

1. 物理结构

Raw BTL Country record 固定为:

text
0x12C = 300 bytes

所有 BTL 版本使用同一 raw Country 长度。不要把续关/战斗保存中的 0x204/0x208 runtime Country 序列化记录误认为“新版 BTL Country”。

当前 1.28.0 corpus:

text
Country records = 8927

原版主构造 consumer:FUN_00488718

主要 authority:

text
reports/btl_v1280_so_recovery.md
reports/evidence_reuse_round3_btl_datasystem_fields_audit.md
reports/btl_editor/round4/field_write_whitelist_matrix.csv
reports/battle_outcome_btl_field_matrix.csv
reconstruction/src/WC4.Runtime.BattleData/BtlRecords.cs

2. 完整 byte map

Country 中间的大块 stock/technology 区仍只有部分槽位业务语义闭合,因此按已确认物理区间分组展示,不虚构 60 个用户侧名称。

OffsetSizeRaw type当前中文语义 / code name状态
+0x004int32 LECountry record identity / RecordIdConfirmed
+0x044int32 LECountry definition ID / CountryDefinitionIdConfirmed
+0x084int32 LE初始资源 0 / InitialResource0Confirmed
+0x0C4int32 LE初始资源 1 / InitialResource1Confirmed
+0x104int32 LE初始资源 2 / InitialResource2Confirmed
+0x144int32 LE初始 controller seed / ControllerSeedRawConfirmed with mode caveat
+0x184int32 LEcamp/faction ID / CampIdConfirmed
+0x1C4int32 LECountry survival/defeat policy type raw / DefeatConditionRawConfirmed participation / Partial enum names
+0x204float32 LECountry HP multiplier / HitPointMultiplierConfirmed
+0x244raw int32+0x20 同构造段读取的 active companion rawUnknown semantic
+0x284uint32 LEpacked RGBA colour / PackedColorConfirmed
+0x2C..+0x3816int32[4]四个 clamped stock/resource valuesPartial names
+0x3C..+0x118224int32[56]technology value tableConfirmed active range / Partial slot semantics
+0x11C4int32 LEdef_strategy.xml base strategy configuration IDConfirmed
+0x1204int32 LEDataSystem-linked technology/group definition ID / TechnologyGroupIdPartial business name
+0x1244int32 LEactive raw integer / Header124RawUnknown semantic
+0x1281uint8active extension byteUnknown semantic
+0x1291uint8active extension byteUnknown semantic
+0x12A1uint8active extension byteUnknown semantic
+0x12B1uint8active extension byteUnknown semantic

上述区间完整覆盖 0x00..0x12B,无空洞。

3. 三种 Country 身份必须分开

BTL/Runtime 中至少存在三个不能混用的 Country 标识域:

text
BtlCountryIndex
CountryRecordId
CountryDefinitionId

BtlCountryIndex

BTL Country section 中的数组位置。Tile owner slot 使用该索引解析初始 owner。

CountryRecordIdCountry +0x00

用于 Event、Strategy 和 runtime record lookup 等记录级引用。

它不是 BTL Country 数组下标。

CountryDefinitionIdCountry +0x04

用于 CountrySettings / definition identity,并参与 Unit 的国家特化 ArmySettings 解析。

这三者在工具 API、编辑器和 Reference 中都不应共用一个模糊的 CountryId 类型。

4. +0x14 ControllerSeedRaw:方向曾被写反

原版 FUN_00488718

text
Runtime Country +0x158 <- bool(BTL Country +0x14 != 0)

而已审计 runtime convention 是:

text
Runtime +0x158 == 0  -> Human
Runtime +0x158 != 0  -> Computer / AI

因此 raw BTL seed 的正确方向是:

text
BTL +0x14 == 0  -> Human seed
BTL +0x14 != 0  -> Computer/AI seed

当前 corpus raw 分布:

text
raw 0 = 1344
raw 1 = 7583

旧 clean-room/报告曾把非零方向写成 Human,该结论已被后续 evidence audit Superseded

另外在部分模式(尤其已恢复的 BattleMode 2/10 上下文)最终玩家国家还会受 mode-specific PlayerCountryID 等状态影响,所以 +0x14初始 controller seed,不应被解释成所有模式下永不变化的最终 controller 身份。

5. +0x18 CampId

当前 8927 条 Country:

text
Camp 0 = 251
Camp 1 = 3730
Camp 2 = 4704
Camp 3 = 242

原版 survival/outcome 与 relation 逻辑直接按该值聚合和分支,因此 camp/faction 是比旧的模糊 sideState 更安全的名称。

当前 corpus 未观察到 Camp 4,不代表其他版本绝对禁止;原版部分 outcome 逻辑会显式排除值 4,这属于 runtime 规则证据而非当前 disk 值域声明。

6. +0x1C Country survival/defeat policy

FUN_00488718 将:

text
BTL Country +0x1C
-> Runtime Country +0x44

FUN_0048B294 再直接按该值选择不同的存活/失败谓词。

当前 corpus:

text
0 = 333
1 = 139
2 = 7668
3 = 697
4 = 7
5 = 44
6 = 10
7 = 29

已经确认:

  • 该字段真实参与 Country defeat/survival determination;
  • value 6/7 会绕过 ordinary natural failure;
  • value 3 使用 camp-wide 特殊谓词,并存在 BattleMode 2/10 例外。

0..7 的全部用户侧显示名称仍未全部闭合,所以 Reference 不从旧编辑器标签直接生成一个看似完整的 enum。

7. +0x20 HP multiplier 与 +0x24 companion

+0x20 已确认是 float32 Country HP multiplier,参与初始 HP scaling。

当前 corpus:

text
18 distinct values
approx 0.1 .. 1.8

+0x24 是活跃的 4-byte companion value,原版与相邻构造状态一起读取,但完整 consumer 尚未闭合。

因此不能把 +0x20..+0x27 整体当一个 64-bit scalar,也不能因为 +0x20 已知就给 +0x24 猜一个倍率名称。

8. +0x28 PackedColor

这是完整 32-bit packed colour,不是玩法 bitfield。

当前 clean-room 显示约定:

text
little-endian value = 0xAABBGGRR

它可以作为颜色值理解,但颜色写入仍应服从当前 writer 产品的独立门禁。

9. +0x2C..+0x38 stock/resource values

原版构造读取四个 32-bit 值并做 clamp/stock 初始化。

当前 Reference 安全名称是:

text
StockValue0
StockValue1
StockValue2
StockValue3

或整体称“四个 clamped stock/resource values”。

在没有逐槽 consumer 证据前,不应因为某些模式表现类似资源,就永久绑定为某四种具体资源名称。

10. +0x3C..+0x118 technology table

物理范围:

text
0x11C - 0x3C = 0xE0 bytes
= 56 * int32

原版会把该区域作为 Country technology values 使用,说明它不是 padding。

但是“第 N 个 int32 对应哪个最终科技效果”的完整逐槽 consumer matrix 尚未全部收敛进本 Reference,所以当前状态为:

text
physical/active range = Confirmed
all per-slot semantics = Partial

文档和工具应保留全部 56 个值,不得只保存当前 UI 暴露的少数科技。

11. +0x11C:不是 Boolean AI behavior

该字段的原版链已经闭合:

text
BTL Country +0x11C
-> FUN_00488718
-> FUN_004A7BE4
-> FUN_003064D0
-> DataSystem table
-> config/def_strategy.xml
-> strategies

所以当前正式名称:

text
def_strategy.xml base strategy configuration ID

社区/旧报告里的“country AI behavior”如果让人理解为 Boolean flag,则过于粗糙。

12. +0x120/+0x124/+0x128..+0x12B

+0x120

原版确认将其作为 DataSystem-linked group/definition 输入;当前代码名 TechnologyGroupId。字段存在和 lookup 关系已确认,但完整 mode/authoring 语义仍需要独立审计,所以 Reference 保持 Partial

当前 corpus:

text
10 distinct values
1..10

+0x124

原版构造会读取的 active int32,完整业务含义未知。

当前 corpus 只观察到两个值,不能据此命名。

+0x128..+0x12B

四个独立 active extension byte。+0x128 当前有非零实例,后三个在当前 corpus 全零,但原版仍主动读取;因此后三个也不能称 padding。

13. 当前 Unknown / Partial backlog

Country 剩余重点:

  1. +0x24 完整 consumer;
  2. 四个 +0x2C..+0x38 stock 值的稳定用户侧名称与全部模式约束;
  3. +0x3C..+0x118 56 个 technology slot 的完整逐槽 consumer;
  4. defeat policy 0..7 的完整、证据化用户侧 enum 名;
  5. +0x120 的最终 definition/group 业务身份和 mode overrides;
  6. +0x124
  7. +0x128..+0x12B 的逐字节语义;
  8. controller seed 在全部 BattleMode 下与最终控制权的组合边界。

这些 Unknown 不影响 0x12C Country 物理记录的完整 round-trip。