Repo ↗ · 原始 README ↗ · 文件包(Markdown/授權)
封面參考(原作): Sekiro: Shadows Die Twice · 原作宣傳圖,由 IGDB 提供。圖片版權屬原權利人,供辨識原作使用,不代表此重寫/模組專案的實際畫面。
來源維護者: AKJama · 版本: aa2c806a9f68 · 整理日期: 2026-10-12
文件授權: MIT · LICENSE-APACHE · LICENSE-MIT · 本文形式: README 翻譯
下文為來源 README 的繁中翻譯,由 Kirikirin 使用 AI 輔助整理;功能、完成度與測試結果均為原作者描述,本站未逐項實機驗證。圖片改為來源連結,指令與技術識別保留原文。
sekiro-rs
一個以 Rust 和 Bevy 重新實作的《隻狼:暗影雙死》,可在你自己安裝的遊戲副本上執行。
這是一個供研究用的粉絲專案。
它與 FromSoftware 或 Activision 沒有任何關聯,也未獲其背書。
此儲存庫中沒有任何遊戲檔案,只有程式碼。
若要建置任何東西,你需要自己的《隻狼》副本(Steam,v1.6.0.0),此處的工具會從中在你的機器上產生資料。
運作方式
《隻狼》是資料驅動的,因此本專案不手寫其行為,而是重建引擎並餵入遊戲自身的資料:
| 行為 | 遊戲將其保存在何處 | sekiro-rs 的做法 |
|---|---|---|
| 玩家狀態機(輸入、防禦、格擋、攻擊、跳躍、閃避) | Havok Script 位元組碼(c0000.hks) |
在以 Rust 撰寫的小型 Havok Script VM 中執行 |
| 狀態與動畫選擇 | Havok 行為圖 | 行為圖執行階段 |
| 時序(命中影格、格擋窗口、取消窗口) | TAE 事件 | TAE 執行階段 |
| 數值(傷害、架勢、防禦率、恢復) | PARAM 表 | 由 Paramdex 定義驅動的 Param 讀取器 |
| 動畫 | Havok 曲線壓縮 HKX | 解碼為帶有根運動的取樣片段 |
| 角色 | FLVER、TPF、MTD | 匯出為帶骨骼、帶貼圖的 GLB |
| 關卡 | MSB、地圖元件、Havok 碰撞、邊緣與鉤索邊緣 | 全部十張地圖皆已匯出且可行走 |
| 敵人 AI | Lua 5.0 戰鬥腳本、EMEVD 事件腳本 | 自有的 Lua VM 與目標執行階段;Boss 階段來自地圖的事件 |
| 渲染 | GPARAM 繪製參數、已編譯著色器 | 霧、曝光、色調映射、泛光與調色,皆從遊戲自身的著色器重新實作(docs/SHADERS.md) |
| 引擎端戰鬥規則 | 執行檔 | 透過靜態分析還原,並改寫為原創 Rust(docs/COMBAT-RULES.md) |
狀態
開發中。
目前可執行的內容:
- 戰鬥: 格擋、防禦、雙向架勢、危險攻擊與識破、忍殺(使用遊戲自身的投擲配對與忍殺鏡頭)、死亡與重生。
- Boss 與敵人: 葦名城屋頂的巨型忍者梟(兩個階段、他的道具)、天守閣屋頂的葦名弦一郎(兩次忍殺、巴流交接、他的落雷與雷反)、葦名士兵;遊戲中放置的每個角色都能依 id 載入。
- Boss 大腦: 一個會學習你如何戰鬥並讓 Boss 適應的 AI(
docs/BRAIN.md),適用於梟、弦一郎與士兵。 - 移動: 跑步、衝刺、帶空中控制的跳躍、墊步、蹲下、邊緣懸掛與攀爬、鉤索(弧線、空中與連鎖)、貼牆、游泳與潛水、墜落死亡。
- 世界: 全部十張地圖皆可載入且可行走,包含光照探針、點光源、分層苔蘚與雪材質,以及遊戲的霧、色調映射、泛光與色彩調色。
- 尚未完成: 遊戲的粒子效果(目前使用簡單替代品)、天空穹頂、開始與暫停選單以外的選單、道具、義手忍具與武技、潛行,以及大多數敵人的特殊機制。
詳細狀態見 STATUS.md 與 docs/PROGRESS.md。
建置與執行
需要 Windows、Rust(stable、MSVC,含 Visual Studio C++ 建置工具),以及你自己的 Steam《隻狼》v1.6.0.0 副本。
若遊戲不在預設 Steam 位置,請用 --game <folder> 或 SEKIRO_DIR 環境變數將工具指向你的安裝位置。
擷取只會讀取遊戲資料夾,並將所有內容寫入被 gitignore 的 cache/ 資料夾(總計約 50 GB,請預留空間)。
# 1. Public community reference files (archive keys, file names, param definitions)
./tools/fetch-refs.ps1
# 2. Unpack your install into cache/raw (about 32 GB)
cargo run --release -p sekiro-extract -- unpack
# 3. Params first, then the maps (the character list comes from the maps)
cargo run --release -p sekiro-extract -- params
foreach ($m in 'm10_00_00_00','m11_00_00_00','m11_01_00_00','m11_02_00_00','m13_00_00_00','m15_00_00_00','m17_00_00_00','m20_00_00_00','m25_00_00_00','m89_00_00_99') { cargo run --release -p sekiro-extract -- map $m }
# 4. Characters and animations (defaults to Wolf and every placed character)
cargo run --release -p sekiro-extract -- models
cargo run --release -p sekiro-extract -- anims
# 5. Play
cargo run --release -p sekiro-game
遊玩基準遊戲
不需要帳號、金鑰或模型:這是 FromSoftware 所寫的遊戲,每個敵人都在執行其原版 AI。
不帶參數執行遊戲會開啟開始選單:選擇戰鬥、地點、AI(保持「Lua」,即遊戲自身的 AI)、一天中的時間與無敵模式,然後按 Start。
戰鬥中按 Esc 會開啟暫停選單(繼續、返回開始選單、離開)。
相同的選擇也可作為命令列旗標使用,會跳過選單:
$game = 'target/release/sekiro-rs.exe'
& $game --arena owl --progression castle-roof # Great Shinobi Owl on the castle roof
& $game --arena genichiro --progression castle-roof # Genichiro on the castle keep roof
& $game --arena genichiro --genichiro-phase tomoe # straight to the Way of Tomoe lightning phase
& $game --play --enemy soldier # an Ashina soldier on a flat floor
& $game --play --map m11_00_00_00 --start 3 --no-enemy # walk around a map
實用旗標:--progression castle-roof(狼在遊戲該時間點的攻擊力)、--god(你不會死)、--immortal(你不會死但架勢仍會破)、--hour 0-23(一天中的時間)、--enemy cXXXX(依 id 指定任何角色)。
操作:WASD 移動、滑鼠鏡頭、滑鼠左鍵攻擊、滑鼠右鍵防禦與格擋、Space 跳躍、Shift 墊步(按住衝刺)、C 蹲下、Q 鎖定、E 抓住邊緣或貼牆、F 鉤索、Esc 暫停選單。
遊戲手把也可使用。
Boss 大腦
Boss 大腦以模型驅動的控制器取代 Boss 的招式選擇,該控制器會學習你如何戰鬥並適應,同時 Boss 保留自己的招式、時序與規則。
它只看得到玩家能看到的東西,並且會跨工作階段記住你(記憶儲存在被 gitignore 的 logs/memory/);在我們的測試中,大約 20 場戰鬥後它會變得非常難纏。
它目前支援巨型忍者梟、弦一郎與葦名士兵。
它有兩個部分:
- 教練會檢視你的戰鬥(每場戰鬥後,以及戰鬥中約每 30 秒),並寫出一份作戰計畫。它透過你自己訂閱上的命令列代理執行,因此不需要 API 金鑰。
- 檢查點選擇器(選用)是一個小而快的模型,會在戰鬥中的關鍵時刻切換教練準備好的計畫。它使用 OpenAI API,需要 API 金鑰。
建議設定:Codex 教練加上 OpenAI 檢查點選擇器
- 安裝 Codex CLI 並以你的 ChatGPT 方案登入(
codex login)。
遊戲會以隔離方式啟動它,不帶你其他的 Codex 設定、記憶或專案檔案。 - 選用,用於檢查點選擇器:將
.env.example複製為儲存庫資料夾中的.env,並設定OPENAI_API_KEY。
.env已被 gitignore;切勿提交它。 - 遊玩:
& $game --arena owl --progression castle-roof --brain coach --coach codex --brain-overlay
& $game --arena genichiro --progression castle-roof --brain coach --coach codex --brain-overlay
或在開始選單中選擇「Coach brain」作為 AI。
成本與速度
於 2026 年 10 月 11 日測量:
| 部分 | 透過何者執行 | 每次呼叫的典型時間 | 每次呼叫的典型 token 數 | 由誰付費 |
|---|---|---|---|---|
教練,--coach codex(預設模型 gpt-6.1-sol) |
Codex CLI | 約 5 至 25 秒 | 約 11k 至 19k | 你 ChatGPT 方案的使用量 |
教練,--coach claude |
Claude Code CLI(claude -p) |
約 60 至 120 秒 | 約 96k 至 161k | 你 Claude 方案的使用量 |
教練,--coach api |
OpenAI API | 取決於模型 | 與 Codex 類似 | API 金鑰,計費 |
檢查點選擇器(gpt-6-luna) |
OpenAI Decisions API | 快速,約 100 位元組的請求 | 約 300 | API 金鑰,計費(一場 9 場戰鬥的工作階段約 $0.002) |
Codex 教練是建議選項:在我們的測試中,它是最快且最精簡的。
Claude 教練可用但很慢,因為 CLI 每次呼叫都會載入你整個 Claude Code 設定;如果你偏好它,你自己的編碼代理可以幫你調校。
覆蓋層頁腳(--brain-overlay,F8)會計算當前戰鬥與工作階段的 token 數。
其他大腦選項
--player <name>為每位玩家保留獨立的設定檔(Boss 的一般知識是共用的;它對你學到的東西屬於你)。--brain-memory off在讀寫記憶的情況下遊玩。--brain-stage lua|early|alive|outsmarted重播梟學習的已儲存階段,用於比較與錄影。--brain-token-budget N在 N 個 token 後停止模型呼叫,並回退到 Boss 自身的 AI;--brain-budget USD對計費的 API 花費做同樣的事。
詳細資訊,包括計畫、檢查點與記憶如何運作:docs/BRAIN.md。
版面配置
crates/formats:遊戲格式的讀取器。crates/extract:sekiro-extract,將你的安裝轉換為cache/。crates/hks:Havok Script VM。crates/sim:不依賴 Bevy 的模擬(行為圖、TAE、輸入、身體、戰鬥)。crates/game:sekiro-rsBevy 應用程式。docs/:格式、參數、玩家腳本介面與戰鬥規則,以我們自己的文字撰寫。
已測試的設定
Windows 11 64 位元、Steam《隻狼》app 814380、build 5794815(遊戲版本 1.6.0.0)、Rust 1.99(MSVC)、Bevy 0.19.1。
其他遊戲版本未經測試。
研究界線
格式與引擎研究在本機、被 gitignore 的資料夾(cache/ 與 re/)中進行,且從不提交。
這包括擷取的遊戲資料、分析資料庫與任何反編譯器輸出。
此儲存庫中的 Rust 程式碼是原創的,根據該研究與公開社群文件撰寫;沒有任何遊戲程式碼被載入、連結或複製到其中。
引擎端規則以我們自己的文字記錄於 docs/,並附有信賴度標籤。
這是一個 AI 輔助專案,以 Anthropic Claude Code 與 OpenAI Codex 開發,並由作者審閱與遊玩測試。
免責聲明
sekiro-rs 是一個非官方、非商業的粉絲專案,為遊戲引擎設計與互通性的教育與研究而製作。
它與 FromSoftware, Inc. 或 Activision Publishing, Inc. 沒有任何關聯,也未獲其背書或贊助。
《隻狼:暗影雙死》及其所有內容,包括角色、模型、貼圖、動畫、音訊、資料與商標,均屬於 FromSoftware, Inc. 及其發行商。
這些內容均未包含在本儲存庫中或隨其散布。
本儲存庫僅包含為本專案撰寫的原創原始碼與文件。
- 你需要自己合法購買的遊戲副本;工具會在本機讀取它,且從不修改安裝或存檔。
- 所有衍生自遊戲的內容都留在你機器上被 gitignore 的
cache/與re/資料夾中。請勿提交、上傳或分享這些資料夾或其中產生的任何內容。 - 本專案僅限單人遊玩。它沒有線上功能,也不會與線上服務或反作弊系統互動。
- 不提供任何保固;使用風險自負。
如果你是權利持有人且對本專案有疑慮,請開啟一個 issue,將會迅速處理。
本專案所建基的社群研究見 CREDITS.md。
依你的選擇,以 MIT 或 Apache-2.0 其中一種授權。
授權與來源聲明
原始 README 與翻譯沿用 MIT 授權;本次修改為繁中翻譯、連結與排版調整。可修改的 Markdown、原始 README、LICENSE 與 NOTICE 收錄於頂部文件包。原作遊戲內容與商標不因此獲得授權。
LICENSE-APACHE
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
LICENSE-MIT
MIT License
Copyright (c) 2026 AKJama
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

評論
…