Gauntlet behavior
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
6 posts
• Page 1 of 1
Gauntlet behavior
by sidereal » 05 Jun 2013, 05:39
As I'm sure you've probably noticed, Gauntlets don't actually work. The AI player uses the same deck throughout the gauntlet. I've fixed it for some definition of 'fixed', but I want to make sure I understand how they're actually supposed to work, since the code around them (particularly in GauntletWinLose) is a little confusing/contradictory.
It looks like the intent is for the player to play a single game against each deck in the gauntlet (so in effect it's an n-game match where n is the number of decks in the gauntlet) and the player must win every game to pass the gauntlet. However, in GameType the Gauntlet type is initialized with sideboardingAllowed = true and there's really no point to sideboarding if you're facing a different opponent every game. Also, the fairness and aesthetics of 1-game matches is questionable given the possibility of mana-screwing/flooding etc. So I think Gauntlets would actually be better if you played a full best-of-3 match against each Deck and I believe I can set that up. I just want to make sure that's how they're supposed to work.
Thanks,
It looks like the intent is for the player to play a single game against each deck in the gauntlet (so in effect it's an n-game match where n is the number of decks in the gauntlet) and the player must win every game to pass the gauntlet. However, in GameType the Gauntlet type is initialized with sideboardingAllowed = true and there's really no point to sideboarding if you're facing a different opponent every game. Also, the fairness and aesthetics of 1-game matches is questionable given the possibility of mana-screwing/flooding etc. So I think Gauntlets would actually be better if you played a full best-of-3 match against each Deck and I believe I can set that up. I just want to make sure that's how they're supposed to work.
Thanks,
Re: Gauntlet behavior
by moomarc » 05 Jun 2013, 06:09
IIRC, Gauntlets were meant to work like they did in Shaandalar and are actually just n Matches long. You select your Gauntlet to go up against and try win as many matches in a row as possible. The gauntlet run ends when you lose a match and you should have to start again. So essentially an automated series of constructed matches where you're limited to one deck that can hopefully beat all your competitors.
I think in Forge's version you don't have to restart if you lose a match, and you can face the same gauntlet opponent more than once (although it doesn't count toward your completion of the gauntlet). No big reward for completing one other than that warm fuzzy feeling inside for building a deck that could kill them all.
I think in Forge's version you don't have to restart if you lose a match, and you can face the same gauntlet opponent more than once (although it doesn't count toward your completion of the gauntlet). No big reward for completing one other than that warm fuzzy feeling inside for building a deck that could kill them 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: Gauntlet behavior
by sidereal » 05 Jun 2013, 07:31
Alrighty. Here's a patch against r21964 that fixes Gauntlets. Turned out to be a little easier than I thought it'd be:
(code deleted in favor of updated version)
(code deleted in favor of updated version)
Last edited by sidereal on 05 Jun 2013, 08:28, edited 1 time in total.
Re: Gauntlet behavior
by sidereal » 05 Jun 2013, 08:09
Hm. Belay that. restoreOriginalDeck is still being called somewhere, so the new deck still isn't getting used. Checking.
Re: Gauntlet behavior
by sidereal » 05 Jun 2013, 08:31
Okay, let's try that again. Because players' original decks are immutable, I need to create a new match after each opponent rather than re-using the original match. It creates a little bit of code duplication, but has the upside that the name and avatar of the opponent changes for each deck. Here's the fixed version:
- Code: Select all
Index: src/main/java/forge/gui/match/GauntletWinLose.java
===================================================================
--- src/main/java/forge/gui/match/GauntletWinLose.java (revision 21964)
+++ src/main/java/forge/gui/match/GauntletWinLose.java (working copy)
@@ -24,13 +24,19 @@
import javax.swing.JPanel;
import javax.swing.SwingConstants;
+import com.google.common.collect.Lists;
+
import net.miginfocom.swing.MigLayout;
import forge.Singletons;
+import forge.control.Lobby;
import forge.deck.Deck;
+import forge.game.GameType;
import forge.game.Match;
+import forge.game.RegisteredPlayer;
import forge.game.player.LobbyPlayer;
import forge.gauntlet.GauntletData;
import forge.gauntlet.GauntletIO;
+import forge.gui.SOverlayUtils;
import forge.gui.toolbox.FLabel;
import forge.gui.toolbox.FSkin;
import forge.model.FModel;
@@ -80,10 +86,11 @@
// Pretty sure this can't be fixed until in-game states can be
// saved. Doublestrike 07-10-12
LobbyPlayer questPlayer = Singletons.getControl().getLobby().getQuestPlayer();
+
+ lstEventRecords.set(gd.getCompleted(), match.getGamesWonBy(questPlayer) + " - "
+ + (match.getPlayedGames().size() - match.getGamesWonBy(questPlayer)));
+
if (match.isMatchOver()) {
- // In all cases, update stats.
- lstEventRecords.set(gd.getCompleted(), match.getGamesWonBy(questPlayer) + " - "
- + (match.getPlayedGames().size() - match.getGamesWonBy(questPlayer)));
gd.setCompleted(gd.getCompleted() + 1);
// Win match case
@@ -183,4 +190,25 @@
return true;
}
+
+ @Override
+ public void actionOnContinue() {
+ if (match.isMatchOver()) {
+ // To change the AI deck, we have to create a new match.
+ GauntletData gd = FModel.SINGLETON_INSTANCE.getGauntletData();
+ Deck aiDeck = gd.getDecks().get(gd.getCompleted());
+ List<RegisteredPlayer> players = Lists.newArrayList();
+ Lobby lobby = Singletons.getControl().getLobby();
+ players.add(RegisteredPlayer.fromDeck(gd.getUserDeck()).setPlayer(lobby.getGuiPlayer()));
+ players.add(RegisteredPlayer.fromDeck(aiDeck).setPlayer(lobby.getAiPlayer()));
+
+ Match newMatch = new Match(GameType.Gauntlet, players);
+
+ SOverlayUtils.hideOverlay();
+ saveOptions();
+ newMatch.startRound();
+ } else {
+ super.actionOnContinue();
+ }
+ }
}
Re: Gauntlet behavior
by Max mtg » 05 Jun 2013, 19:29
I commited it as r21984.
Hope, it makes the gauntlet mode better.
Hope, it makes the gauntlet mode better.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 10 guests