It is currently 29 Oct 2025, 22:31
   
Text Size

Granting Human Deck in Quests

Post MTG Forge Related Programming Questions Here

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

Granting Human Deck in Quests

Postby friarsol » 22 May 2013, 12:10

Hey Max,

Thanks for some of the cleanup with the Quest Challenge stuff, one thing I noticed however is you changed intended functionality here. I used a nullable boolean for a reason for forceAnte, since if the user isn't using Ante I wanted to ability to FORCE them into or out of Ante. "OverrideAnte" may have been a slightly better name.

ForceAnte | Open
public MatchController(GameType type, Map<LobbyPlayer, PlayerStartConditions> map, boolean forceAnte) {
this(type, map);
this.useAnte |= forceAnte;
}


So if useAnte is already true (because that's what my preferences say), and the Quest says Force Ante is false, ante will still be used. In this case, that is different then the functionality I want. Because I'm granting the user a temporary deck they don't actually own there is no risk in playing for ante, so they shouldn't be able to gain cards through ante.

Conversely, we can't use an &= operator here because if useAnte is false (because that's what my preferences say) and the Quest wants you to have to Ante something for some reason (thematically), ante will not be used when it should..

I (correctly) used a nullable Boolean, so when forceAnte isn't null, it will override useAnte for the match. Otherwise, we'll fall back to the user's preference.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Granting Human Deck in Quests

Postby Max mtg » 22 May 2013, 15:02

It's great we came to discuss this subject now.
Thanks for explaination, I got your idea with three states for that flag. Brought it back in 21594.

In fact I reacted to a diffrent thing - that some quest challenges now can force human to play for ante. An idea that some players (well, at least myself) would not approve. That is exposing some of valued cards from a precious winning deck to a risk of loss.
Even if you provide human with a different deck, some cards from there may overlap with the ones in his cardpool and that would lead to card loss and disappointment.
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: Granting Human Deck in Quests

Postby Max mtg » 22 May 2013, 15:11

By the way, how your custom decks for human are supposed to work in different quest worlds?

What will you do if the challenge is not expected to be symmetrical? (ie AI is given deck AAA, and human is given deck BBB, but they cannot be given the same decks vice versa... because AI deck is way stronger for instance)


I think you'll have to enclose human opponent deck right into the same challenge file - just list the cards under different section names and then read them collecting human deck section-by-section (luckily there are no more than 2 sections in a deck).
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: Granting Human Deck in Quests

Postby friarsol » 22 May 2013, 15:17

Max mtg wrote:In fact I reacted to a diffrent thing - that some quest challenges now can force human to play for ante. An idea that some players (well, at least myself) would not approve. That is exposing some of valued cards from a precious winning deck to a risk of loss.
Even if you provide human with a different deck, some cards from there may overlap with the ones in his cardpool and that would lead to card loss and disappointment.
At first I was planning on only going in the single direction (just disabling) but thought it would be neat to enable Ante for a match when you normally have it disabled. The Description of the Challenge would give you fair warning that something will be ante'd (The cost of entering King Midas' chambers!) and of course, you don't have to enter his castle (play that particular challenge) if you don't want to. But there are grand rewards! Gold and riches, beyond your wildest dreams! For these style of quests, you should be risking your own cards, since the idea is that you have to risk something for the possibility of big rewards.

With all that considered, these quests should be few and far between, and definitely be at the high end scale of things, almost like a boss fight. Because if there are too many forced ante challenges, it could fill up your challenge queue, which could remove some of the fun of playing challenges if users like yourself (and I'm sure there are plenty of others out there), absolutely never want to play for ante.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Granting Human Deck in Quests

Postby friarsol » 22 May 2013, 15:33

Max mtg wrote:By the way, how your custom decks for human are supposed to work in different quest worlds?

What will you do if the challenge is not expected to be symmetrical? (ie AI is given deck AAA, and human is given deck BBB, but they cannot be given the same decks vice versa... because AI deck is way stronger for instance)


I think you'll have to enclose human opponent deck right into the same challenge file - just list the cards under different section names and then read them collecting human deck section-by-section (luckily there are no more than 2 sections in a deck).
Yea I noticed your comment, which is definitely a good point. We should be able to grab the path of the file from the QuestChallenge that's being loaded in instead of using the Constant that I used for the first phase of this experiment. That way things will just have to be in the same directory as the parent challenge, which should allow World's to use this feature.

The first way I was thinking of this was asymmetrical: (You play as Captain Sisay of the Weatherlight, vs Greven il Vec of the Predator), this is Greven's deck, but where is Sisay's? But when I was playing around with the code I couldn't think of a great spot to place the Human Player's deck.

If things are relative to the loading Challenge as I suggest above, would it be easier to just have one huge file with two decks in it? Or would it be easier to reference a second file, with an ID set to -1 (or some other reference point is inform the challenge reader to not create a challenge out of that file).
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Granting Human Deck in Quests

Postby Max mtg » 22 May 2013, 15:57

To my mind a single file is much better, since its a self-contained thing and easier to handle for non-programmers.

If you leave a reference to a different file, that file may become lost, moved to another world, of someone would would make an easy challenge out of it. You also come to store non-homogenous objects in a folder - so challenge reader will need to skip some files, you'll probably have to patch core classes (StorageView) then.

Another argument against separate files are the paths. The reader is thought to be completelly independent from current game state, quests and weather on planet Mars. It takes text data from file (be it whole file, a single line or a section) and produces a result.
Or you might have to keep decks in a separate folder, wrap a storageview over them, but again - such a file won't mean anything without a matching challenge.


Code: Select all
        final Map<String, List<String>> contents = FileSection.parseSections(FileUtil.readFile(file)); // already found as 1st line of challenge reader
        Map<String, List<String>> humanDeckSource = new HashMap<String, List<String>>();
        humanDeckSource.put("main", contents.get("opponent-main"));
        humanDeckSource.put("sideboard", contents.get("opponent-sb"));
        qc.setHumanDeck(Deck.fromSections(humanDeckSource));
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times


Return to Developer's Corner

Who is online

Users browsing this forum: Timothysow and 20 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 21 users online :: 1 registered, 0 hidden and 20 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: Timothysow and 20 guests

Login Form