It is currently 26 Apr 2024, 02:15
   
Text Size

Templates for cards, all of them

Moderators: ubeefx, beholder, melvin, ShawnieBoy, Lodici, CCGHQ Admins

Templates for cards, all of them

Postby ember hauler » 06 Oct 2013, 20:05

Hi guys,

As far as I know, Magic has more than 13 500 unique cards (if you count planes, avatars, characters and the rest).

Magarena v.1.42 has 3735. Huge difference.

Adding new cards is a hard work, and I'm really glad there are some cool guys doing scripting and programming and everything.

I was thinking about my contribution, about some way to make this scripting work a bit easier for you.

So I managed to create a template for every card up to M14, which is 13 431 cards in total. These templates could be a starting point for scripting new card, saving some time with boring stuff like types, subtypes, manacost, url, image, PT, etc.

See the attachment.
Let me know if this is helpful.

Regards.

UPDATE:
Attached file was updated so now it's easier to find it in this thread.
Attachments
card templates 2014-03-11.zip
(4.18 MiB) Downloaded 356 times
Last edited by ember hauler on 11 Mar 2014, 05:39, edited 4 times in total.
ember hauler
 
Posts: 79
Joined: 14 Aug 2013, 08:13
Has thanked: 27 times
Been thanked: 14 times

Re: Templates for cards, all of them

Postby Huggybaby » 06 Oct 2013, 23:41

I'm not capable of judging how helpful your contribution is, but I sure like the way you think. :)
User avatar
Huggybaby
Administrator
 
Posts: 3207
Joined: 15 Jan 2006, 19:44
Location: Finally out of Atlanta
Has thanked: 701 times
Been thanked: 594 times

Re: Templates for cards, all of them

Postby jerichopumpkin » 07 Oct 2013, 08:14

:D Holy cow! That is amazing, it will save me an awful lot of time!
jerichopumpkin
 
Posts: 212
Joined: 12 Sep 2013, 11:21
Has thanked: 19 times
Been thanked: 13 times

Re: Templates for cards, all of them

Postby melvin » 07 Oct 2013, 08:55

Thanks, ember hauler. This is a very useful resource that will reduce the work needed to create a card.

Some suggestions for improvements to better match current conventions:

File names should be card name with non alpha numeric characters changed to _, eg Lu_Su,_Wu_Advisor.txt should be Lu_Su__Wu_Advisor.txt

Currently I'm checking for conformance against Arch's cards.xml for name, type, subtype, cost, pt in that order. It would help if in the template, the cost property appears after subtype property.

Could you share the scripts for generating these templates so that we can include them in the project? This will allow us to generate templates for future sets.
User avatar
melvin
AI Programmer
 
Posts: 1062
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 459 times

Re: Templates for cards, all of them

Postby ember hauler » 07 Oct 2013, 10:16

melvin wrote:Thanks, ember hauler. This is a very useful resource that will reduce the work needed to create a card.
I truly hope so.

melvin wrote:Some suggestions for improvements to better match current conventions:

File names should be card name with non alpha numeric characters changed to _, eg Lu_Su,_Wu_Advisor.txt should be Lu_Su__Wu_Advisor.txt

Currently I'm checking for conformance against Arch's cards.xml for name, type, subtype, cost, pt in that order. It would help if in the template, the cost property appears after subtype property.
Sure thing! Will do in a couple of days. I've noticed some things to improve as well, so I'll put updated files here.

melvin wrote:Could you share the scripts for generating these templates so that we can include them in the project? This will allow us to generate templates for future sets.
It was just several hours in MS Excel, I'm not sure if it counts as "programming environment" :)
ember hauler
 
Posts: 79
Joined: 14 Aug 2013, 08:13
Has thanked: 27 times
Been thanked: 14 times

Re: Templates for cards, all of them

Postby ember hauler » 07 Oct 2013, 10:19

jerichopumpkin wrote::D Holy cow! That is amazing, it will save me an awful lot of time!
Good to hear :)

There are no Theros cards at the moment, but I'm planning to deal with them as well, as soon as I'll find more recent database.
ember hauler
 
Posts: 79
Joined: 14 Aug 2013, 08:13
Has thanked: 27 times
Been thanked: 14 times

Re: Templates for cards, all of them

Postby ember hauler » 07 Oct 2013, 10:23

Another thing I keep thinking about is the "value" property of the card.

Is there any way to fetch community rating from Gatherer for every card?
ember hauler
 
Posts: 79
Joined: 14 Aug 2013, 08:13
Has thanked: 27 times
Been thanked: 14 times

Re: Templates for cards, all of them

Postby melvin » 07 Oct 2013, 12:05

ember hauler wrote:It was just several hours in MS Excel, I'm not sure if it counts as "programming environment" :)
:shock: that's incredible, never knew Excel could do something like this. I'll see if I can whip up something to detect vanilla creatures that are not yet in the game, then those could be added directly from your templates as they don't need anything else.

ember hauler wrote:Another thing I keep thinking about is the "value" property of the card.
Is there any way to fetch community rating from Gatherer for every card?
Before a release, I'll run a script that update every card in the game. I just grab the Gatherer page for the card and scrap the rating. So the value property is not that important as we can update it automatically, perhaps you can default it to 2.5 first.
User avatar
melvin
AI Programmer
 
Posts: 1062
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 459 times

Re: Templates for cards, all of them

Postby ember hauler » 07 Oct 2013, 12:29

melvin wrote:I'll see if I can whip up something to detect vanilla creatures that are not yet in the game, then those could be added directly from your templates as they don't need anything else.
Well, now that you mentioned Arch's xml I guess I will redo my templates. My source was Deckbuilder's csv, which is not as accurate as Arch's, I guess. For example we could fetch simple abilities and put them into templates. I think I can do that.

melvin wrote:Before a release, I'll run a script that update every card in the game. I just grab the Gatherer page for the card and scrap the rating. So the value property is not that important as we can update it automatically, perhaps you can default it to 2.5 first.
Great, let's do it this way.
ember hauler
 
Posts: 79
Joined: 14 Aug 2013, 08:13
Has thanked: 27 times
Been thanked: 14 times

Re: Templates for cards, all of them

Postby mike » 07 Oct 2013, 12:41

I have a relatively up to date copy of the gatherer database for Project Firemind. If you need an easy to use API (json/xml) for generating the templates let me know, I'll set one up.

Would it be helpful to anyone if I hosted those templates on firemind.ch linked to the specific cards? So people could search for a card and directly download the template (or even edit and submit it directly in the browser).
User avatar
mike
Programmer
 
Posts: 128
Joined: 05 Jul 2013, 17:00
Has thanked: 0 time
Been thanked: 29 times

Re: Templates for cards, all of them

Postby ember hauler » 11 Oct 2013, 08:00

Well, I did all the work again, completely from scratch. This time I used Arch's XML, the most recent one. I've corrected requested things and did some other small improvements.

The result is in the attachment:
- 13 648 card templates
- Theros included (so I guess now it's really ALL the cards)
- file names follow conventions
- name, type, subtype, cost, pt are in correct order
- value is 2.500 by default

I hope it will help.

UPDATE:
Now you can find the latest templates at the first post in this thread.
Last edited by ember hauler on 13 Oct 2013, 12:56, edited 1 time in total.
ember hauler
 
Posts: 79
Joined: 14 Aug 2013, 08:13
Has thanked: 27 times
Been thanked: 14 times

Re: Templates for cards, all of them

Postby ember hauler » 11 Oct 2013, 08:06

mike wrote:Would it be helpful to anyone if I hosted those templates on firemind.ch linked to the specific cards? So people could search for a card and directly download the template (or even edit and submit it directly in the browser).
I think it's a great idea.
The more ways we have for people to participate and find the information/templates, the more card scripts we will get.

Most of the card submitting traffic, I believe, is now goes thru firemind.ch, so it's quite natural to host templates there as well.
ember hauler
 
Posts: 79
Joined: 14 Aug 2013, 08:13
Has thanked: 27 times
Been thanked: 14 times

Re: Templates for cards, all of them

Postby melvin » 13 Oct 2013, 03:38

ember hauler wrote:Well, I did all the work again, completely from scratch. This time I used Arch's XML, the most recent one. I've corrected requested things and did some other small improvements.
Great to have the Theros cards available now. Btw, how did you get the URLs for the image and text propert of the cards? That was my stumbling block when I tried to so something similar.

I was merging the 35 cards you submitted when I noticed that the order of types and subtypes do not follow from Arch's cards.xml.

For example, Triton Shorethief is printed as Merfolk Rogue but in the template it is given as "subtype=Rogue,Merfolk", similarly Bronze Sable is printed as Artifact Creature but given as "type=Creature,Artifact". All things being equal, it would be better if the order of subtypes follow from cards.xml as well.
User avatar
melvin
AI Programmer
 
Posts: 1062
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 459 times

Re: Templates for cards, all of them

Postby ember hauler » 13 Oct 2013, 13:15

melvin wrote: Btw, how did you get the URLs for the image and text propert of the cards? That was my stumbling block when I tried to so something similar.
Arch's XML pack has setinfo.xml, from that I took set codes and release dates. In meta.xml there is a set for every card, so I calculated the code for most recently released set for every card. Then I added number of the card inside the release (this info is also from meta.xml). This way I was able to construct URL and Image for 88.5% of all cards. Sometimes these URLs lead to 404 (sorry), but most of the time they are accurate.

melvin wrote:I was merging the 35 cards you submitted when I noticed that the order of types and subtypes do not follow from Arch's cards.xml.
True. Unfortunately, once XML is imported to Excel there is no way of telling the right order - there is no attribute for this, only for supertypes.

But I managed to put all of the types and some of the subtypes in the right order by working with keywords. I hope it's not crucial.

Updated ZIP is now in the first post of the thread.
ember hauler
 
Posts: 79
Joined: 14 Aug 2013, 08:13
Has thanked: 27 times
Been thanked: 14 times

Re: Templates for cards, all of them

Postby ember hauler » 08 Nov 2013, 12:08

The file in the first post was updated, now with Commander 2013 cards.

13699 card templates in total.
ember hauler
 
Posts: 79
Joined: 14 Aug 2013, 08:13
Has thanked: 27 times
Been thanked: 14 times

Next

Return to Magarena

Who is online

Users browsing this forum: No registered users and 10 guests


Who is online

In total there are 10 users online :: 0 registered, 0 hidden and 10 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 10 guests

Login Form