Map unit and Help:Creating mods: Difference between pages

From ZeldaMods (Breath of the Wild)
(Difference between pages)
Jump to navigation Jump to search
imported>Leoetlino
 
imported>BravelyPeculiar
 
Line 1: Line 1:
{{Stub|what=Complete the contents section, the link system, mention static vs dynamic (and possibly other things)}}
Welcome, modders! This page is intended to be a collection of useful information for anybody who wants to create mods. If you want to simply use other people's mods, see [[Help:Playing with mods]].


== Contents ==
== Getting set up ==
To make mods, you'll need to start by dumping the unedited game files from your copy of BotW.
* [[Help:Playing with mods#Wii U/Cemu|Dumping the game files (Wii U)]]
* [[Help:Dumping games|Dumping the game files (Switch)]]


=== <code>LocationPosX</code> ===
== Files, Tools and Tutorials ==
Since BotW uses a lot of Nintendo's own file formats, you'll need tools to be able to edit them. To use leoetlino's tools, you need to install the latest version of Python (64 bit version), and tick the "Add to PATH" / "Add to environment variables" box in the installer. Then, to install the tool, run <code>pip install TOOL_NAME</code> in the command line.


=== <code>LocationPosZ</code> ===
If you're not sure which tool to use on a file, search for its extension on this wiki to find what file format that extension is used for.


=== <code>LocationSize</code> ===
=== Yaz0 compression ===
Many files in the game are compressed with [[Yaz0]] compression. Compressed files generally have the letter <code>s</code> prefixed to their file extension. To decompress and recompress these files, use '''wszst''' (install with <code>pip install wszst-yaz0</code>).
* <code>wszst decompress INPUT_FILE.sbactorpack OUTPUT_FILE.bactorpack</code>
* <code>wszst compress INPUT_FILE.bfres OUTPUT_FILE.sbfres</code>


=== <code>Objs</code> ===
=== SARC archives ===
Array of object structures. '''Must be sorted by HashId'''<ref>Technically, sorting is only required for Dynamic (non-group 0) map units. However, not sorting causes the game to fall back to a slower linear search.</ref> because the placement subsystem performs binary searches on the object array in various cases<ref>0x7101256E14</ref>.
[[SARC]] archives contain collections of other files and folders, like .zip folders. Unpack, edit and re-pack them with leoetlino's [https://pypi.org/project/sarc/ <code>sarc</code> tool]. This tool automatically decompresses Yaz0-encoded archives, and re-compresses them when you repack if the extension starts with an <code>s</code>.
* <code>sarc extract INPUT_FILE.pack</code>
* <code>sarc create [-b] INPUT_FOLDER OUTPUT_FILE.sbactorpack</code> (Use <code>-b</code>for Wii U only).


=== <code>Rails</code> ===
=== BYML files ===
Array of rail structures. Can only appear in group 0 maps (Static); this section is completely ignored for non-static map units.
[[BYML]] files contain game parameters. Convert them to an editable format (and back) with leoetlino's [https://pypi.org/project/byml/ <code>byml</code> tool]. This tool automatically decompresses Yaz0-encoded files, and re-compresses them if the extension starts with an <code>s</code>.
* <code>byml_to_yml INPUT_FILE.byml OUTPUT_FILE.yml</code>
* <code>yml_to_byml [-b] INPUT_FILE.yml OUTPUT_FILE.sbyml</code> (Use <code>-b</code> for Wii U only).


== Link system ==
=== AAMP files ===
Map objects can be linked to other objects (up to 255 in a single group<ref>"一つの生成グループに 255 以上のアクタが指定されています。テストで無ければプログラマに相談"</ref>). These links allow implementing custom logic and callbacks (for example, DeadUp signals the destination object when the source object dies).
[[AAMP]] files also contain game parameters. Convert them to an editable format (and back) with leoetlino's [https://pypi.org/project/aamp/ <code>aamp</code> tool]. Unlike most other files, AAMP files are exactly the same on both Wii U and Switch.
* <code>aamp_to_yml INPUT_FILE.bxml OUTPUT_FILE.yml</code>
* <code>yml_to_aamp INPUT_FILE.yml OUTPUT_FILE.bgparamlist</code>


===Definitions===
=== BFRES files ===
{|class="wikitable sortable"
[[BFRES]] files contain the game's models and textures. Tutorials on how to edit these for Wii U can be found in [https://drive.google.com/drive/folders/1Z1_A3w0VvPHp22H_Yh_dSdzI5hr4OAv9 Fooni's Tutorials].
! ID !! Name !! Description !! Official description
* <code>.sbfres</code> files contain models.
|-
* <code>.Tex1.sbfres</code> files contain textures (Wii U).
| 4 || -AxisX || - || マイナスX軸シグナル
* <code>.Tex2.sbfres</code> files contain mipmaps for textures (Wii U). Since we can't edit these on Wii U yet, they need to be disabled.
|-
* <code>.Tex.sbfres</code> files contain both textures and mipmaps (Switch). Unlike on Wii U, mipmaps don't cause any problems here.
| 5 || -AxisY || - || マイナスY軸シグナル
|-
| 6 || -AxisZ || - || マイナスZ軸シグナル
|-
| 24 || AreaCol || - || エリア(センサ)指定
|-
| 1 || AxisX || - || X軸シグナル
|-
| 2 || AxisY || - || Y軸シグナル
|-
| 3 || AxisZ || - || Z軸シグナル
|-
| 37 || BAndSCs || - || ボール&ソケットCS
|-
| 38 || BAndSLimitAngYCs || - || Y角速度制限付ボール&ソケットCS
|-
| 0 || BasicSig || - || 基本シグナル
|-
| 9 || BasicSigOnOnly || - || オンのみ基本シグナル
|-
| 14 || ChangeAtnSig || - || アテンション変更時シグナル
|-
| 39 || CogWheelCs || - || 歯車CS
|-
| 21 || CopyWaitRevival || Use the destination object's revival flag || 配置自動セーブ継承
|-
| 15 || Create || - || 生成
|-
| 11 || DeadUp || - || 死んだらオン
|-
| 16 || Delete || - || 削除
|-
| 29 || DemoMember || - || デモ参加
|-
| 32 || FixedCs || - || 固定CS
|-
| 26 || ForSale || - || 売り物
|-
| 19 || ForbidAttention || - || アテンションタイプ変更
|-
| 18 || Freeze || - || 凍結
|-
| 7 || GimmickSuccess || - || ネタ成功シグナル
|-
| 33 || HingeCs || - || ヒンジCS
|-
| 12 || LifeZero || - || ライフ0
|-
| 34 || LimitHingeCs || - || 制限付ヒンジCS
|-
| 27 || ModelBind || - || モデルバインド
|-
| 17 || MtxCopyCreate || - || 位置継承生成
|-
| 22 || OffWaitRevival || - || 配置自動セーブオフ
|-
| 30 || PhysSystemGroup || - || 物理システムグループ
|-
| 28 || PlacementLOD || - || 配置LOD
|-
| 36 || PulleyCs || - || 滑車CS
|-
| 40 || RackAndPinionCs || - || ラック&ピニオンCS
|-
| 23 || Recreate || - || 再生成
|-
| 41 || Reference || - || 参照
|-
| 10 || Remains || - || 遺物シグナル
|-
| 25 || SensorBind || - || センサバインド
|-
| 35 || SliderCs || - || スライダーCS
|-
| 13 || Stable || - || 安定
|-
| 31 || StackLink || - || スタック
|-
| 20 || SyncLink || - || 生成グループ
|-
| 8 || VelocityControl || - || 速度制御シグナル
|-
|}


== File formats ==
== Rules ==


=== Map unit binary ===
=== The RSTB file ===
In ''Breath of the Wild'', map units are stored in a binary format and given the ''mubin'' (Map Unit Binary) file extension. All map object IDs are replaced with CRC32 hashes as a space optimisation. [[BYML]] is used as the serialisation format.
The file [[ResourceSizeTable.product.rsizetable]] (referred to as the RSTB file) contains a list of size limits for almost every file in the game (calculated from the non-Yaz0-compressed file sizes). If you edit a file to make its filesize bigger, you'll need to edit this file to prevent errors. For details, see [[Help:Editing the RSTB]].


=== Source map unit ===
=== File names and caching ===
Source map units have muunt<ref>The executable has remnants of functions that can load map units with the following path: <code>Map/Project/%s/Data/%s/%s.muunt</code> (in what appears to be development code)</ref> as their file extension and use strings for map object IDs such as <code>F-5_challenge.muunt/obj760</code> instead of CRC32 hashes of the IDs in map unit binaries.
The game assumes that any 2 files with the exact same filename also have the exact same contents. If you don't follow this rule when editing files, the game might load the wrong version of the file, leading to errors.
[[Category:Internals]]
<references />
[[Category:File formats]]

Revision as of 15:56, 15 October 2018

Welcome, modders! This page is intended to be a collection of useful information for anybody who wants to create mods. If you want to simply use other people's mods, see Help:Using mods.

Getting set up

To make mods, you'll need to start by dumping the unedited game files from your copy of BotW.

Files, Tools and Tutorials

Since BotW uses a lot of Nintendo's own file formats, you'll need tools to be able to edit them. To use leoetlino's tools, you need to install the latest version of Python (64 bit version), and tick the "Add to PATH" / "Add to environment variables" box in the installer. Then, to install the tool, run pip install TOOL_NAME in the command line.

If you're not sure which tool to use on a file, search for its extension on this wiki to find what file format that extension is used for.

Yaz0 compression

Many files in the game are compressed with Yaz0 compression. Compressed files generally have the letter s prefixed to their file extension. To decompress and recompress these files, use wszst (install with pip install wszst-yaz0).

  • wszst decompress INPUT_FILE.sbactorpack OUTPUT_FILE.bactorpack
  • wszst compress INPUT_FILE.bfres OUTPUT_FILE.sbfres

SARC archives

SARC archives contain collections of other files and folders, like .zip folders. Unpack, edit and re-pack them with leoetlino's sarc tool. This tool automatically decompresses Yaz0-encoded archives, and re-compresses them when you repack if the extension starts with an s.

  • sarc extract INPUT_FILE.pack
  • sarc create [-b] INPUT_FOLDER OUTPUT_FILE.sbactorpack (Use -bfor Wii U only).

BYML files

BYML files contain game parameters. Convert them to an editable format (and back) with leoetlino's byml tool. This tool automatically decompresses Yaz0-encoded files, and re-compresses them if the extension starts with an s.

  • byml_to_yml INPUT_FILE.byml OUTPUT_FILE.yml
  • yml_to_byml [-b] INPUT_FILE.yml OUTPUT_FILE.sbyml (Use -b for Wii U only).

AAMP files

AAMP files also contain game parameters. Convert them to an editable format (and back) with leoetlino's aamp tool. Unlike most other files, AAMP files are exactly the same on both Wii U and Switch.

  • aamp_to_yml INPUT_FILE.bxml OUTPUT_FILE.yml
  • yml_to_aamp INPUT_FILE.yml OUTPUT_FILE.bgparamlist

BFRES files

BFRES files contain the game's models and textures. Tutorials on how to edit these for Wii U can be found in Fooni's Tutorials.

  • .sbfres files contain models.
  • .Tex1.sbfres files contain textures (Wii U).
  • .Tex2.sbfres files contain mipmaps for textures (Wii U). Since we can't edit these on Wii U yet, they need to be disabled.
  • .Tex.sbfres files contain both textures and mipmaps (Switch). Unlike on Wii U, mipmaps don't cause any problems here.

Rules

The RSTB file

The file ResourceSizeTable.product.rsizetable (referred to as the RSTB file) contains a list of size limits for almost every file in the game (calculated from the non-Yaz0-compressed file sizes). If you edit a file to make its filesize bigger, you'll need to edit this file to prevent errors. For details, see Help:Editing the RSTB.

File names and caching

The game assumes that any 2 files with the exact same filename also have the exact same contents. If you don't follow this rule when editing files, the game might load the wrong version of the file, leading to errors.