Page 1 of 1

Dummy's Guide to adding XML cards manually?

PostPosted: 16 Mar 2015, 16:20
by tinisking
Hi guys, I'm a relative newbie here. No coding experience at all, not very tech savvy, and I just started modding M14.

Recently I asked for Deceiver Exarch to be coded. Someone generously provided it for me, and I saved it in my notepad as a .XML.

Afterwards, I moved it to DATA_DLC_DECK_BUILDER_CUSTOM\DATA_ALL_PLATFORMS\CARDS. Couldn't be bothered to find a picture for Exarch though. Upon refreshing Riaak's deck builder, I could add Deceiver Exarch to my decks, export them as WAD, but upon starting M14, I couldn't find him in my decks.

Can someone please provide idiot-prove instructions on how to add .XML cards to your deck builder? A video would be fine too. Thanks!

Kind Regards,
tinisking

On a side note, I think someone should start uploading video tutorials. The written instructions on this forum tend to be a little intimidating and stiffling for newbies.

Re: Dummy's Guide to adding XML cards manually?

PostPosted: 16 Mar 2015, 17:25
by sweetLu

Re: Dummy's Guide to adding XML cards manually?

PostPosted: 17 Mar 2015, 14:32
by tinisking
Still having problems.

"XML file for your New Card - In the folder I've provided, go to the CARDS folder inside of the DATA_ALL_PLATFORMS folder. This is where the XML files for your cards go. The easiest way to add a new card is to:
Copy and paste the XML file for an existing card
Rename the XML file to whatever is in the parenthesis of the filename tag in your new card (i.e. <FILENAME text="ZHURTAA_DRUID_909369065" />)
Delete the XML code inside the copied card and paste the XML for your new card"

I copied Deceiver Exarch into the exact folder as a .XML file, renamed it to DECEIVER_EXARCH_168376301.

I skipped the picture part, and although I can add exarch to my decks in the deck builder, when I try to export my decks as a WAD to test them out, Exarch does not show up in my decks. For instance, if I add 30 Exarchs to my deck, all I get in my game is 30 islands in the deck.

I have also tried the same procedure for DATA_DLC_DECK_BUILDER_CUSTOM folder, as the guide suggests.

Anyone can do a short video?

Re: Dummy's Guide to adding XML cards manually?

PostPosted: 17 Mar 2015, 14:47
by tinisking
Actually, it seems to work now when I take someone's else XML card and edit the contents and title.

May I know why this method works? Originally, I copied the entire code of Exarch, pasted it in notepad, and then saved it as .XML. However, the file size seemed larger. Strange. I would like to learn from this experience, can anyone care to explain?

Also, when asking for cards to be coded in the "Formal Request Thread", all codes provided require no editing of their contents?

Re: Dummy's Guide to adding XML cards manually?

PostPosted: 17 Mar 2015, 16:21
by sweetLu
It's possible the encoding is incorrect. The encoding for the xml file should be UTF-8 in order for the game to recognize the card. If I'm not mistaken, a card originally saved with alternate encoding and then reverted to UTF-8 will still not work. The xml file needs to be saved with the correct encoding initially. This is why my guide suggests copy and renaming an existing file.

Yes, in general cards will not need to be modified. Modders typically use a number prefix on their cards to better assure cross compatibility with other cards. It's possible for a modder to post a card in the FRT and they ask you to change the prefix. This isn't a big deal unless you start publishing your own cards using another players prefix or if you download another version of the same card.

Other time editing may be required is for localized text. Some cards may require you to define the localized text shown in some UI prompts. I say require but it is really optional. For instance say the localized text is "Do you want to draw a card?". If the localized text is missing you might see [UI_DRAW_CARD] in place the question in quotes. In that case you would have to define the text for[UI_DRAW_CARD] in a separate file. I can go more in depth If you would like.

These are the two instances you are most likely to run into. There may be some other, more complicated cards but usually the modder will provide additional instructions for these cases.

Re: Dummy's Guide to adding XML cards manually?

PostPosted: 17 Mar 2015, 18:14
by MasterXploder7
thank you, I had gotten mirrorweave from the request thread and didnt know how to make it work because it made the game crash, i dont think i saved it as UTF-8 i think it was as a Unicode

Re: Dummy's Guide to adding XML cards manually?

PostPosted: 18 Mar 2015, 15:06
by tinisking
Thanks! No need to go in-depth, my queries are sated for now...

However, since you guys seem to be an expert on modding, could you also answer the following questions on Riaak's deckbuilder?

1) What is the difference between "Export to Directory" and "Export to WAD"

2) What does "save deck"/"save deck as" does?

3) Under the "Edit Name" tab, what does "Ignore Cards with CMC over" mean?

4) What does "card prefix" mean in layman terms? I understand it is something to distinguish the works of modders. But what happens if we share a conflict? I.e. we both use the same prefix. I believe when exporting your deck as a WAD you get a prompt or warning on this as well? What happens if I go ahead and ignore the warning?

5) Does editing your deck personality do anything?

Re: Dummy's Guide to adding XML cards manually?

PostPosted: 18 Mar 2015, 19:50
by Xander9009
1) The game can read mods in one of two ways. It can read packed mods which are single files with the extension .wad, which you'll be familiar with. It can also read a mod that has not been packed and is instead in a certain folder (the .wad is almost literally just a zipped folder). So, export to directory will export the deck to a folder which the game can read and which you can browse through and edit without difficulty. Export to WAD will export to the packed file which you can't as easily modify, but which is much better for sharing with others.

2: Decks are xml files within the WADs or folders. They're a very strictly organized xml file with a list of the cards. When you export to a wad or directory, the deck builder makes a wad or directory which contains the xml file with the list of cards. Save Deck will save the actual xml file without bothering with making a wad or directory. JUST the file that contains the card list is saved. "Save Deck as" will do the same thing, but it will allow you to rename the file even if you've already saved a deck during that session ("Save Deck" will use whatever name was used the last time you saved a deck during that session). This is speculation based on the fact that I clicked "Save Deck" and it asked what to name the xml file. I've never actually saved one and looked at it. However, that's the most reasonable conclusion. Riiak sees pretty much everything here, so if I'm wrong, he'll let you know.

3: The game can ignore certain cards when deciding how many lands to put in. -1 means don't ignore anything, 0 means ignore all cards with a cost. If you have 60 or more cards in your deck, set this to 0 and the game won't add lands to the deck (because it will otherwise add lands until there are 250 or so cards). There may be other uses, and that might be slightly wrong; fair warning.

4: It is pretty much only to distinguish between modders. If two people make the same card and name it the same thing (or deck), then the game will only read one of them. A prefix is just a number that is inserted at the beginning of every card/deck to make sure this can't happen. If a deck is exported with a conflicting ID, the game should still be able to read it fine, but it's bad practice. If the decks have the same name AND ID, however, then ignoring the warning will overwrite the deck in the game folder with the one you're exporting. I know far less about the way the game handles files than Riiak (sorry Riiak, you're pretty much the only really knowledgeable modder who stuck around through 2015 unmoddability).

5: Yes, but no. However, I think the answer you're looking for is no. By that I mean, yes, it changes some stuff, but none of that will affect how the deck is played by the computer or how the computer handles a given situation. The personality is just the extra fluffy bits that make the deck a little more user-friendly. Music, pictures, balance, it's all just stuff the player will see and experience, not stuff the computer will care about.

Re: Dummy's Guide to adding XML cards manually?

PostPosted: 18 Mar 2015, 23:56
by RiiakShiNal
tinisking wrote:Thanks! No need to go in-depth, my queries are sated for now...

However, since you guys seem to be an expert on modding, could you also answer the following questions on Riaak's deckbuilder?

1) What is the difference between "Export to Directory" and "Export to WAD"

2) What does "save deck"/"save deck as" does?

3) Under the "Edit Name" tab, what does "Ignore Cards with CMC over" mean?

4) What does "card prefix" mean in layman terms? I understand it is something to distinguish the works of modders. But what happens if we share a conflict? I.e. we both use the same prefix. I believe when exporting your deck as a WAD you get a prompt or warning on this as well? What happens if I go ahead and ignore the warning?

5) Does editing your deck personality do anything?
Since I'm the most qualified to comment on some of these here are my comments:
    • Xander9009's answer here is pretty good, but I'll expand it a bit. The Directory you get from export to directory is what gets packed up in a standard WAD (and the game has no problem reading it as a WAD as long as you have Rick's patcher dll which is required for any mod), but because it is in Directory format it makes it easier to modify the files if you want to tweak it or play around with it without needing to worry about unpacking/repacking. Directories are not very well suited to Multiplayer, because the game can interpret 2 identical directories as different WADs and cause multiplayer problems.
    • Export to WAD takes all the information from the Directory format and puts it directly into a compressed WAD for you to give you the minimum WAD size without having to mess with Gibbed.Duels.Pack directly. This is the best way to share decks as it keeps the size down and eliminates issues you would have with the game misinterpreting the WAD as a different version when shared.
  1. "Save Deck As" stores a copy of all the necessary information for the Deck into a single XML file which can easily be shared/backed up for changes/reporting. For example say you have come up with a good deck idea and want to try it out, but you may need to make changes later. You construct your deck, the save it using "Save Deck As", then you export it (which puts things in the proper format for the game), and try it out. After trying it out you decide you need to change a few things or you see you exported it with the wrong Block Id, so you Load your saved deck which brings the deck back into the builder exactly as you saved it out, make the necessary changes and then you can save it again and/or export it again. This is a better option than using the "Create from Existing Deck" option as it doesn't require you to make changes to the personality to get it to save back out if you liked the personality you created. This also makes changing your own decks from one Id block to another easier.
  2. Xander9009's answer here is pretty much spot on, but he missed one case. If you are making a 4+ colour deck then most likely you are going to need to set this to 0 (to force the game to ignore virtually all cards in the deck) and manually set how much of each land type you want using the minimum options (note game will still fill up to 60 cards if you don't specify enough lands to make the deck size 60 cards).
  3. A card prefix is a prefix you put in front of the card's filename to make sure it doesn't conflict with other modders. For example my registered prefix is "RSN" so if I was making an Alloy Myr card with a card prefix it might read as RSN_ALLOY_MYR_214344.XML. Id Blocks (Id Prefix) are used either for setting the "expansion" a deck sits in or for prefixing Multiverse Ids again to prevent conflicts. My registered Id Block is 8192 so if I were making the same Alloy Myr except with an Id prefix it would look like ALLOY_MYR_8192214344.XML (note this would cause errors to be generated by the Deck Builder because the Multiverse Id is now too large). Though Id Blocks are usually used more for decks to place them into an "expansion" so they won't conflict with other decks and generating unique Ids is much easier. If I were to use my Id Prefix to create an Elvish Revenge deck the output WAD name might look like DATA_DLC_819201_Elvish_Revenge.wad this way if someone else also creates an Elvish Revenge deck their's will have a different filename and set of Ids so it won't conflict with my deck. If there is a conflict between two different WADs over a card name then one of the 2 cards will be used and the other will be ignored (which can cause bugs). If there is a conflict between WAD names, well that is obvious as only one of the 2 files can exist, but if there are 2 different decks using the same set of Ids (such as 2 people making decks and using the default Id Block of 1000) then the game may still read both decks and say both are available, but when you pick one and play it may give you the cards from the other deck because it confuses the game.
  4. The only thing editing the personality does is give a different appearance and/or music to the AI while it is using that deck. It can make it easier to identify which deck the opponent is using, but has Zero effect on gameplay. So it is a nice touch to add a unique personality, but it isn't necessary and you could always just pick one of the already existing ones.

Sorry about the wall of text, but some things can benefit from thorough answers. For some questions about the Deck Builder, the documentation can sometimes provide the answer faster than posting a question.

Re: Dummy's Guide to adding XML cards manually?

PostPosted: 19 Mar 2015, 14:36
by tinisking
Alright, thanks!

All my doubts are finally settled. I'm going to screenshot all the replies here just in case. If I have any further queries i'll revisit this thread.

On a side note, is slightlymagic.net the only place where people mod M14? I'm surprised the modding community is so small.

Re: Dummy's Guide to adding XML cards manually?

PostPosted: 19 Mar 2015, 16:58
by Xander9009
After some searching, it seems this is the only modding community for the game series. To be fair, we'd have a few more people if 2015 could be modded. But a few of the modders got burnt out on 2014, I think.