Implementing variants
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Implementing variants
by Hellfish » 19 Nov 2012, 20:00
Branch created! 
Fair warning, I'm not a UI whiz.
Also; parts are, of course, works in progress.

Fair warning, I'm not a UI whiz.

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: Implementing variants
by moomarc » 20 Nov 2012, 06:12
Thought I'd give this a quick try before I get on with scripting some more cards and at the moment Forge won't start without changing lines 270-271 in CardRules.java to remove plus signs from avatar HandLifeModifier lines:
EDIT: Still can't start a match though. Crashing with an NPE at line 88, VMatchUI.java (for all game formats, not just Vanguard).
- Code: Select all
this.hand = Integer.parseInt(pt.substring(0, pt.indexOf('/')).replace("+", ""));
this.life = Integer.parseInt(pt.substring(pt.indexOf('/') + 1).replace("+", ""));
EDIT: Still can't start a match though. Crashing with an NPE at line 88, VMatchUI.java (for all game formats, not just Vanguard).

-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: Implementing variants
by Hellfish » 20 Nov 2012, 07:36
Re: hand/life mod.Weird, it tested fine with your avatar scripts.Will investigate.
For the other crash, I think you need to delete match_preferred.xml
For the other crash, I think you need to delete match_preferred.xml
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: Implementing variants
by moomarc » 20 Nov 2012, 08:12
I tried deleting all the layout files before I posted but it didn't help. Perhaps one of the other preference files that were changed were set as svn:ignore. Not too sure. I'll post the actual crash reports for both (I'll just revert my 'fix' but I'm fairly sure that was the problem seeing as it crashed with a NumberFormatException: +0 at the line I changed, and the first avatar that would have been parsed is Arcbound Overseer Avatar with a +0/+3 modifier). Did you perhaps upgrade to java 7?Hellfish wrote:Re: hand/life mod.Weird, it tested fine with your avatar scripts.Will investigate.
For the other crash, I think you need to delete match_preferred.xml
- Start match crash (tried deleting layouts again and replaced with latest from branch) | Open
- null
Version:
Forge version SVN
OS: Windows 7 Version: 6.1 Architecture: x86
Java Version: 1.6.0_35 Vendor: Sun Microsystems Inc.
Detailed error trace:
java.lang.NullPointerException
at forge.gui.match.VMatchUI.populate(VMatchUI.java:88)
at forge.control.FControl.changeState(FControl.java:205)
at forge.game.MatchController.startRound(MatchController.java:113)
at forge.gui.home.variant.CSubmenuVanguard$6.doInBackground(CSubmenuVanguard.java:155)
at javax.swing.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at javax.swing.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
-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: Implementing variants
by moomarc » 20 Nov 2012, 09:17
Just did a fresh checkout of Forge, switched to the variants branch and I get the original crash. The loading stops at "Loading card data: 377 of..." and this error prints to console:moomarc wrote:I tried deleting all the layout files before I posted but it didn't help. Perhaps one of the other preference files that were changed were set as svn:ignore. Not too sure. I'll post the actual crash reports for both (I'll just revert my 'fix' but I'm pressy sure that was the problem seeing as it crashed with a NumberFormatException: +0 at the line I changed, and the first avatar that would have been parsed is Arcbound Overseer Avatar with a +0/+3 modifier). Did you perhaps upgrade to java 7?Hellfish wrote:Re: hand/life mod.Weird, it tested fine with your avatar scripts.Will investigate.
For the other crash, I think you need to delete match_preferred.xml
- Start match crash (tried deleting layouts again and replaced with latest from branch) | Open
- null
Version:
Forge version SVN
OS: Windows 7 Version: 6.1 Architecture: x86
Java Version: 1.6.0_35 Vendor: Sun Microsystems Inc.
Detailed error trace:
java.lang.NullPointerException
at forge.gui.match.VMatchUI.populate(VMatchUI.java:88)
at forge.control.FControl.changeState(FControl.java:205)
at forge.game.MatchController.startRound(MatchController.java:113)
at forge.gui.home.variant.CSubmenuVanguard$6.doInBackground(CSubmenuVanguard.java:155)
at javax.swing.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at javax.swing.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
- Error | Open
- java.lang.NumberFormatException: For input string: "+0"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at forge.card.CardRules.<init>(CardRules.java:270)
at forge.card.CardRulesReader.getCard(CardRulesReader.java:72)
at forge.card.cardfactory.CardReader.loadCard(CardReader.java:297)
at forge.card.cardfactory.CardReader.loadCard(CardReader.java:500)
at forge.card.cardfactory.CardReader.loadCards(CardReader.java:216)
at forge.card.cardfactory.CardFactory.<init>(CardFactory.java:79)
at forge.model.FModel.<init>(FModel.java:159)
at forge.model.FModel.<clinit>(FModel.java:68)
at forge.view.Main.main(Main.java:48)
java.lang.ExceptionInInitializerError
at forge.view.Main.main(Main.java:48)
Caused by: java.lang.NullPointerException
at forge.error.ErrorViewer.printError(ErrorViewer.java:214)
at forge.error.ErrorViewer.showError(ErrorViewer.java:115)
at forge.error.ErrorViewer.showError(ErrorViewer.java:79)
at forge.card.cardfactory.CardFactory.<init>(CardFactory.java:83)
at forge.model.FModel.<init>(FModel.java:159)
at forge.model.FModel.<clinit>(FModel.java:68)
... 1 more
The match did start without a problem though once I applied the earlier fix. Nice work!
-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: Implementing variants
by Hellfish » 21 Nov 2012, 10:38
Thinking about plane/scheme decks, we might need a CardPanel representation of a facedown pile since planes and schemes always remain in the command zone and just stacking them like we do with tokens would get messy.
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: Implementing variants
by moomarc » 22 Nov 2012, 15:19
Okay, up to 19 of the original 32 Vanguard avatars done. Need to stop for the day but will try crank out the rest tomorrow. The only original one that I've come across so far that can't be scripted yet is Mirri (Forge can't handle mana replacement yet). So 12 left.
We probably need to make it so that avatars with the RemAIDeck flag are removed from the list of avatars available for the AI in a Vanguard match. Then at a later stage have some sort of ranking table that will make the AI more likely to end up with an avatar that's useful when using random avatars. Or even better, if you (Hellfish) ever managed to get that deck archetype code working, we could assign certain avatars to certain archetypes.

We probably need to make it so that avatars with the RemAIDeck flag are removed from the list of avatars available for the AI in a Vanguard match. Then at a later stage have some sort of ranking table that will make the AI more likely to end up with an avatar that's useful when using random avatars. Or even better, if you (Hellfish) ever managed to get that deck archetype code working, we could assign certain avatars to certain archetypes.
-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: Implementing variants
by Hellfish » 22 Nov 2012, 18:05
Thanks for the avatars,man, you're on fire! 
I don't have the archetype code (or interest) anymore but the idea is simple enough.Maybe a few projects down the line.

I don't have the archetype code (or interest) anymore but the idea is simple enough.Maybe a few projects down the line.
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: Implementing variants
by moomarc » 22 Nov 2012, 19:13
Those original avatars are easy for the most part and Vanguard was the only variant I actually played with paper magic, so been waiting for it for a while. The online ones will be a bit slower. They have more unique abilities and will need additional code for quite a few of them.Hellfish wrote:Thanks for the avatars,man, you're on fire!
I don't have the archetype code (or interest) anymore but the idea is simple enough.Maybe a few projects down the line.
As for the archetypes code, definitely wasn't trying to push you on it. Just mentioning a spot where it could be useful if/when it's done.
On a different point, will it be easy to expand Vanguard for multiple players? I know there's at least one avatar that is specifically for multiplayer.
-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: Implementing variants
by Hellfish » 22 Nov 2012, 19:25
Yeah, Multiplayer Vanguard is only a UI issue, I think. Specifically, how to design the home screen for Vanguard to make sense in how you designate each player. I pictured something like a tab panel where the first tab lets you specify number of players and the other tabs are specific to each player with a deckchooser and an avatar list and the tabs disappear if you select a lower number of players. Don't know how proper/actually usable that is,though.
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: Implementing variants
by moomarc » 22 Nov 2012, 19:35
Sounds like the most flexible solution. First tab could also include any other Vanguard specific preferences (allowing up to three avatars per player for instance - was a fun inhouse variant we played back in the day when we didn't have the full pool of magic cards to select from and break vanguard). Each player having his own tab allows space for an image and/or card info panel so that you can see during selection what each avatar does without having a printout next to you.Hellfish wrote:Yeah, Multiplayer Vanguard is only a UI issue, I think. Specifically, how to design the home screen for Vanguard to make sense in how you designate each player. I pictured something like a tab panel where the first tab lets you specify number of players and the other tabs are specific to each player with a deckchooser and an avatar list and the tabs disappear if you select a lower number of players. Don't know how proper/actually usable that is,though.
-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: Implementing variants
by moomarc » 23 Nov 2012, 06:49
Thanks for handling that big merge Hellfish. I just merged in the last of the changes from last night as well because there were errors popping up without those later fixes.
Edit: Nevermind, seems the sound related errors in Card.java are still there.
Oh well, fewer files to merge next time.
Edit: Nevermind, seems the sound related errors in Card.java are still there.

-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: Implementing variants
by Hellfish » 23 Nov 2012, 07:18
Yeah, I noticed.Those calls are safe to comment out for the moment, though.
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: Implementing variants
by moomarc » 23 Nov 2012, 09:12
All except two of the original Vanguards are now implemented. Mirri can't be scripted because of mana replacement and Titania needs AdjustLandPlays to be handled differently. At the moment changing the number of lands playable in a turn is either hardcoded (Summer Bloom and Explore) or via the card keyword AdjustLandsPlayed which is handled in PlayerZoneBattlefield. I'd suggest making it a player keyword instead (either a statically pumped keyword or as a new static ability). This way the two hardcodes sorceries can be converted using Effects, and the ability can also then be used by cards in other zones. I'll give it a try myself, but if I haven't committed anything by this evening, then I wasn't able to get it right.
-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: Implementing variants
by moomarc » 23 Nov 2012, 11:24
Okay, I changed it to a player keyword in the main branch and did the conversions. If there's no problems with it then I'll merge into the branch and tweak them for the command zone.moomarc wrote:All except two of the original Vanguards are now implemented. Mirri can't be scripted because of mana replacement and Titania needs AdjustLandPlays to be handled differently. At the moment changing the number of lands playable in a turn is either hardcoded (Summer Bloom and Explore) or via the card keyword AdjustLandsPlayed which is handled in PlayerZoneBattlefield. I'd suggest making it a player keyword instead (either a statically pumped keyword or as a new static ability). This way the two hardcodes sorceries can be converted using Effects, and the ability can also then be used by cards in other zones. I'll give it a try myself, but if I haven't committed anything by this evening, then I wasn't able to get it right.
Edit: Oh, and add Titania of course

-Marc
-
moomarc - Pixel Commander
- Posts: 2091
- Joined: 04 Jun 2010, 15:22
- Location: Johannesburg, South Africa
- Has thanked: 371 times
- Been thanked: 372 times
Who is online
Users browsing this forum: No registered users and 73 guests