[WIP] Improving usefulness of Foil
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
45 posts
• Page 3 of 3 • 1, 2, 3
Re: [WIP] Improving usefulness of Foil
by Max mtg » 01 Jul 2013, 15:56
same as in mtgo - a star with trail sign at the right of card name.
it's about writing a custom cell renderer.
it's about writing a custom cell renderer.
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: [WIP] Improving usefulness of Foil
by Agetian » 01 Jul 2013, 16:11
Umm do you have an example screenshot of how it looks like? (I'm not particularly sure since I haven't played MTGO much to be honest)Max mtg wrote:same as in mtgo - a star with trail sign at the right of card name.
it's about writing a custom cell renderer.
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: [WIP] Improving usefulness of Foil
by Max mtg » 01 Jul 2013, 16:51
Here's a sample
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: [WIP] Improving usefulness of Foil
by Agetian » 02 Jul 2013, 13:51
@ Max: Gotcha, thanks! I'll see if I can figure out how to do something like that! 
- Agetian

- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: [WIP] Improving usefulness of Foil
by Max mtg » 02 Jul 2013, 23:30
Card picture (match ui) has wrong vertical alignment for card image.
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: [WIP] Improving usefulness of Foil
by Agetian » 03 Jul 2013, 05:34
@ Max: hmm I'm not sure what's up with the card picture - on my system it shows OK, but it may be dependent on the card images themselves or some other factor (like screen resolution maybe?)
I've tried a lot of things to make it work correctly but apparently it's too dependent on factors beyond intuitive control to make it work consistently across systems :\ Can you show me a screenshot of what kind of offset error you're getting? As of the latest svn build, the foil is applied from top left (0, 0) to the bottom right of the card picture with no other offsets accounted for, so I'm currently at a loss as to how to fix it... Unless I or someone else can figure out what's happening I guess I'll have to disable foiling the card picture panel in the match UI 
- Agetian


- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: [WIP] Improving usefulness of Foil
by Max mtg » 03 Jul 2013, 07:26
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: [WIP] Improving usefulness of Foil
by Agetian » 03 Jul 2013, 08:06
@ Max: Hmm that's very weird, I've just tried it on my PC and it seems fine... what is it even controlled with? I'm pretty sure I did not touch anything that could have changed that, at least not intentionally, and especially since it doesn't concern foiling, non-foil cards are generally drawn the way they were before (and that is basically via a call to setImage which does the magic just the way it did before) :\ Do you have an idea what could be up? I mean, I could have broken something unintentionally but I'm clueless as to what it might be if I did 
- Agetian

- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: [WIP] Improving usefulness of Foil
by Max mtg » 03 Jul 2013, 10:56
to reproduce try changing aspect ratio of the card panel, that's what changes how much the card get cut
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: [WIP] Improving usefulness of Foil
by Agetian » 03 Jul 2013, 11:43
@ Max: OK, I'll see if I can figure this one out!
EDIT: Weirdly enough, still unable to reproduce it, no matter how much I mutilate my card picture panel - I tried making it wider, narrower, taller, smaller, both wider/taller and narrower/smaller at the same time, wider/smaller and taller/narrower at the same time and in different proportions, and yet that card is scaled correctly and stays in the center both horizontally and vertically for me all the time... :\
- Agetian
EDIT: Weirdly enough, still unable to reproduce it, no matter how much I mutilate my card picture panel - I tried making it wider, narrower, taller, smaller, both wider/taller and narrower/smaller at the same time, wider/smaller and taller/narrower at the same time and in different proportions, and yet that card is scaled correctly and stays in the center both horizontally and vertically for me all the time... :\
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: [WIP] Improving usefulness of Foil
by Agetian » 03 Jul 2013, 18:19
Guys, I wanted to let you know that I'll be away on a two week vacation starting this weekend - I will try to follow the forum, maybe even play a bit of Forge on my netbook when I have some time (and report some bugs), but I don't think I'll be able to contribute much (if any) code during this 2-week period. As of right now, the foiling is mostly implemented but not hooked to anything - tomorrow I'll try to contribute another commit to be able to define what slot on the print sheet the foil should replace (according to the MTG wiki linked above, in certain editions foils replace whatever rarity they are, in other editions they always replace the common slot).
Anyhow, the remaining must-do parts of this project are:
1) Getting the foil to show everywhere (this includes the custom cell renderer for JTables to indicate that a card is a foil in e.g. the quest shop, the deck editor, etc.);
2) Adding the ability to produce foils to the booster generator;
3) Making foils appear in the quest shop (with a certain price difference - ideas are welcome how more expensive a foil should be).
If anybody is willing to contribute some code and help me out with this project during my off weeks, your help is highly welcome! I believe the visualization of foils in the deck editor and the proper generation of foil cards in boosters would be the trickiest things for me to implement as I have little experience with the related parts of Forge... Anyhow, I'll try to commit as much as I can before I leave, and I'll get back to coding foils roughly on 18th-20th of July. See you all soon, guys, and good luck with all your current projects!
P.S. I'll at least be in touch from time to time, so I won't disappear completely.
- Agetian
Anyhow, the remaining must-do parts of this project are:
1) Getting the foil to show everywhere (this includes the custom cell renderer for JTables to indicate that a card is a foil in e.g. the quest shop, the deck editor, etc.);
2) Adding the ability to produce foils to the booster generator;
3) Making foils appear in the quest shop (with a certain price difference - ideas are welcome how more expensive a foil should be).
If anybody is willing to contribute some code and help me out with this project during my off weeks, your help is highly welcome! I believe the visualization of foils in the deck editor and the proper generation of foil cards in boosters would be the trickiest things for me to implement as I have little experience with the related parts of Forge... Anyhow, I'll try to commit as much as I can before I leave, and I'll get back to coding foils roughly on 18th-20th of July. See you all soon, guys, and good luck with all your current projects!
P.S. I'll at least be in touch from time to time, so I won't disappear completely.
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: [WIP] Improving usefulness of Foil
by friarsol » 03 Jul 2013, 18:32
In later editions they always replace a common slot, not the rare slot. Just wanted to make sure you didn't misread that.Agetian wrote:(according to the MTG wiki linked above, in certain editions foils replace whatever rarity they are, in other editions they always replace the rare slot).
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: [WIP] Improving usefulness of Foil
by Agetian » 03 Jul 2013, 18:48
Yep, corrected that when I reread my message.friarsol wrote:In later editions they always replace a common slot, not the rare slot. Just wanted to make sure you didn't misread that.Agetian wrote:(according to the MTG wiki linked above, in certain editions foils replace whatever rarity they are, in other editions they always replace the rare slot).

- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: [WIP] Improving usefulness of Foil
by Agetian » 31 Jul 2013, 05:53
As of r22715, Forge correctly displays both old-style and new-style foil cards in both the match UI and the deck editor UI. I think I'll now be moving onto booster generation improvements (since those may be drastic, I'll wait until v1.4.4 is released before committing any changes related to that). Currently I have the following idea in mind:
1) In every booster generated, generate a random foil card with the chance specified in the edition definition file. Place it either in the common slot or in whatever slot it belongs to, depending on the edition.
2) As for the price modification, I was thinking that common and uncommon foils can be double the price, while rare foils and mythic rare foils can be triple the price or maybe 2.5x the price, more or less judging by my approximated experience with price rates for foils in real life, but I'm not sure if that may be too little or too much.
Your input is welcome on these points.
- Agetian
1) In every booster generated, generate a random foil card with the chance specified in the edition definition file. Place it either in the common slot or in whatever slot it belongs to, depending on the edition.
2) As for the price modification, I was thinking that common and uncommon foils can be double the price, while rare foils and mythic rare foils can be triple the price or maybe 2.5x the price, more or less judging by my approximated experience with price rates for foils in real life, but I'm not sure if that may be too little or too much.
Your input is welcome on these points.

- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
Re: [WIP] Improving usefulness of Foil
by Agetian » 02 Aug 2013, 06:05
r22742 adds card value modification based on its foil/non-foil status (currently with hardcoded multipliers, but I may later switch that into a property set in the quest parameters).
I have a question: is anyone in the know about how exactly Forge generates boosters based on print sheets? I'm trying to figure out what the best approach would be to seed a random foil card into a booster but so far I'm unable to devise the best strategy (especially considering that sometimes a foil card has to go into the common slot and sometimes it has to simply be in whatever slot it should be in according to its rarity - the second case is easier because, I guess, we could just randomly foil one of the cards in the booster after it's already placed into its proper slot; the first case requires some micromanagement of print sheets or something like that :\ )
- Agetian
I have a question: is anyone in the know about how exactly Forge generates boosters based on print sheets? I'm trying to figure out what the best approach would be to seed a random foil card into a booster but so far I'm unable to devise the best strategy (especially considering that sometimes a foil card has to go into the common slot and sometimes it has to simply be in whatever slot it should be in according to its rarity - the second case is easier because, I guess, we could just randomly foil one of the cards in the booster after it's already placed into its proper slot; the first case requires some micromanagement of print sheets or something like that :\ )
- Agetian
- Agetian
- Programmer
- Posts: 3489
- Joined: 14 Mar 2011, 05:58
- Has thanked: 684 times
- Been thanked: 572 times
45 posts
• Page 3 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 41 guests