Page 18 of 18

Re: Magic Duels tests and results

PostPosted: 03 Feb 2017, 17:16
by Nick26
I have been doing a lot of experiments later and finally I have good news :D I want to thank thefiremind for the big idea of using an hex editor to edit cards. So, this is what I did and what I found out:
1) Using notepad++ (and unicode) I tried to make a custom shock, that is "shock_111111". I changed 396159 to 111111 instead of just 1 becouse I did not want to change the lenght of the file (since the card name is written in the card file too). The card did not work.
2) I did the same thing using HxD, an hex editor and... it WORKED!! Then I tried to change the casting cost from {R} to {0} and the damage dealt from 2 to 9 and again, it worked perfectly, the card showed up ingame and it does what it is supposed to do :D
3) I tried then to change the damage from 2 to 20 adding bytes with the hex editor but unfortunately the card was not recognized by the game. I made other experiments like changing the name to shock_1 or the casting cost to 10 (so, adding a digit) but again, the card did not work.

So apparently, there is an issue when we change the file lenght, may be the file lenght is coded somewhere in the file or there is some kind of checksum, I have no idea. Also, notepad++ and other text editors do not work, no clue why. Anyway, the custom zed still works fine!

edit: while building my "new" coin farm deck I realised that now it is no longer possible to build a deck with more than 4 copies of the same card (not a big issue actually) and with 15 or less lands.

Re: Magic Duels tests and results

PostPosted: 03 Feb 2017, 21:38
by thefiremind
Nick26 wrote:I want to thank thefiremind for the big idea of using an hex editor to edit cards.
You're welcome, but that's strange because when I tried, it didn't work. It's worth noticing that I didn't do exactly as you did: my test with the hex editor only involved changing the card's text, but I didn't change the Multiverse ID because I was hoping to override the original card. I tried to change the Multiverse ID of a card while keeping the file uncompiled, and I couldn't see the card in game.

Nick26 wrote:So apparently, there is an issue when we change the file lenght, may be the file lenght is coded somewhere in the file or there is some kind of checksum, I have no idea.
There actually is information in .METADATA\FileData.xml about the position (and thus also the length) of the files inside the ZED, but it has never mattered. What probably happens is that the compiled Lua code is not valid anymore if you insert bytes.

Nick26 wrote:Also, notepad++ and other text editors do not work, no clue why.
You usually can't edit binary files with text editors: some bytes get lost and/or headers are added.

By adding your test results with mine, for now I would assume that:
  1. We can't override existing cards the usual way. Sure, we can make a copy with a different name and then change all the references to it in the card pools and campaign/AI decks that use it, but I'd find it highly impractical. If there's a better way, we might have to wait for the next expansion in order to find out.
  2. If we add new cards, they need to be compiled. Now, this doesn't seem a big deal... if we can actually produce compiled files that the game happily reads. As far as I know, it should be enough to use luac from a 32-bit version of Lua 5.1.x, and then change the 6th byte from 00 to 5F. But will it really be all we need? I'll test more.
EDIT: I can confirm the previous assumptions. I'm going to write a tutorial about how to create a working card for your custom ZED files, but be aware, it's not a user-friendly procedure.

EDIT 2: The tutorial can be found here. Let me know if it works for you.

Re: Magic Duels tests and results

PostPosted: 05 Feb 2017, 07:05
by Nick26
It works great, thanks :) Unfortunately now I will have to learn the new code (which is driving me crazy with all those brackets).

Re: Magic Duels tests and results

PostPosted: 05 Feb 2017, 07:35
by Xander9009
Well, the changes are fairly straightforward. More than likely, someone will eventually create a map for the different name changes of various tags and attributes, and once that's done, a converter should be relatively simple. (Not exactly "easy", but not too difficult, at least.)

Re: Magic Duels tests and results

PostPosted: 05 Feb 2017, 10:05
by Nick26
That would be really nice! Today after 3 hours straight of work I have been finally able to recode Emrakul, The Promised End :D :D :D

Re: Magic Duels tests and results

PostPosted: 05 Feb 2017, 11:02
by thefiremind
Nick26 wrote:Unfortunately now I will have to learn the new code (which is driving me crazy with all those brackets).
I find the various nested brackets a little confusing, too: the XML was definitely easier to check with a quick glance. However you can choose to make local variables and code parts of the card one at a time, much like I did with the card pools (I made a table tCards with the card list and then added it to the card pool at the end), it could be helpful in order to reduce nesting.

EDIT: Here are the interpreted cards from Amonkhet, if someone is interested.
Code: Select all
http://www61.zippyshare.com/v/QwjgQ1Ek/file.html

Re: Magic Duels tests and results

PostPosted: 04 May 2017, 00:48
by magius74
Hey a new set is out for Magic Duels, been playing it. Does the new set have anything to add or change in the development of this project? Just curious. I've been watching this forum for awhile.

Re: Magic Duels tests and results

PostPosted: 04 May 2017, 19:13
by Xander9009
Hey firemind, that link you posted to the interpreted cards (originally, all of them) is expired. I'm trying to match up all of the tags and attributes to build a converter, but I've only got one card (Abandon Reason) in both versions (XML and interpreted lol), which makes it a bit difficult. Any chance you've still got the file? I'm not sure anyone would use a converter, but it'd be nice to have one, I think.

Re: Magic Duels tests and results

PostPosted: 04 May 2017, 21:36
by thefiremind
Xander9009 wrote:that link you posted to the interpreted cards (originally, all of them) is expired.
You can produce the interpreted versions quite easily by following the tutorial I posted here.

Xander9009 wrote:I'm not sure anyone would use a converter
That's the main reason I gave up trying to make one: there's almost no demand.

Re: Magic Duels tests and results

PostPosted: 04 May 2017, 21:45
by Xander9009
I forgot about the tutorial. Thanks. :)

Re: Magic Duels tests and results

PostPosted: 14 May 2017, 06:29
by Nick26
thefiremind wrote:That's the main reason I gave up trying to make one: there's almost no demand.
That's sad, a converter would be so helpfull. I have been trying to code Phyrexian Obliterator and Cryptic Command for like two months but with no results. Did anyone manage to code those cards?

Re: Magic Duels tests and results

PostPosted: 13 Jun 2017, 18:26
by MasterXploder7
http://magic.wizards.com/en/articles/ar ... 2017-06-13

I posted this in the "unlock all the cards" forum as well. I figure you guys might want to see it too.

Re: Magic Duels tests and results

PostPosted: 13 Jun 2017, 18:28
by Xander9009
MasterXploder7 wrote:http://magic.wizards.com/en/articles/archive/magic-digital/magic-digital-next-update-2017-06-13

I posted this in the "unlock all the cards" forum as well. I figure you guys might want to see it too.
Made a thread just for this. (I was already planning to, but you beat me to it lol.)