Yu-Gi-Oh Master Duel

Software for creating Master Duel mods:


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 every card artwork, sleeve/protector image, wallpaper and more in this spreadsheet (last updated for game version 2022-08-05).

Also, here's a more up-to-date spreadsheet with just the card IDs and the file names, so you can look up a card ID here (it's in the address bar after "cid=" if you are on the page of a specific card) and find the file name for the card ID in the spreadsheet.

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 FileOpen 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 FileClose →  File →  Open and open the file with the original name.
  • Click FileCompress.
  • 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 ExportExport 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:

CARD_decrypt.py / Credit: akintos from GitHub.
import sys
import zlib

file_name = sys.argv[1]
m_iCryptoKey = 0x5b

with open(file_name, "rb") as f:
    data = bytearray(f.read())

for i in range(len(data)):
    v = i + m_iCryptoKey + 0x23D
    v *= m_iCryptoKey
    v ^= i % 7
    data[i] ^= v & 0xFF

with open(file_name + ".dec", "wb") as f:
    f.write(zlib.decompress(data))

CARD_encrypt.py
/ Credit goes to crazydoomy#4471 for editing the above script for encrypting
import sys
import zlib

file_name = sys.argv[1]
m_iCryptoKey = 0x5b

with open(file_name, "rb") as f:
    data = bytearray(zlib.compress(f.read()))

for i in range(len(data)):
    v = i + m_iCryptoKey + 0x23D
    v *= m_iCryptoKey
    v ^= i % 7
    data[i] ^= v & 0xFF

with open(file_name + ".enc", "wb") as f:
    f.write((data))

CARD_decrypt_Desc+Indx+Name.py / Credits: same as above
  • Decrypts the CARD_Name, CARD_Desc and CARD_Indx files in one go.

CARD_Name+Desc_split.py
/ Credit: timelic
  • Splits the CARD_Name and CARD_Desc files, so that every name and description is in one line, and converts them to JSON.

CARD_merge+calc_index.py / Credit: timelic
  • Merges the CARD_Name and CARD_Desc JSON files and calculates the CARD_Indx file. The original files will be overwritten by this, so make a backup beforehand.

Find crypto key script
Complete folder of all of my Python files for MD

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:

English:
  • CARD_Desc: .\LocalData\????????\0000\95\95e73521
  • CARD_Indx: .\LocalData\????????\0000\e4\e43e4f67
  • CARD_Name: .\LocalData\????????\0000\c0\c071e773
  • Card_Pidx: .\LocalData\????????\0000\fd\fd071f0b
  • Card_Part: .\LocalData\????????\0000\e6\e63ab74f

Japanese:

  • CARD_Desc: .\LocalData\????????\0000\70\709556c6
  • CARD_Indx: .\LocalData\????????\0000\01\014c2c80
  • CARD_Name: .\LocalData\????????\0000\25\25038494
  • Card_Pidx: .\LocalData\????????\0000\18\18757cec
  • Card_Part: .\LocalData\????????\0000\03\0348d4a8

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 TypeTextAsset.
  • 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".

Related links:

Article information

Added on

Edited on

Written by

RndUser

247 comments

  1. ygomdmodder
    ygomdmodder
    • supporter
    • 0 kudos
    Hello, I would like to offer feature requests for the "Improve_Card_Text_Readibility" mod.

    If you go into your masterduelmeta's profile there's a "Show condition and activation highlights" setting. What it does is it highlights in green background clauses before colons and in red background clauses before semicolons. I'm not sure if styling card text is trivial or not. If it's too hard I'd still like to suggest these QoL improvements:

    - have conditions and activations highlighted in some way, e.g. [[Square brackets for activation]] and {{Curly braces for condition}} (I'm not sure this would look good in practice, some experimentation needed)
    - highlight in some way (e.g. UPPERCASE) keywords like Quick-Effect, destroy/destroying, negate/negating/negated.
    - (probably more annoying to get right) detect and condense soft once-per-turns and hard once-per-turns into simply SOPT and HOPT.
    - personally I think I'd prefer separating paragraphs not with two newlines but with one newline and a list item marker, e.g "\n• "
    1. RndUser
      RndUser
      • premium
      • 23 kudos
      Hi. Highlighting the background of card text in MD isn't possible as far as I know.
      Coloring the actual card text is possible, but the game already colors some text in cyan if you can activate the effect, so that feature would get lost.

      Adding a list item marker before each paragraph wouldn't look good in every card text IMO because multiple choice effects already contain that character, for example, Vanquish Soul Caesar Valius. I could use another character like a square or a circle, but that looks a little confusing at first glance. I think the best way to do this would be to replicate the OCG style which has numbered effects like this, but I would have to rewrite a large part of this script. I'm not motivated enough to do that because writing that script was already very hard for me because I'm just an amateur coder.

      Here are some more examples of how the card text would look with brackets, in bold, italics, with capitals, etc. Underlined doesn't seem to be possible. You can also find a screenshot of how it looks in YGO Omega there. I think capitals look best for keywords and SOPT/HOPT keywords would be a great improvement, but the brackets would be overkill.
    2. ygomdmodder
      ygomdmodder
      • supporter
      • 0 kudos
      Wow, thank you for running those visual tests. I'm going to do some experiments today too. If I get anything useable I'll try to make my work available on Github, hopefully I can make my tweaking around reproducible enough.
    3. ygomdmodder
      ygomdmodder
      • supporter
      • 0 kudos
      Could you share what formatting you use to display colored card text?
    4. ygomdmodder
      ygomdmodder
      • supporter
      • 0 kudos
      Sorry for the spam ^^' another question I have is do you know how the game separates the card effects (e.g. when showing which ones have been used this turn, or which one is being used/offered), despite our changes? Is there anything we must preserve in the card descriptions to not break this feature?

      EDIT: I see now this must be in the Card_Part asset
    5. RndUser
      RndUser
      • premium
      • 23 kudos
      You're welcome :)

      After thinking thoroughly about the numbered card effects, I think I should be able to do it, so I'll try.

      These are the formatting tags I know:
      <b>TEXT</b> - bold
      <i>TEXT</i> - italics
      <color=#FFFFFF>TEXT</color>

      Yes, the Card_Part asset contains the start and end offset of all card effects in each card description.

      You could edit your post instead of spamming. ^^
  2. miyooooko
    miyooooko
    • member
    • 0 kudos
    hey, so i was replacing summon animations with animations of my own, how do i make it so they dont lose a bunch of quality? i export them with spine so it gives me only 1 .png after but even then i have to resize the image through the .json and in the end the quality is so bad it makes no sense even replacing it in the first place. it bothers me because there's a bunch of mods that replace summon animations with big-ass animations and the quality is there (ie: https://www.nexusmods.com/yugiohmasterduel/mods/448), so i must be doing something wrong. i followed a tutorial and the guy didnt mention anything about this problem specifically and he's lost for like 5 months so im pretty sure im not getting a response from him. any help from here would be cool ig.
    1. RndUser
      RndUser
      • premium
      • 23 kudos
      Hi, could you upload your mod, so I can see why its quality is so bad?
  3. viktorrios
    viktorrios
    • member
    • 0 kudos
    When I extract the 3D pals, I get an .obj but not .FBX which contains the animations.
    Is there a script to extract the skeleton rig and animations?

    ***Update 1*****
    I managed to export to .fbx the meshes with their bones.
    But I don't know how to export their animations. or how to identify them in the system to export them; I don't know which option does that using AssetStudio.
    help, please.
  4. Purplelemonade666
    Purplelemonade666
    • member
    • 0 kudos
    Hello. I have a question. On this step "In the UABEA main window click File and Save", nothing happens. I triple cheked all the steps and I did everything right. Now all that remains is to save the file to replace the other one. Except when I try to save, nothing. Do you know what might cause this? Thank you!
    1. RndUser
      RndUser
      • premium
      • 23 kudos
      Hi. I made a small mistake in the step you mentioned. It should say "In the UABEA main window click File and Save as...". I've just corrected that. You're welcome :)
    2. Purplelemonade666
      Purplelemonade666
      • member
      • 0 kudos
      Thank you for the response. Peace and love brother!
  5. Skyrem22
    Skyrem22
    • member
    • 0 kudos
    Hello sorry for the noob question but, can I use it to "create" a functional custom card? is is this just purely for aesthetic purposes? Thank you for the guide!
    1. RndUser
      RndUser
      • premium
      • 23 kudos
      Hi, this is guide is just for modding graphics and text. To create custom cards you would have to change the game code which is beyond my knowledge. You're welcome :)
    2. Skyrem22
      Skyrem22
      • member
      • 0 kudos
      I see, completely understandable, thank you for your time, have a wonderful day
  6. SumaYez
    SumaYez
    • member
    • 0 kudos
    Hii sorry for bothering you. I changed the main menu art and now I want to remove the monster art on the main menu so which files do I need to change and how?
    and I changed the main menu art but in the shop "Recommended" part didn't change which texture do I need to change for that?
    1. RndUser
      RndUser
      • premium
      • 23 kudos
      Hi, no worries. To remove a monster artwork/background on the main menu screen, I would just replace it with the smallest transparent image the game accepts which is 16x16 pixels. You can create it with GIMP/Photoshop. The file names for the main menu "wallpapers" are here.

      The shop background is in the file "\LocalData\????????\0000\1f\1f04f4e7".
    2. SumaYez
      SumaYez
      • member
      • 0 kudos
      Thank you ^^
    3. RndUser
      RndUser
      • premium
      • 23 kudos
      You're welcome ^^
  7. GhostWyvern
    GhostWyvern
    • member
    • 0 kudos
    CARD_* file locations for the newest version update.

    EN
    CARD_Name: c071e773
    CARD_Indx: e43e4f67
    CARD_Desc: 95e73521

    JP
    CARD_Name: 25038494
    CARD_Indx: 014c2c80
    CARD_Desc: 709556c6

    Crypto Key: 0x5b
    1. RndUser
      RndUser
      • premium
      • 23 kudos
      That's right, I've updated the guide.
  8. JtheDuelist
    JtheDuelist
    • premium
    • 72 kudos
    Now if only I could figure out how I am supposed to extract Mate models so I can get my hands on Tri-Brigade Suraig's model so I can make a VRChat avatar of him...
    1. RndUser
      RndUser
      • premium
      • 23 kudos
      You can extract Mate meshes/models with Asset Studio and import the .obj files into Blender, but don't ask me how to assemble all the meshes, textures, etc. The Shuraig mate is in the file a8ea0f85.
    2. JtheDuelist
      JtheDuelist
      • premium
      • 72 kudos
      Ah, I guess with them being OBJ means that they aren't exported with their in-game armatures? Oof, makes things more difficult, but at least it is something to work with. Thanks.
  9. SIG0616
    SIG0616
    • member
    • 0 kudos
    Do you know the name of the file where the images of the color frame of cards like Fusion, Synchro, Xyz, Link and etc are saved?
    And I would also like to know about attribute icons and Level star.
    1. RndUser
      RndUser
      • premium
      • 23 kudos
      These are all in the file \masterduel_Data\data.unity3d.
      The card frames are named "card_frame00" to "card_frame19" there.
      And the attribute icons, level/rank stars, link arrows, etc. are in the file "sactx-0-1024x512-BC7-CardSpriteAtlas-5bc59b24". The last 8 characters of this file may change after data.unity3d has been updated.
    2. SIG0616
      SIG0616
      • member
      • 0 kudos
      Thanks very much.
      I will try it.
  10. inNexus666
    inNexus666
    • member
    • 0 kudos
    thank you very much for the update, arigatou gozaimasu 
    1. RndUser
      RndUser
      • premium
      • 23 kudos
      Don’t-itashi-mention-it ^^