Software for creating Master Duel mods:
- AssetStudioMod v0.18.0 by aelurum (free, doesn't display shaders)
- AssetStudio_Tuanjie v1.3.0 (free, can't load the file data.unity3d)
- UABEA - seventh release (free) or UnityEx (paid)
- Any free image editor like GIMP/MS Paint/Paint 3D or Adobe Photoshop (paid)
- DDS plugin for Adobe Photoshop (only necessary if you want to use UnityEX)
Guide:
First you'll have to find the game files with the graphics you want to edit, which are located in these two directories:
C:\Program Files (x86)\Steam\SteamApps\common\Yu-Gi-Oh! Master Duel\LocalData\0000
C:\Program Files (x86)\Steam\SteamApps\common\Yu-Gi-Oh! Master Duel\masterduel_Data
The C:\Program Files (x86)\Steam part can differ if you changed the path manually. The first folder contains most of the game files. The second one contains basic game files and the ones from the tutorial. You can find the exact Unity file name of card artworks, sleeve/protector images, wallpapers and more in this spreadsheet.
If you have a card ID that's not in the spreadsheet and want to know the corresponding name, you can look up the card ID here (it's in the address bar after "cid=" if you are on the page of a specific card).
If you want to edit other graphics, you can find them with the app AssetStudio which can load whole folders at once. You can do that by clicking on File and Load Folder in the menu bar. Please note that this can take a few minutes due to the large number of files, and it initially eats up more than 17 GB of RAM for the first folder on my PC, so if you have less RAM, the rest will likely be automatically loaded into the page file on your PC which takes even longer.
You can also just load the newest files into Asset Studio. To find them you can use the app Total Commander and follow these steps:
- Go to the folder "...\Yu-Gi-Oh! Master Duel\LocalData\????????\0000"
- Press [Alt] + [F7] to search.
- Go to the Advanced tab.
- Tick the option "Date between:" and enter the date of the day the latest update was downloaded in the box to the right.
- Tick the option "Attributes" and untick the attribute "Directory" to exclude folders from the search.
- Click the "Start search" button.
- Click the "Feed to list box" button after the search process has finished.
- Press [×] on the numpad to select all files.
- Drag'n'drop the files into Asset Studio.
When AssetStudio has loaded the files, click on Filter Type and Texture2D in the menu bar, then switch to the Asset List tab.
The card artworks are in one of these containers:
assets/ressources/card/images/illust/common/
assets/ressources/card/images/illust/ocg/
assets/ressources/card/images/illust/tcg/
- common: contains card artworks that are the same in all language versions
- ocg: contains card artworks for the mostly uncensored Japanese version
- tcg: contains altered card artworks for all other language versions.
To find a specific card artwork, enter its card ID in the Filter bar and press [Enter]. To find the ID for the card you're looking for, you can look in the spreadsheet linked above or on this website. There you can enter the card name in the Enter Keyword field, press [Enter] and click on a card. The card ID is then displayed in the URL bar after "cid=".
In the Asset List tab of AssetStudio you can right-click on a file and select Show original file which shows the file in Windows Explorer.
If you found the right file and use UABEA:
- In Windows Explorer, make a backup of the file in a different folder. This step is optional, but better safe than sorry.
- Make a copy of the original file in the same folder by selecting it and pressing [Ctrl] + [C] and then [Ctrl] + [V] on your keyboard, or use the right-click context menu for that.
- Open the app UABEA.
- Click File → Open and open the copy of the file you want to edit, or drag'n'drop it into UABEA.
- If the file is compressed, UABEA will ask you to decompress the file, in this case click the Memory button.
- If you opened a copy of the file data.unity3d in step 4, click on the drop-down menu that initially says globalgamemanagers and select resources.assets.
- Click the Info button to open the Assets info window.
- Select the row with the Texture2D type.
- Click Plugins, select Edit texture and click OK.
- Optional step for best quality but larger file size: Change the Texture format to RGB24 for graphics without transparency (e. g. card illustrations or sleeves/protectors) or to RGBA32 for graphics with transparency (e. g. wallpapers).
- Click Load, open the image file you want to replace the original image with and click Save.
- Optional steps if you want to change the brightness (light power) of protectors/sleeves:
- Select the row with the Material type. (Note: It only exists in one of the two sleeve files.)
- Click the Export Dump button and save the text file
- Open the text file with a text editor and search for LightPower.
- One line below you can change its value after float second =. You should set the value between 0 and 0,1. Any higher value may look too bright in game. You can find all default LightPower values in the spreadsheet linked above.
- Save the text file and switch back to UABEA.
- Make sure the row with the Material type is still selected, click the Import Dump button and open the text file you just edited.
- End of optional steps
- Back in the Assets info window click File and Save. After that close this window.
- In the UABEA main window click File and Save as....
- Select the file with the original name and click Yes when the app asks you to overwrite.
- Optional steps if you want to compress the file to save disk space (doesn't work for the data.unity3d file):
- In the UABEA main window click File → Close → File → Open and open the file with the original name.
- Click File → Compress.
- Enter a different file name for the output file and click Save.
- Choose your desired compression method.
- Copy the name of the original file to the clipboard and delete the file.
- Rename the output file from step 26 to the original file name from the clipboard.
If you found the right file and use UnityEx:
- Make a backup of the file.
- Open the app UnityEx.
- Drag and drop the file into UnityEx.
- Right-click any of the files and chose Export → Export all textures.
- In Windows Explorer, open the folder Unity_Assets_Files in the same directory and all subsequent folders until you're in the Textures folder.
- Open the DDS file with Adobe Photoshop (DDS plugin needed, see links above), edit it to your liking and save it.
- In the NVIDIA Texture Tools Exporter window, you can use these options for the highest quality. For non-transparent textures like card artworks and sleeves/protectors you can set the Format to 8.8.8 BGR 24 bpp | unsigned to save disk space.
- After choosing the options, click the Save button in the bottom right. The NVIDIA Texture Tools Exporter remembers its settings so you don't have to check them every time.
- Switch back to UnityEx.
- Optional steps if you want to change the brightness (light power) of protectors/sleeves:
- Select the row with the name PMat.mat. It should be highlighted now.
- Click the button RawToDumpXML.
- In the Windows Explorer window from step 5, go up one folder. You should be in a folder that starts with CAB-. Now open the Dump folder.
- Open the file PMat.mat.xml with a text editor and search for LightPower.
- One line below you can change its value after value=". You should set the value between 0 and 0,1. Any higher value may look too bright in game. You can find all default LightPower values in the spreadsheet linked above.
- Save the file and switch back to UnityEx.
- Make sure the row with the Material type is still selected and click the button DumpXMLToRaw.
- End of optional steps
- Import the edited file(s) by clicking on the Import files button. This should only take a few seconds. After that you'll be able to see the edited graphic in game if you did everything correctly.
Batch exporting/importing files with UnityEx:
- Download the archive from the third link with "bat" in it from the UnityEx thread and extract it.
- In the batch files you want to use for Master Duel you need to insert the three characters ;*. after *.unity3d because most of the Unity files of Master Duel don't have a file extension.
- Also, you need to add the UnityEx directory to your PATH Environment Variables for the batch files to work.
- Copy the batch files you need to the directory with the game files you want to edit.
- Run the respective bat file to do a batch import/export. For the card illustrations, sleeves (protectors) and any other graphics you need the textures batch files.
Replacing Duel Fields, Field Parts (graveyards) and Mate's Bases:
To do this, you just need to rename files. I listed them all in the spreadsheet linked above. The Qliphort duel field is called "Spellbook Star Hall" and the Lightsworn/Duelist Cup one "Colosseum" in game and in my spreadsheet.
For example, if you want to change the duel field "World Legacy Ruins" to the "Spellbook Star Hall" one, do the following:
- Make a copy of the Spellbook Star Hall files 61140db1 and 9e59c7e8 in the directory \Yu-Gi-Oh! Master Duel\LocalData\????????\0000\.
- Rename the copy of the file 61140db1 to b57af26f.
- Rename the copy of the file 9e59c7e8 to 4b96fb8b.
- Make a backup of the original World Legacy Ruins files b57af26f and 4b96fb8b.
- Copy the renamed Spellbook Star Hall files to the locations of the original World Legacy Ruins files and overwrite them.
Python scripts for processing CARD_*, DLG_* and WORD_* TextAssets from the data.unity3d file or ".\LocalData\????????\0000" folder:
Python scripts for processing the CARD files on GitHub
Additional info:
- The CARD_Name files contain all card names in a specific language.
- The CARD_Desc files contain all card descriptions like effects and flavor text in a specific language.
- The CARD_Indx files contain the 4-byte hexadecimal offsets of the card names and descriptions in their respective files in little-endian byte order. The offset of the the first card name "Insect Monster Token" (ID: 3900) in the CARD_Name file is at the offset 0x08 and the first card description in the CARD_Desc file is at offset 0x0C. The offset of the the second card name "Kuriboh Token" (ID: 3901) is at offset 0x10 and so on.
- All 3 files mentioned above are sorted by card ID.
- The Card_Pidx files contain the IDs of the first card effect of each card (2 bytes) for the Card_Part files in little-endian byte order, followed by 0x00, then a single digit for the number of regular card effects, and the last digit indicates the number of Pendulum effects, which results in 4 bytes for each card. If a card doesn't have any effects, all of the 4 bytes are 0x00. The first card effect ID is at offset 0x04.
- The Card_Part files contain the start and end offset differences of each effect in the CARD_Desc files in relation to the card description offset in the CARD_Indx file. The offset differences are 2 bytes in size each. The first card effect start offset difference is at file offset 0x04.
- The CARD_Prop files contain info about the properties of each card which are stored in 8 bytes per card. The first 2 bytes are the card ID in little-endian byte order. The 3rd byte determines the card type and partially the attribute:
0x00 - Fire attribute
0x40 - Light/Earth attribute
0x80 - Dark/Wind attribute
0xC0 - Water/Divine attribute
0x0D – Spell
0x4E – Trap
+0x00 – Normal monster
+0x01 – Effect
+0x02 – Fusion/Normal
+0x03 – Fusion/Effect
+0x04 – Ritual/Normal
+0x05 – Ritual/Effect
+0x07 – Effect/Spirit
+0x08 – Effect/Union
+0x09 – Effect/Gemini
+0x0A – Token/Normal
+0x0F – Tuner/Normal
+0x10 – Tuner/Effect
+0x11 – Synchro/Normal
+0x12 – Synchro/Effect
+0x13 – Synchro/Tuner/Effect
+0x16 – Xyz/Normal
+0x17 – Xyz/Effect
+0x18 – Flip/Effect
+0x19 – Pendulum/Normal
+0x1A – Pendulum/Effect
+0x1B – Effect/Nomi
+0x1C – Toon/Effect
+0x1D – Effect/Spirit/Nomi
+0x1E – Tuner/Effect/Nomi
+0x20 – Flip/Tuner/Effect
+0x21 – Pendulum/Effect/Tuner
+0x22 – Xyz/Pendulum/Effect
+0x23 – Pendulum/Flip/Effect
+0x24 – Synchro/Pendulum/Effect
+0x25 – Union/Tuner/Effect
+0x26 – Ritual/Spirit/Effect
+0x27 – Fusion/Tuner/Normal
+0x28 – Pendulum/Effect/Nomi
+0x29 – Fusion/Pendulum/Effect
+0x2A – Link/Normal
+0x2B – Link/Effect
+0x2C – Pendulum/Tuner/Normal
+0x2D – Pendulum/Spirit/Effect
+0x2F – Ritual/Tuner/Effect
+0x30 – Fusion/Tuner/Effect
+0x31 – Token/Tuner/Normal
+0x34 – Ritual/Pendulum/Effect
- The DLG_Text file contains contains all in-duel text, like "Chain another card or effect?"
- The WORD_Text file contains all card types, spell and trap types, and monster types and attributes.
- There are also *_Indx files which belong to the two files above which should contain the start offsets for each line.
Location of the CARD_* files used by the game in the game's folder:
Path: .\LocalData\????????\0000
You can find the filenames in my spreadsheet here.
Exporting the above files with Asset Studio:
- Load the files by using drag'n'drop or File → Load File or Load Folder.
- Click on the Asset List tab.
- Click on Filter Type → TextAsset.
- Select the files you want to export, then right-click one of them.
- Select Export selected assets.
- Choose a location and click on Select folder.
Importing the above files with UABEA:
- Create a backup of the original file you want to modify.
- Load the original file into UABEA by using drag'n'drop or File → Open, then click on Memory.
- Click on Info.
- In the Assets Info window, select the row with the TextAsset type.
- Click on Plugins → Import .txt → Ok.
- Enter an asterisk (*) in the file name box and press [Enter] to display all files of all types, or use the drop down box to the right.
- Select the CARD_Desc, CARD_Indx, or CARD_Name file, depending on the file you opened in step 1.
- Click on File → Save → OK.
- Close the Assets Info window.
- Click on File → Save.
- Repeat steps 1 to 10 for the other files that were modified. The CARD_Indx file is always modified when you change anything in the CARD_Desc or CARD_Name files.
Decrypting IDS_* TextAssets
This can be done with QuickBMS and the Yugioh Ydlz script.
IDS files overview:
- IDS_ITEM contains the names of all accessories and other items and item categories.
- IDS_ITEMDESC contains the descriptions of all accessories and other items.
- IDS_SYS contains, among other things, the text written on top of card attributes, like "Fire".
Local save files:
- Game settings: .\LocalSave\<Your account ID>\0000\65\65113b5
- Login info: .\LocalSave\<Your account ID>\0000\e2\e2264531
Related links:
- Discord server "Requiem" with Master Duel modding channel
- Floowandereeze and modding app for replacing sleeves, card art, icons, home art and most fields through a simple user interface
- Modding guide by SethPDA
- Modding guide with videos by RochesteDorm on his Discord server
- Modding tutorial videos
- Monster animation modding guide by mystification, first posted here
- How to replace any card's animation with any other card's
- How To Loop Music Mods Correctly
- Mod/Code for improving card text readability
- Unity modding tools collection
- UnityPy for handling Unity files
- UnityPy script/guide for improving the in-game quality of sleeves with mipmaps by FoodUnderKeyboard
- Unity game hacking guide
340 comments
I have a question on how to use QuickBMS and the Yugioh Ydlz script to decrypt TextAssets.
modding of Evil★Twin Ki-sikil's second animation worked fine, by changing the 2D_texture, Atlas and JS.
Also, I already made a mod that replaces the SR original art with the UR alt art for the Evil Twins: https://www.nexusmods.com/yugiohmasterduel/mods/1812
I don't know how modding on mobile works or if it is somehow different from PC, but I hope these help.
I don't know of a Master Duel modding Discord server either, but I don't mind if you ask your questions here.
Here's a link to the files for you to check. https://drive.google.com/file/d/1nCdQXOnPVB4NzIOyGsy1auQK1QWNFxpN/view?usp=sharing
Also, can you identify the main title screen music? I couldn't find it.
The title screen BGM is in this location: \masterduel_Data\data.unity3d → resources.assets → BGM_TUTORIAL_01
The music in the game files fades in and out, but those fades aren't played when the music loops in-game. How can I mod it so that the games skips those fades?
It doesn't show the shaders in the Asset List (like for example the game file "3dc6099d").
Do you know of any better version?
Because everytime I use Asset Studio my PC always shut down when it reaches 25% more or less, so I couldn't exactly pinpoint where are these files. Thanks in advance.
CARD_Named: d914d51c
CARD_Same: 6f963fe9
I've added all of them to my spreadsheet.
Ruby characters are only used in card names in some Asian languages, but not in English. Strangely enough, there are Japanese Ruby characters in the English language files.
Crimson Dragon has this "burning" effect and it carries over to the new animation that replaces it. Here's an example of it.
Other things is that how about the stats like ATK, DEF, level, etc? Where are the bytes for each of the property?
I remember that I tried to decipher the other bytes by comparing many different cards but I couldn't make sense of them, so I gave up.
Problem is, idk hex so all of this looks alien to me, so can you help me decipher what does it means? Maybe I hope after you know each bytes of each properties you could make a .json file for the card_prop so it would be easier to edit the card_prop, so is it possible for me to ask that? Thank you for the time and sorry if I sound rude, I'm not a native english speaker.
Why do you want to mod the CARD_Prop file? You would just make visual changes to the cards, but in game they would still work like usual.
Also, I linked a Discord server with a MD modding channel at the bottom of my modding guide. Pixeltris is active there too.
Traceback (most recent call last): File "D:\SteamLibrary\steamapps\common\Yu-Gi-Oh! Master Duel\test card prop_CARD_encrypt.py", line 10, in <module> file_name = sys.argv[1]
~~~~^^^The crypto key was correct: m_iCryptoKey = 0x7a
the _CARD_encrypt.py was from you
And I had installed the game to the recent update. But no avail. How to fix this?
I've tested my original script "_CARD_encrypt.py" with a decrypted CARD_Prop file as parameter and it still works. If that's not it, please upload your modified script, so I can check it.
The Japanese version is only used when you set the game language to Japanese, so you only need to mod the Japanese file if you play in Japanese.
Background, background 0001, shopbgbase02, shopbgbase02_02, shopbgbase04.
The purple background of the main menu screen is in the file \masterduel_Data\data.unity3d → resources.assets → ShopBGBase02
The file names of the different monster artworks are in my modding spreadsheet.
I know this is a year late and I'm not sure if anything changed since you made this comment, but after having changed ShopBGBase02, my wallpaper shows for a split second before reverting to the default red and blue one. I even downloaded a wallpaper mod from here but the issue persists.
Do you know how to solve this?
I want the The Revived Sky Temple Duel field, so I tried to find the field files with asset studio so I can replace with an existing duel field, but seem like I dont have those files, no Mat 27 basecolor near at all. All Mat 27 2d texture r in a50bf287 btw.
Is there any solution to this or I need someone else files?
It looks quite ugly in-game. I tried replacing one of the sleeves (Dragonmaid Send-Off) with the Wind sleeve (ripped directly from the game) to compare them side-by-side, and this is what I got:
Do you have any fix for this?
I even tried using RGB24 instead of RGBA32, and it's still the same.
This problem is quite bad when I'm using sleeves with a lot of details like so:
EDIT: I looked into it, and the problem seems to be because there are no "mip maps" (sometimes spelled "mipmaps").
UABEA doesn't make these, and I went to their GitHub and they recommended UnityPy, but that also doesn't seem to generate mip maps (as far as I know).
Do you have any experience with this?
Also, if UABEA doesn't support dds files, even if I make the image and generate mip maps for it, how would I mod it into the game?
You can import DDS textures into game files with UnityEx (paid app). A link and instructions for that are already in this guide, but I've just noticed that the app is quite expensive now. I bought it for 30 USD, now it's 120 USD. I think that's very overpriced for such a simple app. However, I don't know free software that can do this, except UnityPy.
Here's the dds file I used if you wanna see the mip maps [link]
Still looks like this:
I wanna take a look.
When I use that mod, it looks like this in game.
So I went back to UnityPy to read the issues and code, and I found the solution after some attempts. (for anyone who might come across this and not want to pay for UnityEX. Though I should put this in a better place)
After following the examples given, one should import TextureFormat from UnityPy.enums.TextureFormat, then use the following line to set the image:
data.set_image(pil_img, target_format = TextureFormat(4), mipmap_count = 10)
Of course with pil_img being an image opened with PIL. (It's not necessary to use a dds image, since UnityPy's code makes the mipmaps itself, so a PNG is fine)
TextureFormat(4) is RGBA32, and it's necessary to set it, and of course it's necessary to set mipmap_count to a high number (the code itself doesn't allow mipmaps smaller than 4 pixels in height nor width, so 7 is the max for sleeves and 8 for card arts, but 4 is sufficient for standard 1920x1080 monitors for both).
Then after that follow the rest of the example with saving the work.
The final result:
I'm going to have to write code for this to automatically convert all my mods (and maybe also compress them).
Edit: TextureFormat(4), which is RGBA32, not 3, which is RGB24. Also mipmap_count = 4 is enough.
I have the code already made with Python, but you'll need to install Python and the dependencies.