myk's code contributions
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: myk's code contributions
by Sloth » 15 Feb 2013, 10:48
A lot of good stuff here my. Just a few comments:
I would love to see that. The quest mode is too scattered on multiple screens, which prevents immersion.myk wrote:[*]combine Duels and Challenges into one page, with challenges taking up the top slots in the duels list (visually differentiate from duel opponents)
That's a lot of work to get right, but would be great.myk wrote:[*]move user preferences and downloadable content out of program directory so they are persisted across upgrades when users decompress to a different path (no more "pic import" steps or copying over of preferences)
What do you mean?myk wrote:[*]quest deck generation
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: myk's code contributions
by moomarc » 15 Feb 2013, 11:05
A few things on my wishlist/things I've noticed:
- The 'Random Cardpool' doesn't filter out special cards like Avatars, Planes, Phenomena or Schemes.
- Would love it if newly created scheme/planar decks were automatically added to the relevant selection lists without having to restart Forge.
- Would be nice to be able to delete decks from in-game - maybe context menu option?
- In the custom deck selection list, prepend decks that contain cards flagged with RemAIDeck with an asterix.
Then some things that I'd love to see one day but really not expecting any time soon:
- Probably a huge mission, but it would be great if Forge didn't have to restart to apply a new skin. Not a biggie if it can't be done. Might be nice if hovering over a skin showed a preview image of it at least. If this is a reasonable option I'll create a preview shot for each skin showing samples of different game regions.
- Sorting custom decks by folder: If the decks folder has any subfolders, these would be used as category titles that could be expanded to show their contents.
- The 'Random Cardpool' doesn't filter out special cards like Avatars, Planes, Phenomena or Schemes.
- Would love it if newly created scheme/planar decks were automatically added to the relevant selection lists without having to restart Forge.
- Would be nice to be able to delete decks from in-game - maybe context menu option?
- In the custom deck selection list, prepend decks that contain cards flagged with RemAIDeck with an asterix.
Then some things that I'd love to see one day but really not expecting any time soon:
- Probably a huge mission, but it would be great if Forge didn't have to restart to apply a new skin. Not a biggie if it can't be done. Might be nice if hovering over a skin showed a preview image of it at least. If this is a reasonable option I'll create a preview shot for each skin showing samples of different game regions.
- Sorting custom decks by folder: If the decks folder has any subfolders, these would be used as category titles that could be expanded to show their contents.
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: myk's code contributions
by myk » 15 Feb 2013, 11:44
Deck generation based on the player's quest catalog. This will build on the previous filtered deck generation task, but will additionally have to consider land availability. Since the Constructed pool is infinite, the logic can be common between quest mode deck generation and constructed deck generation, but the additional code paths will probably only be hit in quest mode.Sloth wrote:What do you mean?myk wrote:[*]quest deck generation
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Re: myk's code contributions
by Max mtg » 15 Feb 2013, 21:54
1. Which mode? Quest does provide correct cards, Generate colored decks does as wellmoomarc wrote:A few things on my wishlist/things I've noticed:
- The 'Random Cardpool' doesn't filter out special cards like Avatars, Planes, Phenomena or Schemes.
- Would love it if newly created scheme/planar decks were automatically added to the relevant selection lists without having to restart Forge.
- Would be nice to be able to delete decks from in-game - maybe context menu option?
- In the custom deck selection list, prepend decks that contain cards flagged with RemAIDeck with an asterix.
2 & 3 There are methods like
- Code: Select all
Singletons.getModel().getDecks().getPlane().add(deck)
Singletons.getModel().getDecks().getPlane().delete(deckname)
4. Possible, with a predicate for deck

Hardly possible, unless either:moomarc wrote:- Sorting custom decks by folder: If the decks folder has any subfolders, these would be used as category titles that could be expanded to show their contents.custom deck sorting.jpg
* deck names are somehow prefixed to denote a folder they belong to
* someone breaks my deck serialization system and writes a new one.
I suggest a diffrent option - tags. Tags are stored inside a deck. So that a deck may belong to several folders at once
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: myk's code contributions
by moomarc » 16 Feb 2013, 08:04
1 - Was in constructed deck editor, using Random Card Pool in the Deck Generation tab. Moot point now though, seing as your splitting of CardDB fixed the issue. Thanks.Max mtg wrote:1. Which mode? Quest does provide correct cards, Generate colored decks does as well
2 & 3 There are methods likeWhich will immediatelly reflect changes to disk.
- Code: Select all
Singletons.getModel().getDecks().getPlane().add(deck)
Singletons.getModel().getDecks().getPlane().delete(deckname)
4. Possible, with a predicate for deck
2 - The first bit already is used in this form:
- Code: Select all
tempPlanarDeckList = new FList();
Vector<Object> listData = new Vector<Object>();
listData.add("Random");
listData.add("Generate");
for (Deck planarDeck : Singletons.getModel().getDecks().getPlane()) {
listData.add(planarDeck);
}
tempPlanarDeckList.setListData(listData);
tempPlanarDeckList.setSelectedIndex(0);
tempPlanarDeckList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
3 - As for deleting, thanks for the relevant snippet, but unfortunately I don't have the skills to implement a contect menu or delete button in the relevant places.

4 - Thanks again Max. I might just try implement it when I get a chance.
5 - Then with regards to the deck tagging, I actually considered something like that but thought you were against adding additional meta data to the deck files. Definitely not something I know how to do myself, so I'll leave it up to the skilled developers to decide the best approach (or whether it should be implemented at all).
-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Re: myk's code contributions
by Max mtg » 16 Feb 2013, 09:14
2 - yes, firstly a deck has to be added to that Storage, then have the decks list refreshed. The code you've quoted is actually refreshing the decklist.
4 -
4 -
- Code: Select all
public static final Predicate<Deck> AI_KNOWS_HOW_TO_PLAY_ALL_CARDS = new Predicate<Deck>() {
@Override
public boolean apply(Deck d) {
for(Entry<DeckSection, CardPool> cp: d) {
for(Entry<CardPrinted, Integer> e : cp.getValue()) {
if ( e.getKey().getCard().getRemAIDecks() )
return false;
}
}
return true;
}
};
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: myk's code contributions
by Hellfish » 16 Feb 2013, 15:16
Nice work, myk! I'm tinkering a bit with the deck editor now to extend on your Sideboard editing addition to let you edit the default Vanguard avatar,Scheme deck and planar deck. I have one question before I commit,though: I currently maintain an ItemPoolView for each variant section with their respective allowed CardPrinteds. I create and fill these in CEditorConstructeds constructor so that I don't have to filter out a new list to put in the catalog from CardDb.variants().getAllCards() each time the user switches to the view of that Section.
Is this, so to speak, kosher? Or would it be better if I actually filtered for a new list each time? Or is there another, better alternative?
Is this, so to speak, kosher? Or would it be better if I actually filtered for a new list each time? Or is there another, better alternative?
So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: myk's code contributions
by myk » 16 Feb 2013, 16:07
Thanks, but credit for the sideboard editing should go to Agetian; I'm just adding some spit and polish : )Hellfish wrote:Nice work, myk! I'm tinkering a bit with the deck editor now to extend on your Sideboard editing addition to let you edit the default Vanguard avatar,Scheme deck and planar deck.
You have to maintain state somewhere -- keeping a list of all cards and subtracting those that are selected or keeping a selected list and recreating the full list minus those in the selected list; either is ok, and both styles are used in the existing code. But I am curious what this new functionality adds that is not already in the editors that are accessed from the Variant menus. For example, you can already create a scheme deck in the Scheme Deck Editor.I have one question before I commit,though: I currently maintain an ItemPoolView for each variant section with their respective allowed CardPrinteds. I create and fill these in CEditorConstructeds constructor so that I don't have to filter out a new list to put in the catalog from CardDb.variants().getAllCards() each time the user switches to the view of that Section.
Is this, so to speak, kosher? Or would it be better if I actually filtered for a new list each time? Or is there another, better alternative?
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Re: myk's code contributions
by Chris H. » 16 Feb 2013, 16:18
At the Home View -> Game Settings -> Content Downloaders we have to buttons, How To Play and License Details. Pressing these windows provides an overlay with text.
It is not very obvious how to close these two overlays when played on a large screen monitor. There is a close box in the top right corner but that can be so far away from the overlay that it is not obvious that the two are connected.
It is not very obvious how to close these two overlays when played on a large screen monitor. There is a close box in the top right corner but that can be so far away from the overlay that it is not obvious that the two are connected.
-
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: myk's code contributions
by Chris H. » 16 Feb 2013, 16:21
Quest mode will report that you have challenges available at less than 20 wins even though no challenge opponents are listed/displayed.
See: Challenges Bug?
See: Challenges Bug?
-
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: myk's code contributions
by Hellfish » 16 Feb 2013, 16:24
These changes let you specify *default* avatars/scheme decks/planar decks that your deck is designed to work well with, for example gos has releaesed a kobold deck feom some column that relies on the Nekrataal avatar to remove B from all costs.Earlier you could only do this by notepadding the deck file. The variant deck editor lets you define standalone planar/scheme decks only.
So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
-
Hellfish - Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: myk's code contributions
by friarsol » 16 Feb 2013, 19:00
It seems like in game 2 after a quest match after I won (with ante), my OK button no longer can be activated with the space bar. I saw you were committing things related to this, so I'm not sure if this got broken somehow?
Edit: Actually, my alpha strike keyboard shortcut doesn't work now either. I was definitely using both in game 1.
Edit2: I got a popup towards the end of game 2 (to sacrifice something) and after that my space bar was restored.
Edit: Actually, my alpha strike keyboard shortcut doesn't work now either. I was definitely using both in game 1.
Edit2: I got a popup towards the end of game 2 (to sacrifice something) and after that my space bar was restored.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: myk's code contributions
by Max mtg » 16 Feb 2013, 20:35
I've added some static final predicates for you (r19664), feel free to use them and never hard-code common things in place.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: myk's code contributions
by myk » 17 Feb 2013, 20:18
There are some instances where the buttons will lose focus. This has been happening for a while and is actually the reason I started working on the match ui focus algorithms in the first place. I'm tracking down the problems and fixing them as I see them. I just checked in a fix for when buttons would lose focus due to the Prompt tab being hidden (e.g. by selecting a different tab with the same parent) and then reshown.friarsol wrote:It seems like in game 2 after a quest match after I won (with ante), my OK button no longer can be activated with the space bar. I saw you were committing things related to this, so I'm not sure if this got broken somehow?
Edit: Actually, my alpha strike keyboard shortcut doesn't work now either. I was definitely using both in game 1.
Edit2: I got a popup towards the end of game 2 (to sacrifice something) and after that my space bar was restored.
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Re: myk's code contributions
by myk » 17 Feb 2013, 21:52
Gotcha. And the additions look great! Thanks!Hellfish wrote:These changes let you specify *default* avatars/scheme decks/planar decks that your deck is designed to work well with, for example gos has releaesed a kobold deck feom some column that relies on the Nekrataal avatar to remove B from all costs.Earlier you could only do this by notepadding the deck file. The variant deck editor lets you define standalone planar/scheme decks only.
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Who is online
Users browsing this forum: No registered users and 10 guests