I'd be fascinated to feed the network all of the d&d 3.5 spells that exist and see what it comes up with. The end result may even be something that makes up for the horrible dullness of the Vancian magic system.
@talcos, is the vector representation of cards reversible, from vectors back to full card info? If yes, couldn't we use that as the corpus encoding?
About your first questions: you may look at an input.txt snippet in my post above. If you do, you'll see that <newline> marks the end of each field, and double <newline> the end of a card. There's no dedicated character to field end/begin except for <newline>, the sequences "<newline><1 char>:" is charcateristic of a field change.
I'm not sure where your going with this though. If there was a card splicing and the network can remember anything if it decides to, then that's probably what happened: it learned some dubious association, uses it then resumes the original syntax that always follows "if it was kicked with". Plausible?
Makes me wish for an antisplicing update
The issue is that we're still seeing the "if kicked (but no kicker)" problem even when we do duplication that should mitigate any effects of splicing, so I'm tempted to say that splicing is not responsible for that problem. In any case, I can do some more experiments in the future to see whether we can get that under control, haha.
I'd be fascinated to feed the network all of the d&d 3.5 spells that exist and see what it comes up with. The end result may even be something that makes up for the horrible dullness of the Vancian magic system.
@talcos, is the vector representation of cards reversible, from vectors back to full card info? If yes, couldn't we use that as the corpus encoding?
The process is not perfectly reversible because the vectorization, as I specified it, does not preserve word orderings. This can lead to confusions like I mentioned, such as whether a card was an elf that made goblin tokens or a goblin that made elf tokens. A smart decoder network could reconstruct the original card, but it may not get everything right (because it can have multiple, equally valid alternatives to choose from).
Oh, and I found an XML file containing the full text of every spell in Pathfinder, so that kind of data is available for it. Not sure if I have the time to write the scripts necessary to extract the necessary informtion though. Of course, if anyone's interested in doing that or has the data in a form that I can readily use, I can run experiments for them.
---
Quick question, can anyone recognize the art in the image that I've attached?
I'm running some very small tests with grayscale images to cut down on computation time. I need to know where the network is getting its inspiration, because I'm fairly confident this one is an attempt at an exact copy.
I also got one out that was an ungodly hybrid of Abattoir Ghoul and I think Alabaster Dragon. But I wasn't able to figure this one out.
So it probably isn't Alabaster Dragon, but I know Abattoir Ghoul is in the art because I passed his content vector and in the bottom right corner I recognize the shoulder blade, but I'm seeing what looks like a pair of wings in the background, as if the art got interspersed with some other art. The problem with that image is that I was using an absolute value function to determine the error, and it caused the images to become very strongly white and black.
Also, bear in mind, this is very, very, very preliminary stuff (the art will be in color and much more coherent). I'm actually using an architecture that's ill-suited for image generation and I'm forcing it to do what I want and the results are lackluster. I was just testing the input/output process to make sure everything was working as it should.
EDIT: As for why Abzan Runemark, it's because I picked the exact vector for it and didn't realize it (the order of the vectors in the training data isn't quite the same as the order I originally had them in, and I stripped out the names, so I couldn't figure it out, haha).
If this can be relatively easy to set up in Torch I would really like to try this myself when I get home. I'm guessing it's not though, and if you've been at this for 24 hours with a gtx Titan I probably won't get very far with my inferior card.
If this can be relatively easy to set up in Torch I would really like to try this myself when I get home. I'm guessing it's not though, and if you've been at this for 24 hours with a gtx Titan I probably won't get very far with my inferior card.
By architecture I mean neural architecture, and just a clever arrangement of linear layers. The problem with that is that that's not what we really need. What'll end up happening, at best, is that it'll make new images via linear interpolation between nearest neighbors of the input vector (e.g. oh, this is a goblin card, let me stack every goblin I know into one unfortunate looking image). What we really need is to train it to distill the "essence" of a goblin and just give us that rather than just haphazardly throwing together images. I think we can accomplish this with some kind of (de)convolutional neural network, but Torch doesn't come with exactly what I need. I'm doing some searching to find out if it's been done before in Torch by anyone else. I think it's available in Caffe, another library, but I'd rather avoid having to learn how to use another library when I only half-way understand Torch, haha. But I'll figure it out and get back to y'all.
By architecture I mean neural architecture, and just a clever arrangement of linear layers. The problem with that is that that's not what we really need. What'll end up happening, at best, is that it'll make new images via linear interpolation between nearest neighbors of the input vector (e.g. oh, this is a goblin card, let me stack every goblin I know into one unfortunate looking image). What we really need is to train it to distill the "essence" of a goblin and just give us that rather than just haphazardly throwing together images[...]
Would it make sense to use an autoencoder here? For those who don't know, an autoencoder is made up of two parts; and encoder followed by a decoder. The encoder takes your image (of size m by n) and compresses it down to a size much smaller than m*n. The decoder then takes the small encoding and tries to remake the image. The idea is that the encoder is learning to distill the image down to its important parts. You could then add an additional cost onto the encoder part which tries to force the encoding to resemble the word-to-vec vectors.
So for training it would look like this: you use a card's image as both the input and the decoder's target. You also use the card's vector representation as the target for the encoder.
Then, for image creation, you chop off the encoder part and just input the new card's vector representation as input to the decoder.
Unfortunately, my autoencoder experience is second-hand, so I'd be curious to know what you think.
By architecture I mean neural architecture, and just a clever arrangement of linear layers. The problem with that is that that's not what we really need. What'll end up happening, at best, is that it'll make new images via linear interpolation between nearest neighbors of the input vector (e.g. oh, this is a goblin card, let me stack every goblin I know into one unfortunate looking image). What we really need is to train it to distill the "essence" of a goblin and just give us that rather than just haphazardly throwing together images[...]
Would it make sense to use an autoencoder here? For those who don't know, an autoencoder is made up of two parts; and encoder followed by a decoder. The encoder takes your image (of size m by n) and compresses it down to a size much smaller than m*n. The decoder then takes the small encoding and tries to remake the image. The idea is that the encoder is learning to distill the image down to its important parts. You could then add an additional cost onto the encoder part which tries to force the encoding to resemble the word-to-vec vectors.
So for training it would look like this: you use a card's image as both the input and the decoder's target. You also use the card's vector representation as the target for the encoder.
Then, for image creation, you chop off the encoder part and just input the new card's vector representation as input to the decoder.
Unfortunately, my autoencoder experience is second-hand, so I'd be curious to know what you think.
Actually, yes, that could work. I'm relatively new to the topic myself, but I was doing some reading on the applications of (variational) autoencoders for image generation the other day. I'll need to figure out the right way to implement all that with Torch, but it's definitely worth trying. Yes, that's probably what I'll do. Thank you so much for suggesting it and laying out a way forward.
Oh, and for those of you reading this who have no idea what we're talking about, take a look at this fun demo. It'll take a second to load, but it's worth it, it's a face-maker. Adjust the learned parameters, and get different faces.
EDIT: Since I hate letting a day go by without showing off some of the network's creations, here you go:
Soran Sphinx 3RWW
Planeswalker - Elspeth
+1: Tap target permanent.
-2: Destroy target permanent.
-12: You get an emblem with "Whenever you cast a spell, exile target permanent."
3
#Do all the things to all the permanents!
Dash of the Ancients XXXXB
Sorcery
Choose a creature type. Destroy all creatures of the chosen type that target player controls. They can't be regenerated. You gain X life.
#rofl. So, ignoring the obscene X cost, it's a one-sided Extinction for one mana.
Bringer of the White Gales 3WWW
Creature - Angel
Flying
At the beginning of your upkeep, sacrifice Bringer of the White Gales unles you pay 2WW. 1: Target multicolored creature gains "At the beginning of your upkeep, you may gain 1 life."
4/5
#I think the ability granted by Bringer of the White Gales lasts indefinitely.
Briarberry Cohort 4G
Creature - Wombat Monk
At the beginning of your upkeep, put a shred counter on Briarberry Cohort, then put the top card of your library into your graveyard.
Whenever you cast an instant or sorcery spell while Briarberry Cohort has three or more shred counters on it, you may search your library for a card named Briarberry Cohort, reveal it, and put it into your hand. If you do, shuffle your library.
5/5
#I swear, the latest version of the network produces some of the strangest things. Coherent, which is good, but strange nevertheless.
Grim Backwoods
Land T: Add 1 to your mana pool. G,T: Put a 1/1 green Cat Shaman creature token onto the battlefield.
Sorcerer's Stronghold
Land T: Add 1 to your mana pool. T, sacrifice Sorcerer's Stronghold: Destroy target permanent.
#An original name, and a "balanced" version of Wasteland.
Crucible of the Storm
Land T: Add W or B to your mana pool. 2, T, sacrifice Crucible of the Storm: Draw a card.
Reaping the Rewards 5WW
Enchantment
Whenever an opponent casts a blue or black spell, that player reveals a card at random from his or her hand. If it's a land card, that player puts it onto the battlefield. Otherwise, that player casts it without paying its mana cost if able.
#All right! Color hate! ... Wait. No.
Hyperion Blacksmith 2
Legendary Artifact Creature - Construct
Whenever a player names a card, that player exiles a card from his or her hand.
1/1
#YES! YES! "Name a card" hate!
How exactly does the network learn? Does it require a human to sit there and tell it "Yes, you did good. No, that's not right." as it generates cards (Or parts of them) or is it mostly self-teaching?
Also, this was great, simply for the name:
Gargoyle Hooters
{11}{R}
Creature - Human Coralrrafk
Defender
4/3
How exactly does the network learn? Does it require a human to sit there and tell it "Yes, you did good. No, that's not right." as it generates cards (Or parts of them) or is it mostly self-teaching?
Also, this was great, simply for the name:
Gargoyle Hooters
{11}{R}
Creature - Human Coralrrafk
Defender
4/3
Hello Evilferret! Nice name, I own two myself.
To answer your question, this is an example of unsupervised learning, so it's all self-taught. It goes over the input text and, after each character, tries to predict what comes next. When it predicts incorrectly, it adjusts its rules so that it makes the correct prediction. Over time, it learns complex relationships (e.g. If it saw G in the mana cost, and "creature" for the type, it thinks the word "elf" is more likely to be in the subtype than "vedalken"). In doing so, it then is capable of producing cards of its own. Like a train building up speed, it starts at the beginning of the card and then all of the pieces fall into place (e.g. "Let's make the mana cost 1UU! If we're going to do that, let's make it an instant! An instant that is a counterspell! A counterspell that cantrips! And grants tromple!"). Sometimes this leads to interesting derailments, like Gargoyle Hooters with the subtype "Coralrrafk". But it's not random. It probably was trying for something like "Coralfolk" (that it brought the word to an end with the letter "k" is very telling).
Gargoyle Hooters is, in the network's mind, a perfectly valid Magic card, based on what it learned about Magic cards. If it could feel (and I would like to take this opportunity to reiterate that it cannot), I imagine it would think itself supremely clever.
Briarberry Cohort 4G
Creature - Wombat Monk
At the beginning of your upkeep, put a shred counter on Briarberry Cohort, then put the top card of your library into your graveyard.
Whenever you cast an instant or sorcery spell while Briarberry Cohort has three or more shred counters on it, you may search your library for a card named Briarberry Cohort, reveal it, and put it into your hand. If you do, shuffle your library.
5/5
#I swear, the latest version of the network produces some of the strangest things. Coherent, which is good, but strange nevertheless.
Hyperion Blacksmith 2
Legendary Artifact Creature - Construct
Whenever a player names a card, that player exiles a card from his or her hand.
1/1
#YES! YES! "Name a card" hate!
"And my Briarberry Cohort attac--"
"Ha! Exile a card!"
"Why?"
"Because of Hyperion Blacksmith ohdammit."
I made an account just so I could submit some requests on this thread.
I was wondering how the network would create balanced special lands like Bosejiu or Reflecting Pool. Could somebody with one of these networks plug in all of the lands with additional abilities besides just tapping for mana (such as life gain, cycling, etc.) and see what happens?
I made an account just so I could submit some requests on this thread.
I was wondering how the network would create balanced special lands like Bosejiu or Reflecting Pool. Could somebody with one of these networks plug in all of the lands with additional abilities besides just tapping for mana (such as life gain, cycling, etc.) and see what happens?
I'll try to handle your request. Here are a few lands matching your description:
Tower of Coireall
Land T: Add 1 to your mana pool. 1UW, T, exile a creature card from your graveyard: Put a 2/2 black zombie creature token onto the battlefield.
Unstable Mutation
Land T: Add 1 to your mana pool. 2,T: Reveal the top card of your library. If it's a land card, put that card into your hand and exile all other cards revealed this way.
Rackling
Land T: Add 1 to your mana pool. 1R,T: target land becomes a 2/2 green and white worm artifact creature that's still a land. 2, sacrifice Rackling: Draw a card.
Magosi, the Watcher's Revolt
Land T: Add R to your mana pool. Magosi, the Watcher's Revolt deals 1 damage to you.
Threshold - U,T,sacrifice Magosi, the Watcher's Revolt: Tap target permanent.
Artificience
Land
Artificience can't be countered. T: Add 1 to your mana pool.
The Sea Portal
Land T: Add 1 to your mana pool. 2RB, T,sacrifice The Sea Portal: The Sea Portal deals 3 damage to each creature and each player.
Temple of Mystery
Land T: Add B to your mana pool. B,T: Target black creature gains haste until end of turn.
Mosstodon
Land T, exile a creature you control: Put a storage counter on Mosstodon. T: Add XX to your mana pool, where X is the number of storage counters on Mosstodon.
There's a lot of cool information on how to tweak the RNN and custom scripts here. Unfortunately, they're getting buried within this 50 page thread. It would be nice if there a github or something to collate all this stuff in a central place.
Bringer of the White Gales
3WWW
Creature - Angel
Flying
At the beginning of your upkeep, sacrifice Bringer of the White Gales unles you pay 2WW.
1: Target multicolored creature gains "At the beginning of your upkeep, you may gain 1 life."
4/5
#I think the ability granted by Bringer of the White Gales lasts indefinitely.
It absolutely would last indefinitely, and they stack on the same creature. SO you can pay 6 to give a multicolored creature
"At the beginning of your upkeep, you may gain 1 life."
"At the beginning of your upkeep, you may gain 1 life."
"At the beginning of your upkeep, you may gain 1 life."
"At the beginning of your upkeep, you may gain 1 life."
"At the beginning of your upkeep, you may gain 1 life."
"At the beginning of your upkeep, you may gain 1 life."
Also I believe the wing in the art you posted is from Sea Drake.
There's a lot of cool information on how to tweak the RNN and custom scripts here. Unfortunately, they're getting buried within this 50 page thread. It would be nice if there a github or something to collate all this stuff in a central place.
Well, to be fair, this all took off much faster and more explosively than I originally thought it would. But what ended up happening is that a lot of knowledgeable people came forward with all kinds of suggestions and improvements, and with each iteration the outputs have been getting better and better.
As for the encoding for the cards, hardcast_sixdrop has a github that I mention on the first page. As for the custom scripts, I might see if he wants to host the most recent version of that file. I'll probably put up something on github myself once I have a more complete product to show (with network snapshots for card generation, flavor text generation, art generation, set construction, etc.). That way people don't have to hunt down all the little components scattered across the thread.
@Kinje (or anyone having a clue, really): when allocating RAM to your first Virtual Machine, what kind of values should you aim for? Are the estimations from VirtualBox (green/yellow/red) reliable or generic?
I wish that I had an answer for you, as I do use VirtualBox now and then, but I'm not quite sure just how much RAM you'll need to allocate. I haven't been tracking things like peak memory consumption for the training script, though that's probably something I'll need to do at some point to better document the resource requirements. But I'm sure someone else would know. If no one comes forward, I'll see if I can find an answer for you later.
Also I believe the wing in the art you posted is from Sea Drake.
That is definitely plausible, very good eye! I had originally thought that it was a dragon, but I didn't think to look further out on the family tree. My brain automatically assumed there were forelegs, but I was probably just mistaking low resolution noise for meaningful content.
It just dawned on me exactly what we need:
WE WANT TO SUPPLY A SEPARATE VALIDATION FILE validation.txt
You know, that might be a good idea to test in the near future. For example, the validation set should contain a sampling of all the different mechanics, in order to aid the learning process. That's something we can't guarantee if we're randomly determining the set.
Er, are we talking about the same thing? I was referring to an example of splicing occuring in a "if it was kicker" clause, not to the Kiker/kicker (non-)issue. It added some irrelevant text after an "if it was kicked" (due to splicing? why else do that several times?) but falls back to a normal if kicked clause after the | char that's common to the clause and the spliced text. I'll post another very funny example of the network falling back on its feet after a big derailment when I have both the data and an internet connection.
Ah, gotcha. I thought you were specifically referring to the sequence length problem where cards can get chopped up at sequence boundaries and different pieces get trained on separately, making it harder to learn the connections between the content of the different pieces.
Can you explain to me the use of your special characters then? For example, in this snippet
-> when @ enters the battlefield, if it was kicked with its 2 less|, |flying|, |first strike|, |haste|, and |haste|.
What purpose does the "|" serve?
EDIT: For the record, I've sketched out how we'll need to do art generation, but due to work obligations, it may be a bit before I get around to actually testing that out. But I'll be sure to let y'all know as soon as I have results to share.
One of the early goals of this project was to eventually create whole sets for draft, or at least single booster packs that could be used for Pack Wars or something similar. Is the network capable of such a project at the current time? For example, if we gave it existing mechanics, so it would be something like a core set?
One of the early goals of this project was to eventually create whole sets for draft, or at least single booster packs that could be used for Pack Wars or something similar. Is the network capable of such a project at the current time? For example, if we gave it existing mechanics, so it would be something like a core set?
Yes, I would say so. The card quality still needs work because there are still some color discipline issues, and we're still working on aesthetic issues like artwork and flavor text, but yes. We can generate reams of cards according to various specifications, and then use a script to filter through them and assemble them into a set (e.g. I need this many black instants at these CMCs, etc.). We haven't trained the network on card rarity yet, but that could easily be done and would probably be useful for drafting purposes.
All that we'd really need at this point is to write a script to do the filtering and the assembling, but that's a relatively easy task.
---
By the way, a couple more interesting cards, just thought I'd share:
Ability Thirst (W/U)
Enchantment
Whenever a creature you control becomes the target of a spell or ability, its controller puts the top two cards of his or her library into his or her graveyard.
#I actually rather like the concept behind this card. Might need some work if it were to see print in a real set, but it's an interesting idea.
Boltwing Marauder (B/R)(B/R)
Creature - Human Wizard
When Boltwing Marauder enters the battlefield, gain control of target land until end of turn. It gains haste until end of turn.
1/2
#That's a very unusual effect.
Deathrene Trap GGG
Instant - Trap
If an opponent cast a creature spell you cast this turn was countered by a spell or ability an opponent controlled, you may pay G rather than pay Deathrene Trap's mana cost.
Put two 1/1 green saproling tokens onto the battlefield.
Storm
#The intent of the trap clause is clear but the text is somewhat garbled. Still, an interesting card.
EDIT: Just an FYI, I'm currently doing some experiments with an autoencoder implementation that I'm fond of. If it works well enough on the dataset provided (and I can figure out the right parameters to use), I'll see about converting the Magic card image data into a format that I can feed to it, and we can go from there.
First, at low temperatures, you should expect to see repetition like what you're describing. To quote Karpathy's article:
Temperature. We can also play with the temperature of the Softmax during sampling. Decreasing the temperature from 1 to some lower number (e.g. 0.5) makes the RNN more confident, but also more conservative in its samples. Conversely, higher temperatures will give more diversity but at cost of more mistakes (e.g. spelling mistakes, etc). In particular, setting temperature very near zero will give the most likely thing that Paul Graham might say:
"is that they were all the same thing that was a startup is that they were all the same thing that was a startup is that they were all the same thing that was a startup is that they were all the same"
looks like we've reached an infinite loop about startups.
Second, I'm seeing some very weird aberrations in your output, strange repetitions. For example,
Crockgrown Hereed 3B
Color B Creature 4/4 — Wall
Color B Creature 4/4 — Zombie Giant
Color B Creature 4/4 — Zombie Beast Insect
-> |flying|, |haste|
Color B Creature 4/4 — Warrior Zombie
-> |morph 3B|
# No, adding a morph ability does NOT make it up for morphing the types
I'm seeing a little of that when I use the field-randomized version of hardcast_sixdrop's input (but in a much more minor form). This the kind of problem that I have never seen when we used a rigid input format with unambiguous characters delimiting fields. My hypothesis is that your problem is strongly tied to your input format.
For example, you open and close fields with different characters, and these characters have different meanings in different situations. For example, as far as I can tell above, you use spaces to mark the end of the name and the start of the mana cost and a newline character to end the mana cost. Spaces are used in many different situations, and a newline character is used to mark a linebreak in the body also.
When you do things like that, it makes it harder for the network to learn about the restrictions a Magic card has to have in terms of how many of each field there needs to be. I'm very confident that if you clean up your input format, you won't see these sorts of problems happen so often. To be clear, I like your novel innovations, like with cumulative upkeep, and I think you could get really good results with that, and with some changes you should start seeing much more consistent output.
Third, from your file,
- The libraries are virtual, a card is generated whenever a new library card must be used
- Illegal cards are (revealed, ignored and) regenerated. (An experienced player is certainly required for this to work! Could be great for teaching less experienced players?)
- Each player chooses a (different) color, last looser first (I'm guessing some colors may prove to be more playable than others).
- You could go the client-server route, providing a private visual for each player, but I think something more physical would be less geeky and more party-appropriate, a phablet or laptop that each player would consult privately when they get to know a private card. So you'd need small thick papers on which to note down the main points of your card, and each card bears a unique label for ID. If players are White and Blue, the cards would be labelled W1, W2, etc., and likewise B1, B2, ... This ID is needed when your card becomes public, you simply instruct the program to show this card (that it knows you've drawn) using its ID.
That's a fun idea. Might be worth exploring further in the future.
Fourth, as for the color issues, it'd be hard to answer that definitively without statistical analysis. Of course, we'd also have to prepare a script to convert your input format to a form that could be easily analyzed.
EDIT: Also, could you list your training parameters? Perhaps I missed them. That would also be informative.
EDIT(2): Oh, also, have you considered converting your text to lower case? That reduces the number of different characters that we have to consider when making predictions.
EDIT(3): To those of you who are interested to know, I'm still at work on the whole art generation thing. Might have stumbled upon something. But we'll see.
EDIT(4): I'm launching a fairly small experiment with an implementation provided by Facebook. We'll see if anything comes of it, and if so, I'll see about launching larger experiments.
EDIT(5): Finished an epoch. I have a model. Now I just need to figure out how to sample it. I need it to reveal its secrets to me.
@talcos, is the vector representation of cards reversible, from vectors back to full card info? If yes, couldn't we use that as the corpus encoding?
The issue is that we're still seeing the "if kicked (but no kicker)" problem even when we do duplication that should mitigate any effects of splicing, so I'm tempted to say that splicing is not responsible for that problem. In any case, I can do some more experiments in the future to see whether we can get that under control, haha.
The process is not perfectly reversible because the vectorization, as I specified it, does not preserve word orderings. This can lead to confusions like I mentioned, such as whether a card was an elf that made goblin tokens or a goblin that made elf tokens. A smart decoder network could reconstruct the original card, but it may not get everything right (because it can have multiple, equally valid alternatives to choose from).
Oh, and I found an XML file containing the full text of every spell in Pathfinder, so that kind of data is available for it. Not sure if I have the time to write the scripts necessary to extract the necessary informtion though. Of course, if anyone's interested in doing that or has the data in a form that I can readily use, I can run experiments for them.
---
Quick question, can anyone recognize the art in the image that I've attached?
I'm running some very small tests with grayscale images to cut down on computation time. I need to know where the network is getting its inspiration, because I'm fairly confident this one is an attempt at an exact copy.
I also got one out that was an ungodly hybrid of Abattoir Ghoul and I think Alabaster Dragon. But I wasn't able to figure this one out.
My LinkedIn profile... thing (I have one of those now!).
My research team's webpage.
The mtg-rnn repo and the mtg-encode repo.
I would really like to see that ungodly hybrid
Thanks!
So it probably isn't Alabaster Dragon, but I know Abattoir Ghoul is in the art because I passed his content vector and in the bottom right corner I recognize the shoulder blade, but I'm seeing what looks like a pair of wings in the background, as if the art got interspersed with some other art. The problem with that image is that I was using an absolute value function to determine the error, and it caused the images to become very strongly white and black.
Also, bear in mind, this is very, very, very preliminary stuff (the art will be in color and much more coherent). I'm actually using an architecture that's ill-suited for image generation and I'm forcing it to do what I want and the results are lackluster. I was just testing the input/output process to make sure everything was working as it should.
EDIT: As for why Abzan Runemark, it's because I picked the exact vector for it and didn't realize it (the order of the vectors in the training data isn't quite the same as the order I originally had them in, and I stripped out the names, so I couldn't figure it out, haha).
My LinkedIn profile... thing (I have one of those now!).
My research team's webpage.
The mtg-rnn repo and the mtg-encode repo.
If this can be relatively easy to set up in Torch I would really like to try this myself when I get home. I'm guessing it's not though, and if you've been at this for 24 hours with a gtx Titan I probably won't get very far with my inferior card.
By architecture I mean neural architecture, and just a clever arrangement of linear layers. The problem with that is that that's not what we really need. What'll end up happening, at best, is that it'll make new images via linear interpolation between nearest neighbors of the input vector (e.g. oh, this is a goblin card, let me stack every goblin I know into one unfortunate looking image). What we really need is to train it to distill the "essence" of a goblin and just give us that rather than just haphazardly throwing together images. I think we can accomplish this with some kind of (de)convolutional neural network, but Torch doesn't come with exactly what I need. I'm doing some searching to find out if it's been done before in Torch by anyone else. I think it's available in Caffe, another library, but I'd rather avoid having to learn how to use another library when I only half-way understand Torch, haha. But I'll figure it out and get back to y'all.
My LinkedIn profile... thing (I have one of those now!).
My research team's webpage.
The mtg-rnn repo and the mtg-encode repo.
Would it make sense to use an autoencoder here? For those who don't know, an autoencoder is made up of two parts; and encoder followed by a decoder. The encoder takes your image (of size m by n) and compresses it down to a size much smaller than m*n. The decoder then takes the small encoding and tries to remake the image. The idea is that the encoder is learning to distill the image down to its important parts. You could then add an additional cost onto the encoder part which tries to force the encoding to resemble the word-to-vec vectors.
So for training it would look like this: you use a card's image as both the input and the decoder's target. You also use the card's vector representation as the target for the encoder.
Then, for image creation, you chop off the encoder part and just input the new card's vector representation as input to the decoder.
Unfortunately, my autoencoder experience is second-hand, so I'd be curious to know what you think.
Actually, yes, that could work. I'm relatively new to the topic myself, but I was doing some reading on the applications of (variational) autoencoders for image generation the other day. I'll need to figure out the right way to implement all that with Torch, but it's definitely worth trying. Yes, that's probably what I'll do. Thank you so much for suggesting it and laying out a way forward.
Oh, and for those of you reading this who have no idea what we're talking about, take a look at this fun demo. It'll take a second to load, but it's worth it, it's a face-maker. Adjust the learned parameters, and get different faces.
EDIT: Since I hate letting a day go by without showing off some of the network's creations, here you go:
Soran Sphinx
3RWW
Planeswalker - Elspeth
+1: Tap target permanent.
-2: Destroy target permanent.
-12: You get an emblem with "Whenever you cast a spell, exile target permanent."
3
#Do all the things to all the permanents!
Dash of the Ancients
XXXXB
Sorcery
Choose a creature type. Destroy all creatures of the chosen type that target player controls. They can't be regenerated. You gain X life.
#rofl. So, ignoring the obscene X cost, it's a one-sided Extinction for one mana.
Bringer of the White Gales
3WWW
Creature - Angel
Flying
At the beginning of your upkeep, sacrifice Bringer of the White Gales unles you pay 2WW.
1: Target multicolored creature gains "At the beginning of your upkeep, you may gain 1 life."
4/5
#I think the ability granted by Bringer of the White Gales lasts indefinitely.
Briarberry Cohort
4G
Creature - Wombat Monk
At the beginning of your upkeep, put a shred counter on Briarberry Cohort, then put the top card of your library into your graveyard.
Whenever you cast an instant or sorcery spell while Briarberry Cohort has three or more shred counters on it, you may search your library for a card named Briarberry Cohort, reveal it, and put it into your hand. If you do, shuffle your library.
5/5
#I swear, the latest version of the network produces some of the strangest things. Coherent, which is good, but strange nevertheless.
Grim Backwoods
Land
T: Add 1 to your mana pool.
G,T: Put a 1/1 green Cat Shaman creature token onto the battlefield.
Sorcerer's Stronghold
Land
T: Add 1 to your mana pool.
T, sacrifice Sorcerer's Stronghold: Destroy target permanent.
#An original name, and a "balanced" version of Wasteland.
Crucible of the Storm
Land
T: Add W or B to your mana pool.
2, T, sacrifice Crucible of the Storm: Draw a card.
Reaping the Rewards
5WW
Enchantment
Whenever an opponent casts a blue or black spell, that player reveals a card at random from his or her hand. If it's a land card, that player puts it onto the battlefield. Otherwise, that player casts it without paying its mana cost if able.
#All right! Color hate! ... Wait. No.
Hyperion Blacksmith
2
Legendary Artifact Creature - Construct
Whenever a player names a card, that player exiles a card from his or her hand.
1/1
#YES! YES! "Name a card" hate!
My LinkedIn profile... thing (I have one of those now!).
My research team's webpage.
The mtg-rnn repo and the mtg-encode repo.
Also, this was great, simply for the name:
Gargoyle Hooters
{11}{R}
Creature - Human Coralrrafk
Defender
4/3
Hello Evilferret! Nice name, I own two myself.
To answer your question, this is an example of unsupervised learning, so it's all self-taught. It goes over the input text and, after each character, tries to predict what comes next. When it predicts incorrectly, it adjusts its rules so that it makes the correct prediction. Over time, it learns complex relationships (e.g. If it saw G in the mana cost, and "creature" for the type, it thinks the word "elf" is more likely to be in the subtype than "vedalken"). In doing so, it then is capable of producing cards of its own. Like a train building up speed, it starts at the beginning of the card and then all of the pieces fall into place (e.g. "Let's make the mana cost 1UU! If we're going to do that, let's make it an instant! An instant that is a counterspell! A counterspell that cantrips! And grants tromple!"). Sometimes this leads to interesting derailments, like Gargoyle Hooters with the subtype "Coralrrafk". But it's not random. It probably was trying for something like "Coralfolk" (that it brought the word to an end with the letter "k" is very telling).
Gargoyle Hooters is, in the network's mind, a perfectly valid Magic card, based on what it learned about Magic cards. If it could feel (and I would like to take this opportunity to reiterate that it cannot), I imagine it would think itself supremely clever.
My LinkedIn profile... thing (I have one of those now!).
My research team's webpage.
The mtg-rnn repo and the mtg-encode repo.
"And my Briarberry Cohort attac--"
"Ha! Exile a card!"
"Why?"
"Because of Hyperion Blacksmith ohdammit."
I was wondering how the network would create balanced special lands like Bosejiu or Reflecting Pool. Could somebody with one of these networks plug in all of the lands with additional abilities besides just tapping for mana (such as life gain, cycling, etc.) and see what happens?
I'll try to handle your request. Here are a few lands matching your description:
Tower of Coireall
Land
T: Add 1 to your mana pool.
1UW, T, exile a creature card from your graveyard: Put a 2/2 black zombie creature token onto the battlefield.
Unstable Mutation
Land
T: Add 1 to your mana pool.
2,T: Reveal the top card of your library. If it's a land card, put that card into your hand and exile all other cards revealed this way.
Rackling
Land
T: Add 1 to your mana pool.
1R,T: target land becomes a 2/2 green and white worm artifact creature that's still a land.
2, sacrifice Rackling: Draw a card.
Magosi, the Watcher's Revolt
Land
T: Add R to your mana pool. Magosi, the Watcher's Revolt deals 1 damage to you.
Threshold - U,T,sacrifice Magosi, the Watcher's Revolt: Tap target permanent.
Artificience
Land
Artificience can't be countered.
T: Add 1 to your mana pool.
The Sea Portal
Land
T: Add 1 to your mana pool.
2RB, T,sacrifice The Sea Portal: The Sea Portal deals 3 damage to each creature and each player.
Temple of Mystery
Land
T: Add B to your mana pool.
B,T: Target black creature gains haste until end of turn.
Mosstodon
Land
T, exile a creature you control: Put a storage counter on Mosstodon.
T: Add XX to your mana pool, where X is the number of storage counters on Mosstodon.
My LinkedIn profile... thing (I have one of those now!).
My research team's webpage.
The mtg-rnn repo and the mtg-encode repo.
It absolutely would last indefinitely, and they stack on the same creature. SO you can pay 6 to give a multicolored creature
"At the beginning of your upkeep, you may gain 1 life."
"At the beginning of your upkeep, you may gain 1 life."
"At the beginning of your upkeep, you may gain 1 life."
"At the beginning of your upkeep, you may gain 1 life."
"At the beginning of your upkeep, you may gain 1 life."
"At the beginning of your upkeep, you may gain 1 life."
Also I believe the wing in the art you posted is from Sea Drake.
Well, to be fair, this all took off much faster and more explosively than I originally thought it would. But what ended up happening is that a lot of knowledgeable people came forward with all kinds of suggestions and improvements, and with each iteration the outputs have been getting better and better.
As for the encoding for the cards, hardcast_sixdrop has a github that I mention on the first page. As for the custom scripts, I might see if he wants to host the most recent version of that file. I'll probably put up something on github myself once I have a more complete product to show (with network snapshots for card generation, flavor text generation, art generation, set construction, etc.). That way people don't have to hunt down all the little components scattered across the thread.
I wish that I had an answer for you, as I do use VirtualBox now and then, but I'm not quite sure just how much RAM you'll need to allocate. I haven't been tracking things like peak memory consumption for the training script, though that's probably something I'll need to do at some point to better document the resource requirements. But I'm sure someone else would know. If no one comes forward, I'll see if I can find an answer for you later.
That is definitely plausible, very good eye! I had originally thought that it was a dragon, but I didn't think to look further out on the family tree. My brain automatically assumed there were forelegs, but I was probably just mistaking low resolution noise for meaningful content.
You know, that might be a good idea to test in the near future. For example, the validation set should contain a sampling of all the different mechanics, in order to aid the learning process. That's something we can't guarantee if we're randomly determining the set.
Ah, gotcha. I thought you were specifically referring to the sequence length problem where cards can get chopped up at sequence boundaries and different pieces get trained on separately, making it harder to learn the connections between the content of the different pieces.
Can you explain to me the use of your special characters then? For example, in this snippet
What purpose does the "|" serve?
EDIT: For the record, I've sketched out how we'll need to do art generation, but due to work obligations, it may be a bit before I get around to actually testing that out. But I'll be sure to let y'all know as soon as I have results to share.
My LinkedIn profile... thing (I have one of those now!).
My research team's webpage.
The mtg-rnn repo and the mtg-encode repo.
Yes, I would say so. The card quality still needs work because there are still some color discipline issues, and we're still working on aesthetic issues like artwork and flavor text, but yes. We can generate reams of cards according to various specifications, and then use a script to filter through them and assemble them into a set (e.g. I need this many black instants at these CMCs, etc.). We haven't trained the network on card rarity yet, but that could easily be done and would probably be useful for drafting purposes.
All that we'd really need at this point is to write a script to do the filtering and the assembling, but that's a relatively easy task.
---
By the way, a couple more interesting cards, just thought I'd share:
Ability Thirst
(W/U)
Enchantment
Whenever a creature you control becomes the target of a spell or ability, its controller puts the top two cards of his or her library into his or her graveyard.
#I actually rather like the concept behind this card. Might need some work if it were to see print in a real set, but it's an interesting idea.
Orbweaver Kelpie
1(U/B)(U/B)
Creature - Illusion
T: Target creature an opponent controls phases out.
2/2
Boltwing Marauder
(B/R)(B/R)
Creature - Human Wizard
When Boltwing Marauder enters the battlefield, gain control of target land until end of turn. It gains haste until end of turn.
1/2
#That's a very unusual effect.
Deathrene Trap
GGG
Instant - Trap
If an opponent cast a creature spell you cast this turn was countered by a spell or ability an opponent controlled, you may pay G rather than pay Deathrene Trap's mana cost.
Put two 1/1 green saproling tokens onto the battlefield.
Storm
#The intent of the trap clause is clear but the text is somewhat garbled. Still, an interesting card.
EDIT: Just an FYI, I'm currently doing some experiments with an autoencoder implementation that I'm fond of. If it works well enough on the dataset provided (and I can figure out the right parameters to use), I'll see about converting the Magic card image data into a format that I can feed to it, and we can go from there.
My LinkedIn profile... thing (I have one of those now!).
My research team's webpage.
The mtg-rnn repo and the mtg-encode repo.
First, at low temperatures, you should expect to see repetition like what you're describing. To quote Karpathy's article:
Second, I'm seeing some very weird aberrations in your output, strange repetitions. For example,
I'm seeing a little of that when I use the field-randomized version of hardcast_sixdrop's input (but in a much more minor form). This the kind of problem that I have never seen when we used a rigid input format with unambiguous characters delimiting fields. My hypothesis is that your problem is strongly tied to your input format.
For example, you open and close fields with different characters, and these characters have different meanings in different situations. For example, as far as I can tell above, you use spaces to mark the end of the name and the start of the mana cost and a newline character to end the mana cost. Spaces are used in many different situations, and a newline character is used to mark a linebreak in the body also.
When you do things like that, it makes it harder for the network to learn about the restrictions a Magic card has to have in terms of how many of each field there needs to be. I'm very confident that if you clean up your input format, you won't see these sorts of problems happen so often. To be clear, I like your novel innovations, like with cumulative upkeep, and I think you could get really good results with that, and with some changes you should start seeing much more consistent output.
Third, from your file,
That's a fun idea. Might be worth exploring further in the future.
Fourth, as for the color issues, it'd be hard to answer that definitively without statistical analysis. Of course, we'd also have to prepare a script to convert your input format to a form that could be easily analyzed.
EDIT: Also, could you list your training parameters? Perhaps I missed them. That would also be informative.
EDIT(2): Oh, also, have you considered converting your text to lower case? That reduces the number of different characters that we have to consider when making predictions.
EDIT(3): To those of you who are interested to know, I'm still at work on the whole art generation thing. Might have stumbled upon something. But we'll see.
EDIT(4): I'm launching a fairly small experiment with an implementation provided by Facebook. We'll see if anything comes of it, and if so, I'll see about launching larger experiments.
EDIT(5): Finished an epoch. I have a model. Now I just need to figure out how to sample it. I need it to reveal its secrets to me.
My LinkedIn profile... thing (I have one of those now!).
My research team's webpage.
The mtg-rnn repo and the mtg-encode repo.