From 4a5710ef6549aac8c41620f420365f4c7ce634d4 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 27 Jul 2026 23:09:47 +0000 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=94=B9=E5=AF=AB=20README=20=E7=82=BA?= =?UTF-8?q?=E5=96=AE=E4=B8=80=E7=B9=81=E9=AB=94=E4=B8=AD=E6=96=87=E7=8E=A9?= =?UTF-8?q?=E5=AE=B6=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 合併英文與繁中 README 為單一繁體中文檔案,移除 README.zh-TW.md 與語言切換列 - 以使用者角度重寫:系統需求、快速開始、還原方式、依 UI 分類的功能總覽、 隨附工具與常見問題 - 移除逆向工程細節、內部檔案架構、補丁實作與驗證狀態等內部資訊 - 依現行程式更新功能清單(遊戲加速、治療/復活強化、閒置村民全選、 屍體保留、村民移速等) Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01DH7hXE251YsTayXUobAaRw --- README.md | 243 +++++++++++++++++++++++++++--------------------- README.zh-TW.md | 142 ---------------------------- 2 files changed, 135 insertions(+), 250 deletions(-) delete mode 100644 README.zh-TW.md diff --git a/README.md b/README.md index af02131..cdf9e67 100644 --- a/README.md +++ b/README.md @@ -1,143 +1,170 @@ -[English](README.md) | [繁體中文](README.zh-TW.md) +# Against Rome Modifier(羅馬帝國:黃金版 修改器) + +> [!WARNING] +> 這個修改器仍在測試階段。使用前請務必先備份您的遊戲原始檔案。 + +這是為即時戰略遊戲《Against Rome》(羅馬帝國:黃金版 / 對抗羅馬)製作的修改工具, +可調整人口上限、資源消耗、部隊屬性、無盡模式 AI 等遊戲內容,所有修改都可以還原回原版。 + +修改器本身不含任何遊戲檔案,您必須擁有並安裝正版遊戲後,在程式中選擇遊戲資料夾即可使用。 --- -# Against Rome Modifier +## 系統需求 -> [!WARNING] -> This modifier is still in testing. Please backup your original files before using it. -> (這個修改器還在測試中,如果要使用請將原始的檔案進行備份。) - -This is a Windows Forms modifier for the real-time strategy game *Against Rome*. -It is built with C# on .NET 8. Public builds do not contain original game data; the modifier builds its restore baseline from the user's own installation when an optional local `Backup.zip` is not present. - -## Maintenance Documentation - -- [`TechDoc.md`](TechDoc.md): Current Chinese technical specification (integrates the AI-agent handoff checklist, debugging history, failure cases, and verification steps at the end). -- [`TechDoc_EN.md`](TechDoc_EN.md): Current English technical specification. -- [`docs/reverse-engineering/`](docs/reverse-engineering/README.md): File formats, offsets, patch bytes, evidence, and the local Ghidra workflow. - -## Project Origin & Author's Note +- Windows 10 / 11(64 位元) +- 已安裝《Against Rome》(資料夾內需有 `Against_Rome.exe`) +- 建議先手動複製一份完整的遊戲資料夾作為保險備份 + +## 快速開始 + +1. 下載並解壓縮發行版壓縮檔到任意資料夾(請勿放在遊戲目錄內)。 +2. 執行 `AgainstRomeModifier.exe`,從啟動畫面進入「啟動修改器」。 +3. 確認上方的遊戲路徑;多數情況下程式會自動偵測,若沒有請按「瀏覽…」手動選擇。 +4. 勾選想要的功能,或直接按「所有功能開啟」。 +5. 按「執行修改」套用;完成後可直接按「啟動遊戲」開始遊玩。 + +> 部分功能(例如無盡模式相關修改)只會影響**新開始的對局**,既有存檔不會改變。 + +## 還原原版 + +- **恢復原版 / 全部還原**:把所有被修改的檔案還原回原始狀態。 +- **僅還原兵種屬性**:只還原單位數值,保留其他設定。 +- **僅還原相容性修正**:只還原圖形相容層等系統設定。 +- **僅還原語系設定**:只還原語言檔案。 + +取消勾選某個功能後再按「執行修改」,也可以單獨關閉該功能。 + +--- -The author of this project is a devoted player who loved *Against Rome* many years ago. This tool was created with AI-agent assistance and is maintained as a research and personal modding project. - -## Core Features +## 功能總覽 -- **Maximum-Population Unlock**: Modifies map `team.dat` files, raising the population limit up to 1600 when enabled. -- **Play as Romans in Endless Mode**: From Resource & Combat Upgrades, changes the five endless-map team-0 defaults to Romans and safely patches the endless-only `dlg_volk` selector so every faction flag starts as Roman. Runtime-verified; it affects new games only. Romans have no priest or glory skill tree by original design. -- **Hand Over All Roman Reinforcements**: Standalone feature that releases every Roman reinforcement object from reinforcement-party script mode and hands soldiers, pack horses, and civilians to the village instead of splitting them by unit type. It applies the P8 threshold, P9 zero quota/all-unit fall-through, and release helper atomically. Legacy `EndlessAi.M6`, the former `jnz+92` split, direct-mark states, and the broken opcode-160 helper state migrate automatically to `jz+0` plus the correct opcode-120 helper. Five-map static/integration checks and a fresh endless-game runtime test have passed: the complete reinforcement party is handed to the village and no longer retreats. -- **20x Housing Capacity**: Reversible switch to scale every positive population-building `wohnwer` value in `objdef.dau` by 20x. -- **20 Civilians Per Residential-Tent Click**: Reversible player-only EXE patch that queues up to 20 male or female civilians with one click; successfully runtime-verified in-game. -- **Fill Unit Conversion to 20 Per Click**: Reversible player-only EXE patch that sets the selected villager-to-unit conversion count to 20 with one click, subject to the original cap and available villagers; successfully runtime-verified in-game. -- **10x Construction Speed**: Reversible switch to accelerate construction, upgrades, and repairs in `objdef.dau` by 10x (shortens building build/upgrade times by 10, which automatically boosts the per-second repair rate; successfully runtime-verified in-game). -- **10x Storage Capacity**: Reversible switch to scale storage capacities of Town Halls (`Hau` structures) and Warehouses (`Lag` structures) in `objdef.dau` by 10x (successfully runtime-verified in-game). -- **10x Town Hall HP**: Reversible switch to multiply hit-points (HP) of all Town Halls (`Hau` structures) in `objdef.dau` by 10x (successfully runtime-verified in-game). -- **Endless-Mode AI Ultimate Mode**: Reversible, bounded BCI patches for the five `ENDL_*` maps. The UI applies reinforcement scheduling, defeat cleanup, and settlement respawn atomically as one **Endless Respawn Core**, preventing partial lifecycle configurations; reinforcement size and AI starting resources remain independent difficulty choices. It never uses the previously rejected unconditional gate bypass. See [`endless-mode-ai.md`](docs/reverse-engineering/endless-mode-ai.md) for evidence, legacy migration, and runtime limits. -- **Village Garrison Quota 3x (Experimental)**: A standalone reversible patch for `Dorfverteidigung.bci`. It multiplies the four dynamic ImportantPos-derived squad quotas by three while preserving their ratios and zero values. This is independent of AI Ultimate M1's 20 members per newly produced squad. Static signatures and exact restore are verified; fresh-game runtime and performance verification remain pending, so it is excluded from **Enable All**. -- **Free Construction & Production**: Free construction, production, upgrades, and spell costs through `ress.ini` modification. -- **5x Spell Damage**: Reversible `cl_script.ini` patch for six configured active-spell values; successfully runtime-verified in-game. -- **Unit Stat Editing**: Adjust only HP, damage, VW, AW, sight, and cooldown through `objdef.dau`. Movement speed, attack range, spell radius, and priest sight/casting distance are deliberately owned by the independent experimental modifiers, not by custom troop layers. -- **Entire-Map Vision for All Units**: Sets `Sirad=30000` for every supported unit across all factions; the entire-map vision effect is runtime-verified in game. -- **Other Stat Modifiers**: 3× ranged range (with a built-in accuracy fix — doubled impact radius and zeroed lead-aim scatter so shots still land at the longer range), 2× unit movement, entire-map priest casting distance, 3× spell effect radius, and higher projectile arcs. -- **Centered High Resolution (4:3)**: The native 1920×1080 EXE experiment is disabled because it retained a legacy top-left draw surface. This option restores every experimental EXE site and keeps stock 1600×1200. Centered fullscreen and correctly proportioned windowed output are runtime-verified; it does not stretch or claim 16:9 world-view expansion. -- **Camera Zoom Out +1 (Experimental)**: Uses the first visibly effective native zoom step to show more battlefield. Runtime testing found no visible effect at 0.5, so that state migrates back to +1; the tradeoff is that world units, health bars, and information also become smaller. Selection, edge scrolling, fog, bounds, and mission compatibility still need retesting. -- **Troop Presets & One-Click Control**: `.artroop` exports use the six-field `HP,Dmg,VW,AW,Sight,Relt` format. Legacy nine-field imports remain readable but their removed fields are discarded; Enable All includes the runtime-verified centered-high-resolution and entire-map-unit-vision features. -- **Loss-Focus Background Execution**: Patches `Against_Rome.exe` to allow the game to continue running when it loses focus (is minimized or inactive). -- **Entire Map Construction Range**: Replaces the construction range limit via a synchronized `Against_Rome.exe` setter trampoline, allowing building anywhere on the entire map (successfully runtime-verified in-game, including the red dashed frame). -- **Embedded dgVoodoo2 Integration**: Optional integration that installs the bundled 32-bit D3D8/DirectDraw wrappers from dgVoodoo2 without overwriting existing unmanaged DLLs. -- **Path Auto-Detection**: Automatically detects game directories and supports launching the game with a single click. -- **Save Game Management**: Save backup, restore, and history management. -- **Embedded Technical Documentation**: Built-in viewer for easy documentation reading. -- **Local Reverse-Engineering Workflow**: Retains generated Ghidra function index and pseudocode inventory kept under the ignored `re_workspace/` folder. +### 建設、經濟與人口 -## Playing Romans in Endless Mode +- **最大人口上限 (1600)**:打破人口限制,將全場總人口上限開放至 1,600 人。 +- **人口建築容量提升**:民房與帳篷的人口容量大幅提升,少蓋房屋即可養大軍。 +- **主堡與倉庫容量提升**:城鎮中心與倉庫的資源儲存上限提高 10 倍,資源不再爆倉。 +- **主堡生命值提升**:城鎮中心血量提高 10 倍,更耐打、防偷爆。 +- **建築建造與維修加速**:興建、升級與工匠維修建築的速度加快 10 倍。 +- **建造與生產免費**:蓋建築、維修、生產村民與招募兵種完全不消耗資源。 +- **科技與升級免費**:研發陣型、軍備科技與兵種解鎖完全免費。 +- **全地圖自由建設**:取消村莊建造範圍限制,可在地圖任何角落蓋建築。 -1. Select the game root containing `Against_Rome.exe`. -2. Enable **Play as Romans in Endless Mode** in Resource & Combat Upgrades and apply changes. Enable All includes it. -3. Start a **new** endless game. Any of the three faction flags enters as Romans; no highlighted flag is an expected visual limitation. -4. Uncheck and apply again, or restore, to return new games to their original faction. Existing saves keep their embedded team data. +### 戰鬥與部隊強化 -The original Options `swi_volk` control is a separate player-driven path and can still manually change the faction back to a barbarian one. +- **部隊無限士氣**:士兵士氣永遠滿格,殘血或被包圍也絕不潰逃。 +- **單位跑步不扣血**:部隊急行軍不再因體力消耗而扣血。 +- **待機回血速度提升**:受傷士兵待機時以 10 倍速自動回血,且不消耗食物。 +- **遠程單位射程提升 3 倍**:弓箭手、投石車與弩砲射程提升 3 倍,並內建遠距離命中修正。 +- **單位移動速度提升 2 倍**:所有戰鬥單位(士兵、領袖、祭司)移動速度加倍。 +- **拋射彈道增高 2 倍**:箭矢與投石的弧度更高,更容易越過城牆與樹木命中後方敵軍。 +- **所有單位全地圖視野**:揭開全地圖迷霧,敵我動向一覽無遺。 -## Technical Architecture +### 法術與祭司 -The solution (`AgainstRomeModifier.slnx`) is split into decoupled projects, each producing its own executable or library: +- **祭司與賢者無限法力**:施放神術與復活術零消耗,可連續施法。 +- **法術免除祭壇需求**:只需 1 個祭壇即可使用所有高階神術。 +- **法術傷害提升 5 倍**:所有陣營的攻擊型神術傷害提升 5 倍。 +- **法師施法距離提升至全地圖**:祭司可站在本營向地圖任何位置施法。 +- **法師法術範圍提升 3 倍**:神術的影響半徑與命中範圍擴大為 3 倍。 -- [`src.Launcher/`](src.Launcher/): `AgainstRomeLauncher.exe` — suite entry point that launches the other tools and hosts the technical documentation viewer (`TechDocForm`). -- [`src.Modifier/`](src.Modifier/): `AgainstRomeModifier.exe` — the modifier UI. `ModifierForm` partial classes cover layout, data inspection (backup loading, TGA icon parsing), patch application (feature-toggle map → `PatchProfile` → transactional apply/category restore), presets, and the troop stat preset editor (`TroopPresetForm`). -- [`src.SaveManager/`](src.SaveManager/): `AgainstRomeSaveManager.exe` — save backup, restore, and preview (`SaveManagerForm`). -- [`src.MapEditor/`](src.MapEditor/): `AgainstRomeMapEditor.exe` — map editor, including endless-map clone/delete management. -- [`src.Core/`](src.Core/): `AgainstRome.Core.dll` — the shared modifier core: registry-backed feature definitions (`Core/Features/`), file patchers (`Core/Patches/`), transactional services such as [`PatchEngine.cs`](src.Core/Core/Services/PatchEngine.cs) (FoodHealing and Endless AI share the BCI cache and are committed by one `SaveAll`), [`TroopConfig.cs`](src.Core/Core/TroopConfig.cs) (known unit IDs, categories, field indexes, balance rules), localization, and the embedded `Backup.zip`/dgVoodoo2 payloads. -- [`src.Shared/`](src.Shared/): `AgainstRome.Shared.dll` — lowest-level shared library: [`GameLZSS.cs`](src.Shared/Core/GameLZSS.cs) (game-specific PFIL/LZSS compression), `SafeFileWriter`, `FileRollbackScope`, and the map catalog/clone/delete services (`Maps/`). -- [`tools/publish.ps1`](tools/publish.ps1): Publishes all four executables and packages them into the release ZIP. -- [`tools/Repair-LanguageBackup.ps1`](tools/Repair-LanguageBackup.ps1): Validates and repairs a local language overlay backup after an interrupted or incomplete migration. -- [`docs/reverse-engineering/`](docs/reverse-engineering/): Structured reverse-engineering notes. -- [`data/game_schema.json`](data/game_schema.json): Tool-readable file format and patch metadata. +### 村民與操作便利 -## Embedded Resources +- **村民生產速度最快**:城鎮中心生產與轉換村民的速度加快 10 倍。 +- **村民移動速度提升 5 倍**:村民與馱馬的移動速度提升 5 倍。 +- **住宅帳篷一次生產 20 人**:生產村民按鈕點一下即可排入 20 人。 +- **招募面板一次選滿 20**:村民轉裝備/部隊時點一下直接選滿 20 人。 +- **閒置村民一次全選 999**:一次選取全地圖最多 999 名閒置村民。 -- `Backup.zip` is optional and intentionally not committed to GitHub. -- If `Backup.zip` is embedded (in `AgainstRome.Core.dll`) or placed next to the executable, it is loaded as the restore source. -- If no `Backup.zip` exists, the modifier builds an in-memory backup from the user's selected game installation directory. -- `TechDoc.md` and `TechDoc_EN.md` are embedded in the launcher for the documentation viewer. -- Game payloads are decoded as code page 1251 where required; project documentation is UTF-8. +### 無盡模式(AI 終極戰爭) -## Reverse Engineering Data +- **無盡模式羅馬陣營**:解鎖無盡模式的羅馬陣營,新開局即可以羅馬人入場。 +- **羅馬增援完全移交**:修正羅馬增援抵達後自動撤退的問題,所有增援士兵、平民與馱馬全數留守村莊。 +- **增援兵團擴軍**:電腦 AI 的增援與村莊招募規模提升至每隊滿編 20 人。 +- **AI 無盡重生核心**:修復並加速電腦 AI 的聚落重生與補兵,避免後期不再出兵。 +- **提供開局資源**:開局給予電腦 AI 額外資源,讓電腦更快發展、提高挑戰性。 -The project keeps reverse-engineering notes in [`docs/reverse-engineering/`](docs/reverse-engineering/). The same facts are mirrored in machine-readable form in [`data/game_schema.json`](data/game_schema.json) so future UI and patch code can avoid hardcoded indexes. +### 系統與相容性 -Current coverage: +- **視窗失焦不自動暫停**:切換到其他程式時遊戲不會暫停,可在背景繼續運行。 +- **強制英文語系**:將遊戲介面切換為英文版,可解決字型亂碼或切換語系造成的卡死。 +- **啟用圖形相容修補**:內建 dgVoodoo2 相容層,修復 Windows 10/11 常見的畫面卡頓、低 FPS、視窗化失敗與黑屏。 +- **高解析度置中(4:3)**:提供高解析度顯示並維持原版 4:3 比例置中,畫面不會拉伸變形。 -- `SYSTEM/DATA_MP/DEFAULTS/objdef.dau`: Unit stats and weapon fields. -- `SYSTEM/ress.ini`: Construction, production, upgrade, and spell costs. -- `SYSTEM/cl_script.ini`: Villager delay, spell radius, and morale parameters. -- `MAPS/**/team.dat`: Population limits, player faction, and banner version semantics; Roman Endless changes only team 0 in `ENDL_*` maps to `ROM`. -- `MAPS/ENDL_*/SCRIPT/ak_level.bci`: Bounded AI Ultimate Mode patch; the active-party limit is 8 because the runtime has 20 NPC-job slots. -- `SYSTEM/CLAK/SCRIPT/Dorfverteidigung.bci`: AI Ultimate M1 squad-size patch and the independent Experimental village-garrison quota multiplier. -- `Against_Rome.exe`: Focus-loss patch, runtime-verified village construction-range expansion and Roman Endless selector patch, restore-only handling for the rejected legacy four-site range/red-frame candidate, and a full local Ghidra function inventory. +### 已驗證功能(需手動開啟) -The generated Ghidra output is local research material, not original source. Unknown `FUN_*` functions are not treated as understood until the call path or runtime evidence is documented. +這些功能已實測可用,但不會被「所有功能開啟」自動勾選,請視需要自行開啟: -## Development Environment +- **整體遊戲運行加速**:整體遊戲時脈快進 2~10 倍,加速生產、建造、移動與戰鬥(倍率可調)。 +- **攝影機拉遠**:鏡頭往後拉遠,取得更寬廣的戰場視野(畫面中的單位也會一併縮小)。 -- Language: C# 12 -- Target framework: .NET 8.0 Windows -- UI: Windows Forms -- Platform target: x64 +### 實驗性修改 -## Build Steps +實驗性功能仍在測試,可能不穩定或影響效能,同樣不列入「所有功能開啟」: -1. Install .NET 8.0 SDK and Visual Studio 2022. -2. `Backup.zip` is optional for public builds. Keep it local only if you have one. -3. Open `AgainstRomeModifier.slnx`. -4. Select `Release` and `x64`. -5. Build the solution. Each app's output is under its own project folder, e.g. `src.Modifier/bin/Release/net8.0-windows/`. To produce a release package with all four executables, run `tools/publish.ps1`. +- **自訂兵種屬性平衡與陣營特色**:套用修改器調校的平衡檔,修正原版兵種強弱不均。 +- **將軍特殊技能強化**、**首領榮譽與士氣光環增強**:相關被動與光環效果提升 5 倍。 +- **治療術提升 10 倍**、**法師復活術強化**:強化祭司的治療與復活效果。 +- **村莊駐軍配額倍率**:自由設定電腦 AI 村莊防衛軍團的數量倍率(2~10 倍)。 +- **屍體保留量提高**:戰場屍體回收前可多保留約 450 具,方便塞爾特法師復活。 +- **啟用遊戲運作記錄(除錯)**:在背景記錄電腦 AI 運作日誌,供問題回報時分析,不改變遊戲檔案。 -## Public Build Behavior +### 自訂兵種屬性 -The GitHub repository does not include original game files. Users must own and install *Against Rome*, then select the game folder in the modifier. The modifier uses those local files as the clean restore baseline before applying patches. +在「自訂兵種屬性」頁面可個別調整單位的生命值、傷害、防禦、視野與冷卻時間, +並可透過「修改兵種檔案」匯出/匯入 `.artroop` 設定檔,方便分享或還原自己的配置。 +「當前兵種數值」頁面則會列出原版與目前數值的對照,方便確認修改是否生效。 -The following content is intentionally local-only and covered by `.gitignore`: +--- + +## 其他隨附工具 + +從啟動畫面可以開啟: + +- **存檔管理器**:備份、還原與刪除遊戲存檔,檢視存檔詳細資訊,並可修復舊存檔的無盡模式 AI 排程。 +- **地圖編輯器**:檢視與編輯地圖地形、水面與場景物件,並可複製或刪除無盡模式地圖。 +- **技術文件**:在程式內直接閱讀本專案的技術說明文件。 + +--- + +## 常見問題 + +**遊戲畫面卡頓、黑屏或無法視窗化?** +開啟「啟用圖形相容修補」並執行修改,內建的相容層會直接安裝到遊戲目錄,不需要另外下載。 +關閉此選項並重新套用,或使用「僅還原相容性修正」即可移除。 + +**修改後想玩回原版?** +按「恢復原版」或「全部還原」,修改器會把所有它修改過的檔案還原。若曾手動改過遊戲檔案, +建議直接還原自己的保險備份。 + +**無盡模式的修改沒有生效?** +無盡模式相關功能只影響新開的對局,請重新開始一局新遊戲。 + +**修改器說找不到遊戲路徑?** +請按「瀏覽…」手動選擇包含 `Against_Rome.exe` 的資料夾。 + +--- -- `遊戲原始檔案/`, `Original game archives/`, `Backup.zip`, and extracted game trees such as `MAPS/`, `SYSTEM/`, `SAVE/`, and `ToEng/`. -- `.codex/`, `.agents/`, `re_workspace/`, build output, IDE state, dumps, logs, and private audit handoff files. -- Generated Ghidra inventories and downloaded analysis toolchains. +## 專案起源 -Small reproducible analysis scripts under `tools/re/` are source material and are intentionally published. The bundled dgVoodoo2 files are also intentional: the upstream redistribution terms permit individual files to ship with a game or game mod; see [`ThirdParty/dgVoodoo2/REDISTRIBUTION.md`](ThirdParty/dgVoodoo2/REDISTRIBUTION.md). +本專案的作者是一位多年前熱愛《Against Rome》的忠實玩家,這個工具是在 AI 協助下開發, +並作為個人的研究與模組化(Modding)專案持續維護。 -## Maintenance Tools +## 自行編譯 -- [`tools/Repair-LanguageBackup.ps1`](tools/Repair-LanguageBackup.ps1) — Out-of-band repair for the English language overlay's backup baseline (`.against-rome-modifier-language-backup` inside the game folder). Use it only when the modifier reports a missing or corrupted language backup manifest: it rebuilds the baseline by hashing the active overlay against a clean original game tree. It writes directly into the game install directory, so read the script's validation steps before running. Defaults: `-GamePath 'C:\Program Files (x86)\Against Rome'`; the clean original tree is auto-detected under the repository root. -- `tools/bcitool.py` — Python reader/disassembler for `BCI0` script bytecode. Its PFIL LZSS decompressor is a port of `GameLZSS`; keep the two in sync if the C# algorithm ever changes. +專案以 C# / .NET 8(Windows Forms、x64)開發。安裝 .NET 8.0 SDK 與 Visual Studio 2022 後, +開啟 `AgainstRomeModifier.slnx`,選擇 `Release` + `x64` 進行編譯即可; +若要產生完整的發行包,可執行 `tools/publish.ps1`。 -## dgVoodoo2 Integration +## 第三方元件 -Enable the dgVoodoo2 switch and apply changes to extract the bundled v2.87.3 files directly from the modifier. No network connection or separate download is required. The modifier installs only the x86 `D3D8.dll`, `DDraw.dll`, `dgVoodooCpl.exe`, and `dgVoodoo.conf`. Uncheck the switch and apply, or restore compatibility/all settings, to remove files owned by the modifier. Existing unmanaged DLLs are never overwritten, and a user-edited configuration is kept. +圖形相容功能使用 [dgVoodoo2 v2.87.3](https://github.com/dege-diosg/dgVoodoo2/releases/tag/v2.87.3), +依其[官方分發條款](https://dege.fw.hu/dgVoodoo2/ReadmeGeneral/)隨專案附帶, +詳見 [`ThirdParty/dgVoodoo2/REDISTRIBUTION.md`](ThirdParty/dgVoodoo2/REDISTRIBUTION.md)。 -Upstream source and redistribution terms: -- [dgVoodoo2 v2.87.3 release](https://github.com/dege-diosg/dgVoodoo2/releases/tag/v2.87.3) -- [Official redistribution terms](https://dege.fw.hu/dgVoodoo2/ReadmeGeneral/) +## 免責聲明 -## Disclaimer +本修改器僅供學術交流與個人模組化研究使用,使用者需自行承擔使用風險。 +遊戲的所有智慧財產權均屬於原始版權所有者,請勿散布原始遊戲資源或反編譯後的原始碼。 -This modifier is developed for academic exchange and personal modding research. The intellectual property rights of the game belong to the original rights holders. Do not distribute original game assets or decompiled source code. +授權條款請見 [`LICENSE`](LICENSE)。 diff --git a/README.zh-TW.md b/README.zh-TW.md deleted file mode 100644 index 22cd948..0000000 --- a/README.zh-TW.md +++ /dev/null @@ -1,142 +0,0 @@ -[English](README.md) | [繁體中文](README.zh-TW.md) - ---- - -# Against Rome 修改器 - -> [!WARNING] -> 這個修改器還在測試中,如果要使用請將原始的檔案進行備份。 -> (This modifier is still in testing. Please backup your original files before using it.) - -這是針對即時戰略遊戲《Against Rome》(羅馬帝國:黃金版 / 對抗羅馬)開發的 Windows Forms 修改器。 -本專案基於 C# 與 .NET 8 建置。公開的編譯版本不包含原始遊戲資料;若沒有提供選用的本地 `Backup.zip`,修改器會在首次執行時,從使用者選取的遊戲安裝目錄中自動建立還原基準。 - -## 維護與開發文件 - -- [`TechDoc.md`](TechDoc.md):目前的繁體中文技術規格文件(包含 AI Agent 協作檢核清單、除錯歷史、失敗案例以及文末的驗證步驟)。 -- [`TechDoc_EN.md`](TechDoc_EN.md):目前的英文技術規格文件。 -- [`docs/reverse-engineering/`](docs/reverse-engineering/README.md):檔案格式、偏移量、補丁位元組、實證紀錄以及本地 Ghidra 工作流程。 - -## 專案起源與作者說明 - -本專案的作者是一位多年前熱愛《Against Rome》的忠實玩家。本修改工具是在 AI Agent 的協助下建立,並作為研究與個人模組化(Modding)專案持續維護。 - -## 核心功能 - -- **地圖人口上限解鎖**:修改地圖的 `team.dat` 檔案,啟用後可將人口上限提升至 1600。 -- **無盡模式羅馬陣營**:在「資源與戰鬥升級」啟用後,會將五張無盡地圖的 team 0 預設陣營改為羅馬,並安全修改無盡專用的 `dlg_volk` 選擇流程,讓三面部族旗都以羅馬開局。此功能已實機驗證,只影響新開局;羅馬依原版設計沒有祭司與榮耀技能樹。 -- **羅馬增援完全移交**:獨立功能,讓羅馬增援的士兵、馱馬與平民抵達後全部解除增援隊 script mode 並移交村莊,不再依單位型別分流撤退。底層將 P8 門檻、P9 零配額/全單位 fall-through 及 release helper 原子套用;舊 `EndlessAi.M6`、`jnz+92` 分流、direct-mark 與誤用 opcode 160 的狀態都會自動遷移至 `jz+0` 加正確 opcode-120 helper。五圖靜態/整合測試及新開無盡局實機驗證均已通過,羅馬增援會完整移交村莊且不再撤退。 -- **村莊駐軍配額 3 倍(實驗)**:獨立且可還原地修改 `Dorfverteidigung.bci`,將四類 ImportantPos 動態算出的部隊配額各乘以 3,保留原本比例與 0 值。此功能與 AI Ultimate M1 的「每支新部隊 20 人」互相獨立。靜態簽章、套用與精確還原已驗證;新開局實機與效能仍待確認,因此不納入「所有功能開啟」。 -- **房屋容量 20 倍**:可還原修改,將 `objdef.dau` 中所有正值人口建築的 `wohnwer` 欄位值提升 20 倍。 -- **住宅帳篷一次生產 20 名村民**:可還原、僅影響玩家的 EXE 補丁;男/女生產鈕點一次即可排入最多 20 名村民,已在遊戲內實機驗證。 -- **部隊轉換一次選滿 20 名**:可還原、僅影響玩家的 EXE 補丁;村民轉部隊/裝備時點一次即可把選取數設為 20,仍受原版上限與可用村民數量限制,已在遊戲內實機驗證。 -- **屍體保留量提高(實驗)**:可還原 EXE 補丁,將引擎開始回收最早死亡物件前保留的空槽由 500 降為 50,讓戰場可多保留約 450 個物件;不會完全停用回收,因為固定的 14,000 格物件池仍需給新單位、投射物與存檔流程使用。長時間大型戰役的效能與穩定性仍待遊戲內驗證,因此不納入「所有功能開啟」。 -- **建造速度 10 倍**:可還原修改,縮短 `objdef.dau` 中的建造、升級與維修時間 10 倍(這會自動提升每秒維修率,已在遊戲內實機驗證)。 -- **資源儲存容量 10 倍**:可還原修改,將 `objdef.dau` 中主堡(`Hau`)和倉庫(`Lag`)的資源儲存上限提升 10 倍(已在遊戲內實機驗證)。 -- **主堡生命值 10 倍**:可還原修改,將 `objdef.dau` 中所有主堡(`Hau` 建築)的生命值(HP)提升 10 倍(已在遊戲內實機驗證)。 -- **無盡模式 AI 終極模式**:可還原的五張 `ENDL_*` 地圖 BCI 補丁。現行安全組態是每支軍事增援隊 20 人、重生等待 5 秒、同時活躍隊伍上限 8;保留原始迴圈節奏與兩個聚落清理保護。過去會跳過安全閘的無條件繞過方案已否決且不會再寫入。實證、舊版遷移與 runtime 限制見 [`endless-mode-ai.md`](docs/reverse-engineering/endless-mode-ai.md)。 -- **免費建設與生產**:透過修改 `ress.ini` 實現免費建造、生產、升級與法術消耗。 -- **單位屬性自訂編輯**:透過 `objdef.dau` 僅調整生命值(HP)、傷害、防禦(VW/AW)、視野與冷卻時間。移動速度、攻擊射程、法術半徑與祭司視野/施法距離由獨立的實驗性功能專責,絕不與自訂兵種層混用。 -- **所有單位全地圖視野**:將所有支援單位的 `Sirad` 設為 30000,敵我全陣營一體適用;全地圖視野效果已通過遊戲內實機驗證。 -- **其他屬性功能**:遠程射程 3 倍(內建命中修正:落點傷害半徑加倍+預判散布歸零,避免拉遠射程後打不中)、單位移速 2 倍、祭司全地圖施法距離、法術效果半徑 3 倍與拋射彈道增高。 -- **高解析度置中(4:3)**:原生 1920×1080 EXE 實驗已因全螢幕/視窗化皆只繪製左上舊 surface 而停用。此選項會還原所有實驗位址並保留原版 1600×1200;全螢幕置中、視窗化正常比例皆已實測。不拉伸,也不增加 16:9 世界視野。 -- **攝影機拉遠 +1(實驗性)**:使用遊戲第一個實際有效的原生縮放級距顯示更大戰場。0.5 已實測沒有可見作用,因此會自動遷移回 +1;代價是世界中的單位、血條與資訊也會一起縮小。選取、邊緣捲動、霧區、地圖邊界及任務相容性仍待重新驗證。 -- **兵種預設匯出/匯入與一鍵控制**:`.artroop` 新檔格式固定為六欄 `HP,Dmg,VW,AW,Sight,Relt`。舊九欄檔仍可讀取,但已移除的欄位一定會捨棄;一鍵「所有功能開啟」包含已實機驗證的高解析度置中與所有單位全地圖視野。 -- **失去焦點背景執行**:對 `Against_Rome.exe` 進行補丁,使遊戲在失去焦點(最小化或切換視窗)時仍能繼續執行。 -- **全地圖建造限制消除**:修改 `Against_Rome.exe` 的 setter trampoline,免除村莊建設範圍與紅框限制,允許在整張地圖的任何地方進行建造(已在遊戲內實機驗證,包含紅框範圍)。 -- **內建 dgVoodoo2 整合**:可選的 dgVoodoo2 整合,直接安裝隨附的 32 位元 D3D8/DirectDraw 包裝外掛,且不會覆寫系統中其他非託管的 DLL。 -- **路徑偵測與一鍵啟動**:自動偵測遊戲安裝路徑,並支援在修改器中一鍵啟動遊戲。 -- **遊戲存檔管理**:提供存檔備份、還原與歷史紀錄管理功能。 -- **內建技術規格文件**:可在程式內直接閱讀相關技術文件。 -- **本地逆向工程工作流**:在忽略的 `re_workspace/` 下,保留產生的 Ghidra 函式索引與虛擬碼庫。 - -## 使用無盡模式羅馬陣營 - -1. 在修改器選擇包含 `Against_Rome.exe` 的遊戲根目錄。 -2. 勾選「資源與戰鬥升級」卡片中的「無盡模式羅馬陣營」,再按「執行修改」;「一鍵全開」也會啟用它。 -3. 啟動遊戲並開啟任一無盡模式地圖,建立**新**對局。無盡模式的三面部族旗不論選哪面都會進入羅馬;旗幟高亮可能不顯示選中,屬正常視覺限制。 -4. 要還原原版,取消勾選後再次執行修改或使用還原功能。既有存檔保留其內嵌 team 資料,不會被改成或改回羅馬。 - -選項畫面的 `swi_volk` 若由玩家手動切換,仍可主動改回蠻族;這是原版另一條設定路徑,不在此功能的強制範圍內。 - -## 技術架構 - -方案(`AgainstRomeModifier.slnx`)已拆解為多個獨立專案,各自產出執行檔或函式庫: - -- [`src.Launcher/`](src.Launcher/):`AgainstRomeLauncher.exe` — 套件入口,負責啟動其他工具並內建技術文件檢視器(`TechDocForm`)。 -- [`src.Modifier/`](src.Modifier/):`AgainstRomeModifier.exe` — 修改器主介面。`ModifierForm` partial 類別涵蓋版面配置、數據檢查(備份載入、TGA 圖示解析)、補丁套用(功能開關 → `PatchProfile` → 交易式套用/分類還原)、一鍵預設,以及兵種屬性預設編輯器(`TroopPresetForm`)。 -- [`src.SaveManager/`](src.SaveManager/):`AgainstRomeSaveManager.exe` — 存檔備份、還原與預覽(`SaveManagerForm`)。 -- [`src.MapEditor/`](src.MapEditor/):`AgainstRomeMapEditor.exe` — 地圖編輯器,含無盡地圖複製/刪除管理。 -- [`src.Core/`](src.Core/):`AgainstRome.Core.dll` — 修改器共用核心:以 `FeatureRegistry` 管理的功能定義(`Core/Features/`)、各檔案補丁器(`Core/Patches/`)、交易式服務如 [`PatchEngine.cs`](src.Core/Core/Services/PatchEngine.cs)(FoodHealing 與 Endless AI 共用 BCI 快取並由一次 `SaveAll` 落地)、[`TroopConfig.cs`](src.Core/Core/TroopConfig.cs)(已知單位 ID、分類、欄位索引與平衡規則)、在地化字串,以及內嵌的 `Backup.zip` 與 dgVoodoo2 資源。 -- [`src.Shared/`](src.Shared/):`AgainstRome.Shared.dll` — 最底層共用函式庫:[`GameLZSS.cs`](src.Shared/Core/GameLZSS.cs)(遊戲專用 PFIL/LZSS 壓縮)、`SafeFileWriter`、`FileRollbackScope`,以及地圖目錄/複製/刪除服務(`Maps/`)。 -- [`tools/publish.ps1`](tools/publish.ps1):發佈全部四個執行檔並打包成釋出 ZIP。 -- [`tools/Repair-LanguageBackup.ps1`](tools/Repair-LanguageBackup.ps1):在語言移轉中斷或不完整時,驗證並修復本地語言覆蓋備份基準。 -- [`docs/reverse-engineering/`](docs/reverse-engineering/):結構化的逆向工程筆記。 -- [`data/game_schema.json`](data/game_schema.json):工具可讀取的檔案格式與補丁元數據(Metadata)。 - -## 內建嵌入資源 - -- 本地選用的 `Backup.zip` 檔案依設計不會被提交至 GitHub。 -- 若可執行檔旁存在 `Backup.zip`,或 `AgainstRome.Core.dll` 內嵌有此資源,它將被載入為還原來源。 -- 若不存在 `Backup.zip`,修改器會直接讀取使用者選擇的遊戲目錄中的原始檔案,並在記憶體中建立備份基準。 -- `TechDoc.md` 與 `TechDoc_EN.md` 內嵌於啟動器,供技術文件檢視器使用。 -- 遊戲資源資料在需要時會以 Code Page 1251 (Windows-1251) 解碼;本專案的所有說明文件均採用 UTF-8 編碼。 - -## 逆向工程資料 - -本專案將逆向工程筆記整理在 [`docs/reverse-engineering/`](docs/reverse-engineering/) 目錄下。同時將這些逆向資訊以機器可讀的格式鏡像輸出至 [`data/game_schema.json`](data/game_schema.json),使未來的 UI 與補丁程式碼能避免使用硬編碼(hardcoded)的索引。 - -目前涵蓋的範圍包括: - -- `SYSTEM/DATA_MP/DEFAULTS/objdef.dau`:單位屬性與武器屬性欄位。 -- `SYSTEM/ress.ini`:建築、生產、升級與法術的消耗資源。 -- `SYSTEM/cl_script.ini`:村民生產延遲、法術半徑與士氣參數。 -- `MAPS/**/team.dat`:人口上限、玩家 faction 與 Banner 版本語義;無盡羅馬功能只將 `ENDL_*` 的 team 0 faction 改為 `ROM`。 -- `MAPS/ENDL_*/SCRIPT/ak_level.bci`:受約束的無盡模式 AI 終極模式補丁;因 runtime 只有 20 個 NPC-job slots,同時活躍隊伍上限固定為 8。 -- `Against_Rome.exe`:失去焦點背景執行補丁、已實機驗證的村莊建造範圍與無盡模式羅馬陣營解鎖,以及針對已被捨棄的舊版 4 站點建造/紅框補丁的「僅還原」處理,並包含完整的 Ghidra 本地函式清單。 - -產生的 Ghidra 輸出僅做為本地研究參考,並非原始碼。在沒有明確呼叫路徑或運行期實證支持前,未知的 `FUN_*` 函式將不會被標記為已解析。 - -## 開發環境 - -- 開發語言:C# 12 -- 目標框架:.NET 8.0 Windows -- 使用介面:Windows Forms -- 目標平台:x64 - -## 編譯步驟 - -1. 安裝 .NET 8.0 SDK 與 Visual Studio 2022。 -2. 對於公開版本,`Backup.zip` 為選用項目。若您有此檔案,請將其保留在本地。 -3. 開啟 `AgainstRomeModifier.slnx`。 -4. 選擇編譯組態為 `Release` 且平台為 `x64`。 -5. 進行方案編譯。各程式的輸出位於各自專案資料夾下,例如 `src.Modifier/bin/Release/net8.0-windows/`。若要產生包含全部四個執行檔的釋出包,執行 `tools/publish.ps1`。 - -## 公開版本行為說明 - -本 GitHub 倉庫不包含遊戲的原始檔案。使用者必須擁有並安裝《Against Rome》正版遊戲,並在修改器中選擇遊戲安裝資料夾。修改器會先使用這些本地檔案作為乾淨的還原基準,然後才套用補丁。 - -以下內容依設計僅保留於本地,並已列入 `.gitignore`: - -- `遊戲原始檔案/`、`Original game archives/`、`Backup.zip`,以及解壓縮後的遊戲樹狀目錄(如 `MAPS/`、`SYSTEM/`、`SAVE/` 和 `ToEng/`)。 -- `.codex/`、`.agents/`、`re_workspace/`、建置輸出、IDE 狀態檔、傾印檔(Dumps)、記錄檔(Logs)與私有的審計交接檔案。 -- 產生的 Ghidra 分析資料與下載的分析工具鏈。 - -位於 `tools/re/` 底下的小型可重複分析腳本屬於源始研究材料,依設計會隨專案公開發布。隨附的 dgVoodoo2 檔案亦然:上游的分發條款允許將特定檔案與遊戲或遊戲模組一同發行;詳情請參閱 [`ThirdParty/dgVoodoo2/REDISTRIBUTION.md`](ThirdParty/dgVoodoo2/REDISTRIBUTION.md)。 - -## 維護工具 - -- [`tools/Repair-LanguageBackup.ps1`](tools/Repair-LanguageBackup.ps1):針對英文語言包覆蓋的備份基準(遊戲資料夾內的 `.against-rome-modifier-language-backup`)進行離線修復。僅在修改器回報語言備份指令清單遺失或損壞時使用。它藉由比對乾淨的原始遊戲樹來重新建立該基準。由於此腳本會直接寫入遊戲安裝目錄,執行前請詳閱腳本內的驗證步驟。預設參數:`-GamePath 'C:\Program Files (x86)\Against Rome'`;原始的乾淨檔案樹會自動在倉庫根目錄下偵測。 -- `tools/bcitool.py`:用於讀取與反組譯 `BCI0` 腳本位元組碼的 Python 工具。其內建的 PFIL LZSS 解壓縮器是從 `GameLZSS` 移植而來;若 C# 的壓縮演算法有任何變更,請同步更新此 Python 演算法。 - -## dgVoodoo2 整合說明 - -啟用修改器中的 dgVoodoo2 開關並套用變更,即可直接從修改器中釋放並安裝內建的 v2.87.3 封裝檔案,無需網路連接或額外下載。修改器僅會安裝 32 位元的 `D3D8.dll`、`DDraw.dll`、`dgVoodooCpl.exe` 以及 `dgVoodoo.conf`。取消核取該開關並套用,或點選「還原相容性/所有設定」,即可移除修改器所建立的這些檔案。修改器絕不會覆寫玩家自行放置且未受控的現有 DLL,並會保留使用者自行修改的配置。 - -上游原始碼與分發條款連結: -- [dgVoodoo2 v2.87.3 發行頁面](https://github.com/dege-diosg/dgVoodoo2/releases/tag/v2.87.3) -- [官方分發條款說明](https://dege.fw.hu/dgVoodoo2/ReadmeGeneral/) - -## 免責聲明 - -本修改器僅供學術交流與個人模組化(Modding)研究使用。遊戲的所有智慧財產權均屬於原始版權所有者。請勿散布原始遊戲資源或反編譯後的原始碼。