It is currently 27 Aug 2025, 12:40
   
Text Size

New Draft Functionality Finally Done

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Re: New Draft Functionality Finally Done

Postby Rob Cashwalker » 10 May 2011, 19:35

The error is partially in the change for the metadata. The DeckManager is now expecting to match the deckName as the name defined in the deck, not the filename, as it once was.

So here's your corrected .draft file:
Code: Select all
Name:JuzamjediCube
DeckFile:JuzamjediCube
IgnoreRarity:False
LandSetCode:M11
                 
NumCards:9
NumSpecials:0
NumMythics:1
NumRares:1
NumUncommons:3
NumCommons:5
NumPacks:5
I just uploaded a couple revisions that cover some out-of-bounds errors in AI deck construction and the possibility that the deckname provided isn't found.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: New Draft Functionality Finally Done

Postby Chris H. » 10 May 2011, 20:07

Rob Cashwalker wrote:The error is partially in the change for the metadata. The DeckManager is now expecting to match the deckName as the name defined in the deck, not the filename, as it once was.
`
I made this change and was able to get to the draft mode deck editor. I had to place the "JuzamjediCube.dck" file in the /res/decks/ folder.

Wold it make sense for the code to look for the matching custom draft .dck file in the same folder? This way, this file can not appear as a deck in a randomly selected deck or as a deck selected from the list of available decks in a constructed mode game.

Just a thought as it might confuse some people.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: New Draft Functionality Finally Done

Postby bane221 » 10 May 2011, 20:16

With a full revision update, I can run the custom draft. On choosing the last card of the last pack, I hit this error:

Code: Select all
An error has occurred. You can copy/paste this message or save it to a file.
Please report this, plus what you tried to do, to:
   http://www.slightlymagic.net/forum/viewforum.php?f=26
If you don't want to register an account, you can mail it directly to
   mtgerror@yahoo.com


n must be positive


Version:
Forge -- official beta: $Date: 2011-01-06 11:34:48 -0500 (Thu, 06 Jan 2011) $, SVN revision: $Revision: 4891 $

OS: Windows Vista Version: 6.0 Architecture: amd64

Java Version: 1.6.0_25 Vendor: Sun Microsystems Inc.

Detailed error trace:
java.lang.IllegalArgumentException: n must be positive
   at java.util.Random.nextInt(Unknown Source)
   at forge.BoosterDraftAI.choose(Unknown Source)
   at forge.BoosterDraft_1.computerChoose(Unknown Source)
   at forge.BoosterDraft_1.nextChoice(Unknown Source)
   at forge.Gui_BoosterDraft.jButton1_actionPerformed(Unknown Source)
   at forge.Gui_BoosterDraft$5.actionPerformed(Unknown Source)
   at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
   at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
   at java.awt.Component.processMouseEvent(Unknown Source)
   at javax.swing.JComponent.processMouseEvent(Unknown Source)
   at java.awt.Component.processEvent(Unknown Source)
   at java.awt.Container.processEvent(Unknown Source)
   at java.awt.Component.dispatchEventImpl(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Window.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$000(Unknown Source)
   at java.awt.EventQueue$1.run(Unknown Source)
   at java.awt.EventQueue$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue$2.run(Unknown Source)
   at java.awt.EventQueue$2.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)
bane221
 
Posts: 12
Joined: 06 Mar 2011, 22:27
Has thanked: 0 time
Been thanked: 0 time

Re: New Draft Functionality Finally Done

Postby juzamjedi » 10 May 2011, 21:56

Excellent, I made the change to my .draft file suggested by Rob and it works!

I did a draft and 3 observations:
1. I saw a number of cards repeat. I'm guessing this is because I had IgnoreRarity = False (whoops) and I don't have a lot of commons in my cube (this is intentional).
2. The AI could still use some improvement on what cards to value in draft. For example I had a Mox Jet + Library of Alexandria in the same pack, both were passed to me. I'll guess you probably have an algorithm to take good cards in a couple of colors, but make sure the AI knows to take artifacts / lands that are insane.
3. Turn 1 Forest, Llanowar Elf loses to Turn 1 Terramorphic, Turn 2 Mox Jet + Tinker for Sphinx of the Steel Wind :P
juzamjedi
Tester
 
Posts: 575
Joined: 13 Nov 2008, 08:35
Has thanked: 6 times
Been thanked: 8 times

Re: New Draft Functionality Finally Done

Postby bane221 » 10 May 2011, 22:45

I tried a number of revisions to my .draft file and continuously hit that same error on drafting the final card.
I used some of the exact coding from your suggestions but made my own deck file to go with it.
This is my most current .draft:

Code: Select all
Name:artifactdraft
DeckFile:artifactdraft
IgnoreRarity:True
LandSetCode:M11
                 
NumCards:9
NumSpecials:0
NumMythics:1
NumRares:1
NumUncommons:3
NumCommons:5
NumPacks:5
bane221
 
Posts: 12
Joined: 06 Mar 2011, 22:27
Has thanked: 0 time
Been thanked: 0 time

Re: New Draft Functionality Finally Done

Postby juzamjedi » 10 May 2011, 23:54

Looks like I spoke too soon. I did a second draft and got the error below which happened after my last draft pick (just as described by bane221). This happened when I changed IgnoreRarity=True. Just to confirm I changed back to IgnoreRarity=False and the draft worked fine.

Code: Select all
An error has occurred. You can copy/paste this message or save it to a file.
Please report this, plus what you tried to do, to:
   http://www.slightlymagic.net/forum/viewforum.php?f=26
If you don't want to register an account, you can mail it directly to
   mtgerror@yahoo.com


n must be positive


Version:
Forge -- official beta: $Date: 2011-01-06 11:34:48 -0500 (Thu, 06 Jan 2011) $, SVN revision: $Revision: 4891 $

OS: Windows XP Version: 5.1 Architecture: x86

Java Version: 1.6.0_24 Vendor: Sun Microsystems Inc.

Detailed error trace:
java.lang.IllegalArgumentException: n must be positive
   at java.util.Random.nextInt(Unknown Source)
   at forge.BoosterDraftAI.choose(Unknown Source)
   at forge.BoosterDraft_1.computerChoose(Unknown Source)
   at forge.BoosterDraft_1.nextChoice(Unknown Source)
   at forge.Gui_BoosterDraft.jButton1_actionPerformed(Unknown Source)
   at forge.Gui_BoosterDraft$5.actionPerformed(Unknown Source)
   at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
   at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
   at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
   at java.awt.Component.processMouseEvent(Unknown Source)
   at javax.swing.JComponent.processMouseEvent(Unknown Source)
   at java.awt.Component.processEvent(Unknown Source)
   at java.awt.Container.processEvent(Unknown Source)
   at java.awt.Component.dispatchEventImpl(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Window.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
   at java.awt.EventQueue.access$000(Unknown Source)
   at java.awt.EventQueue$1.run(Unknown Source)
   at java.awt.EventQueue$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue$2.run(Unknown Source)
   at java.awt.EventQueue$2.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)
juzamjedi
Tester
 
Posts: 575
Joined: 13 Nov 2008, 08:35
Has thanked: 6 times
Been thanked: 8 times

Re: New Draft Functionality Finally Done

Postby bane221 » 11 May 2011, 00:18

AH HA!
I can confirm the above post as well. I will be trying that on False on some other drafts. Any thoughts about how that impacts the drafting pool/packs?
bane221
 
Posts: 12
Joined: 06 Mar 2011, 22:27
Has thanked: 0 time
Been thanked: 0 time

Re: New Draft Functionality Finally Done

Postby Rob Cashwalker » 11 May 2011, 17:44

juzamjedi wrote:2. The AI could still use some improvement on what cards to value in draft. For example I had a Mox Jet + Library of Alexandria in the same pack, both were passed to me. I'll guess you probably have an algorithm to take good cards in a couple of colors, but make sure the AI knows to take artifacts / lands that are insane.
In the first 2 picks, the AI chooses the "best" colored creature in the pack, then sets its primary colors based on those picks. For draft purposes, I simply sort the cards based on p/t compared to CMC, with keywords and text size adding some weight.

Subsequent picks are randomly chosen from a more focused list of cards. This list is built like this: The best 2 creatures in its colors. Of the Instants and Sorceries in the pack in its colors, it sorts by CMC and selects the middle one. Of the Enchantments in the pack in its colors, it sorts by CMC, then chooses the cheapest. If there's a planeswalker in the pack in its colors, then it's added. IF there are no cards in its colors, then it looks for the cheapest Artifact and a Land that produces mana in one of its colors.

I attached a pick-by-pick summary, produced from playing your draft pool. If you enable Developer Mode (after I upload a couple revisions today) you can get this list too. (it was too big for the post, and the forum doesn't take txt attachments)

juzamjedi wrote:Looks like I spoke too soon. I did a second draft and got the error below which happened after my last draft pick (just as described by bane221). This happened when I changed IgnoreRarity=True. Just to confirm I changed back to IgnoreRarity=False and the draft worked fine.
Thanks, I found the bug on this. Two parts- One, if you're Ignoring Rarity, then you need to set NumRarity parameters to zero. (after revision, only need NumCards) Two, I fixed the problem in code, by multiplying the NumCards (x NumPacks) instead of asking the BoosterGenerator how many cards were in a pack. (which adds up the NumRarity parameters)

A couple other tweaks go along with this update, including the DevMode checkbox to take effect immediately when clicked, instead of only when launching the game window.
Attachments
JediDraftResults.zip
(14.86 KiB) Downloaded 274 times
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: New Draft Functionality Finally Done

Postby Rob Cashwalker » 11 May 2011, 18:07

Chris H. wrote:Wold it make sense for the code to look for the matching custom draft .dck file in the same folder? This way, this file can not appear as a deck in a randomly selected deck or as a deck selected from the list of available decks in a constructed mode game.

Just a thought as it might confuse some people.
I would do that, but then to edit it again, you'd need to copy it back to the decks folder... and then move it back again. There's another feature request to make decks loadable from any location by file browsing. Once someone does that, then it will make this easier.

It's a really simple change to the DeckManager constructor. Instead of pointing to the decks folder it can point to the draft folder.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: New Draft Functionality Finally Done

Postby juzamjedi » 11 May 2011, 20:51

IMO - leaving the draft decks in the regular folder is fine. The only reason I copied to my draft folder was a futile attempt to fix my problem.

The pick order results are really interesting to look at. In my opinion there are certain cards that are so good you take them no matter what, this is especially true for good artifacts. The list of cards I would take over a Mox is very small (even an off color Mox is incredibly powerful). For similar reasons the strong equipment (Swords, or Jitte) should also be high picks. Otherwise the logic of taking 2 colors and sticking to them is mostly fine. It looks like you're having the AI default to a midrange style deck and that's fine too. If I read these results correctly, it looks like player[0] took Mox Sapphire as a 6th pick which is way too low.

I appreciate that making a good draft algorithm takes work. If I created a new one do you think you could implement it? Is there some sort of hidden value for "bomb rating" etc. for how powerful a card is? Or would it be possible to "train" the AI by recording what the human player takes highly? I think it's most important to train the AI for the first 2-3 picks. After that you could almost tell the AI "take any card in your color or good colorless cards that fit your deck" and it probably turns out OK.

I noticed in a couple of my drafts so far that the AI ends up in 4 colors. I'm wondering if that is a result of some of the gold cards being a single color for purpose of drafting, but multiple colors for purpose of deck building. I will try to record some drafts once I figure out how to do it and show you an example of what I mean.
juzamjedi
Tester
 
Posts: 575
Joined: 13 Nov 2008, 08:35
Has thanked: 6 times
Been thanked: 8 times

Re: New Draft Functionality Finally Done

Postby Rob Cashwalker » 12 May 2011, 00:22

I was considering having the AI add Artifacts and Lands to the "possibles" list all the time, not just when there aren't any cards in its colors.

I also started off with having the AI pick a "splash" color... but I was noticing it was ending up with 5 color decks almost every time.

I'm open to trying to implement alternative strategies. Keep in mind, that strategy for a cube draft may be very different from block draft. The most difficult part is evaluating the picks. I did all my drafting code based on drafting M11 or M10, where the computer consistently picked out what I would consider good cards. But sets are designed to have good cards and bad cards. Evaluating good cards against good cards in a cube is more difficult, without cheating, with third-party information.

There also may be better methods in which to build a deck from the picks. I took a simplistic approach which wants about 15 creatures, (sorted by the same evaluation I used when picking) 7 other spells and 18 lands, including the ones it drafted. The extra colors come from the deck building process, as the AI needs to fill in cards after exhausting its primary colored cards.

BTW, when I ran that draft, my picks weren't intelligent choices, I just highlighted the first card and clicked-through.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: New Draft Functionality Finally Done

Postby Agetian » 15 May 2011, 08:21

I want to say that I truly enjoy this new block-based drafting functionality, I love this feature and I was playing around with it for a long time yesterday and today and had a lot of fun. No problems to report so far, I just noticed one thing about deck generation that might be minor enough but I still want to report it cause it kinda detracts a bit from the atmosphere. Say, I pick ALL/ICE/ICE for my drafting blocks, I draft the cards (and they're all either from Alliances or Ice Age), and then I go to the deck editor and all of a sudden I have some 5th/6th/9th Edition, Mercadian Masques, and even Mirrodin Besieged (MBS) cards in my deck - the MBS ones being my lands. I assume it has something to do with the way the deck editor operates, but it kinda spoils the fact that all the cards were presumably drafted from the same pool (ALL/ICE/ICE). :) It would have been nice if the deck editor preserved the set information and the lands that were added were also from at least the set that is the same or at least closest to the set that is being drafted. Might be minor, but could be worth looking into when and if the time permits. ;) Otherwise, great job on the improved drafting system, now I feel like I'm going to do the drafting even more than I typically did questing. :)

EDIT: I confirmed the fact that it only has to do with the deck editor (that's where the set information gets broken) - manually fixing the editions in the .dck file and starting the game proves that the game itself shows e.g. the ICE lands instead of the MBS lands correctly given the correct information in the .dck file.
Agetian
Programmer
 
Posts: 3489
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: New Draft Functionality Finally Done

Postby Rob Cashwalker » 16 May 2011, 13:44

Thanks, glad you're enjoying it.

After you draft, you need to open the draft deck in the editor.

The Set Codes should be preserved throughout the drafting process, not sure what's going on, I tested the block drafting almost entirely using M10, and made sure only M10 cards were listed in the files... I'll test with some other blocks.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: New Draft Functionality Finally Done

Postby Agetian » 16 May 2011, 13:45

Rob Cashwalker wrote:After you draft, you need to open the draft deck in the editor.
Well, that's what I do, and after I open it in the deck editor (and subsequently save it), the set information gets lost and messed up (perhaps you misunderstood what the issue is - I still have all the cards as drafted after editing my deck in the editor, it's just that they come from all sorts of random editions instead of the specific sets they were drafted from and so the pictures are from completely different sets).

Here's how you can reproduce it:

1) Do the draft (choose e.g. Ice Age, Odyssey, or whatever).
2) Once the draft is complete, open the deck in the editor, create the actual deck, save it.
3) Try to play the draft - the pictures for some of the cards might come from completely different editions than the draft (e.g. the lands MBS, some cards from 4th/5th/9th/whatever, etc.)

Hope it helps! :) It happens to me every time, should be easy to reproduce.
Last edited by Agetian on 16 May 2011, 13:50, edited 1 time in total.
Agetian
Programmer
 
Posts: 3489
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: New Draft Functionality Finally Done

Postby Rob Cashwalker » 16 May 2011, 13:48

when you're editing the deck, do you use the filters?
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

PreviousNext

Return to Forge

Who is online

Users browsing this forum: No registered users and 32 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 32 users online :: 0 registered, 0 hidden and 32 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 32 guests

Login Form