It is currently 29 Oct 2025, 11:48
   
Text Size

[WIP] Sideboarding: Considerations, Questions

Post MTG Forge Related Programming Questions Here

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

Re: [WIP] Sideboarding: Considerations, Questions

Postby friarsol » 15 Dec 2012, 22:36

Bug: When playing with Ante and losing a game, the card that was lost in ante still appears in your main deck (hasn't been removed) and able to be sideboarded out. At the end of the match, the card is successfully removed from your deck.

Edit: Similarly, cards the AI lost due to Ante aren't removed from their deck either.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: [WIP] Sideboarding: Considerations, Questions

Postby Agetian » 16 Dec 2012, 04:33

@ Friarsol: This raises an important concern before I can apply the proper fix - if you're, for instance, playing with a 60-card deck, and you have an ante, and you lose the card you put on ante in the first round of the match, thus ending up with a 59-card deck, it should be considered normal by the game, right? (right now that'd invalidate your deck in Constructed/Quest because it's under 60 cards). Please let me know if this is the desired behavior.

ALSO: if the above is true, I'm also not sure how it should be handled... I mean, it might be difficult to differentiate between an "in-principle" under-the-limit deck (which can't meet the requirements due to ante) and a deck that was just invalidated due to sideboarding being not yet complete...

AND ALSO: because I'm not sure of the "play for ante" rules, can you please tell me something: should the cards in ante zone end up in the winner's deck even between the rounds of a single match or does the ante just keep growing and in the end of the match the cards change ownership, but the cards put on ante are unavailable for play during the game? In simple words, let's say I win game 1 in a best of three. If I and my opponent both had a card in the ante zone, do I get both of those cards as soon as I win game 1 or only after I win the entire series? (probably the first, but I want to make sure)

- Agetian
Agetian
Programmer
 
Posts: 3490
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Sideboarding: Considerations, Questions

Postby Agetian » 16 Dec 2012, 05:02

Ok, the "second round starting cards" bug (the "mulligan bug" above) is also definitely not out... moreover, it probably has something to do with the card IDs being messed up between games or something like that. I mean, it results in absolutely crazy things such as cards not being visible in the hand or such as clicking a card in the hand resulting in a card activated on the battlefield. Do you have any idea what could be going wrong here? I think I'm going crazy with this 'cause I'm absolutely unable to pinpoint what's wrong with this and with the ante (which, perhaps, could be related?...), especially considering that the "post-mulligan bug" doesn't even happen every time (or at least with every card) :(

- Agetian
Agetian
Programmer
 
Posts: 3490
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Sideboarding: Considerations, Questions

Postby Agetian » 16 Dec 2012, 05:49

Ok, I think I found the culprit... unfortunately, the culprit is the current deck persistence system, disabling it fixes both the ante bug and the starting cards/mulligan bug. I'll temporarily disable it, looks like I'll have to think some more about how to implement persistent sideboarding across duels... Any ideas?...

Also, I updated the check for minimum deck size requirements between duels in a match for Constructed and Quest, I hope I understand it right that a deck can become under 60 cards (for Constructed) or 40 cards (for Quest) in size in case you're playing for ante (at least until your next match, that is). So for now, the enforced limit during in-game sideboarding will be either the format-enforced minimum or the current number of cards in deck, whichever is smaller (but if the match ends with less cards than the format enforces, you won't be able to start a new game with that deck until you add more cards to it). Here's something I'm not unsure about: In Sealed Deck and Draft modes, should the player be forced to restore his deck to at least 40 cards? (theoretically speaking it should be possible because the sideboard is always big, but I'm not sure if it should be done).

To summarize, here's what we currently lack that would have been highly useful:
- Persistence of the main deck and sideboard across duels in a match (almost had a working implementation but it had a fatal flaw which pretty much warranted either reimplementation or at least serious rewrite).
- Sorting cards in the in-game sideboard editor (not sure how to implement, tried several things but all failed).

EDIT: I've experimented a bit more and ran into another extreme situation :( I tried writing changes directly into the player's deck (the "deck" parameter of sideboardAndPrepareLibrary) and that kind of worked (at least the main deck and the sideboard are indeed persistent), but they are *too persistent* now (the last main/sideboard configuration stays across different matches - actually, as far as I can tell, until you restart Forge). Not sure if this will be a viable approach to implement it, but if it is, is there any way to reload/reinitialize the deck at every first duel of every match?..

EDIT: Grrr, just spent 6 hours in a row trying to do something with all this, and ended up with nothing that's actually working any better than the previous incarnations if I want persistence and sorting. Any help at all would be highly welcome, for now I'm giving up on it, at least for the day - I'm out of ideas how to make everything work together smoothly. The current SVN state has a supposedly stable (unless there are any previously undiscovered bugs), but feature-incomplete implementation (but at least there's no "cards disappearing in round two/on mulligan" bug and the ante seems to work fine), but there's no sideboard configuration persistence and still no deck list sorting... Feel free to take a look at it and update if you have good ideas. My latest local implementation has "extreme persistence" (as described above), yet even if I find out how to fix the "extremeness" bit by reloading the deck, I'm not sure how to ensure that the card on ante was indeed removed between rounds in that case ('cause if I restore the original state of the deck from some persistent "memory", the card(s) lost on ante will most likely go right in once again, at least in Constructed which doesn't (supposedly?) store the lost cards on hard drive. And if I don't restore the state of the deck, then we have no persistence, which seems to be a catch 22 situation).

Your help is highly welcome.

- Agetian
Agetian
Programmer
 
Posts: 3490
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Sideboarding: Considerations, Questions

Postby Agetian » 16 Dec 2012, 11:26

OK, here's take two at persistence:

I reimplemented deck persistence, now the old "cards disappearing or glitching between duels in a match" bug is gone. Ante seems to work correctly, at least I tested in Quest mode and it seemed to be remembered fine, cards lost on ante did not appear in the sideboarding window or in deck. Not sure how well ante mode ever worked in Constructed/Limited though, I've never played with it, but for some reason the "choose a card you want to put in your deck" window always shows nothing and the ante window becomes polluted over time with antes from previous matches... Not sure if it's the problem of interacting with sideboarding code or just a problem of play-with-ante mode (like I said, I have no previous experience to compare with), but I can't do anything with it, sadly, hopefully someone can help :( P.S. I checked a very old edition (v1.2.9) and seems like the "ante panel becoming polluted" problem was there long before me, although the "add card to deck" window used to work, so maybe it was the sideboarding code that somehow broke it... wish I knew how :\

At any rate, persistence itself works better than the previous time (at least it doesn't glitch as hell), but it has a caveat: in Constructed and Limited modes, it's 100% OK (persistent across duels in a match, but not persistent across matches), but in Quest mode for some reason this implementation makes the quest deck editor show the edited version of the deck until Forge is restarted (an extra call to clearDeckEdits is necessary, but I'm not sure where to put it). This has to be fixed ASAP, but I'm not yet sure how... been looking at this stuff for 8+ hrs already.

At any rate, r18750 is the commit with the latest implementation of persistence, and my last commit before that is the implementation with no persistence at all. Feel free to modify either of those implementations if you know how to help, I would appreciate your help in this respect very much.

- Agetian
Agetian
Programmer
 
Posts: 3490
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Sideboarding: Considerations, Questions

Postby Agetian » 16 Dec 2012, 12:44

Reverted the last implementation again. Meh... nothing seems to work.
Anyway, the latest SVN is with no persistence and no sorting. Again. 10+ hrs spent on nothing.

EDIT: OK, that's it, I confirmed, after nearly 11 hours of working non-stop on this, that I have no idea how to properly implement persistence and make it work with all the Forge facilities that seem to interact with it in the craziest of ways, most notably how to make it friends with the ante. It's either ante or persistence, I think - if it hadn't been for ante, the idea in r18750, now reverted, would have most likely worked perfectly, but I have no idea where and how to stick ante into that and make it work and not glitch. Hopefully someone else will have better ideas about persistence, and hopefully sorting as well, but personally I'm done with it, at least for quite a while, because I feel incredibly tired and frustrated by the utter waste of time that my experiments were. :(

For now, like I said, there is full sideboarding support, hopefully working with no major issues, but with no persistence (which means you have to re-sideboard between duels in the same matches starting with the initial deck configuration) and with no sorting of card lists in the in-game sideboard editor. Sorry. :( Anyone brave enough to try to tackle this is welcome to use any of my previous commits, including the reverted ones (I think r18750 was actually the closest to "getting it right"), should they prove to be in any way useful.

- Agetian
Agetian
Programmer
 
Posts: 3490
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Sideboarding: Considerations, Questions

Postby Agetian » 16 Dec 2012, 15:03

OK, I'm stubborn... trying to revive the idea in r18750. So far, was able to (seemingly) befriend sideboard changes with ante in quest mode, will see if I actually get somewhere this time or if I'll have to revert again and call it quits on sideboarding persistence for real.

- Agetian
Agetian
Programmer
 
Posts: 3490
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Sideboarding: Considerations, Questions

Postby friarsol » 16 Dec 2012, 15:10

Agetian wrote:So for now, the enforced limit during in-game sideboarding will be either the format-enforced minimum or the current number of cards in deck, whichever is smaller (but if the match ends with less cards than the format enforces, you won't be able to start a new game with that deck until you add more cards to it). Here's something I'm not unsure about: In Sealed Deck and Draft modes, should the player be forced to restore his deck to at least 40 cards? (theoretically speaking it should be possible because the sideboard is always big, but I'm not sure if it should be done).
You seem to have posted a book while I was sleeping, but you shouldn't need to restore your deck size.

Ante can force your deck below the minimum of the format while the match is in session. To determine the deck minimum deck size in any format (where losing cards due to ante is possible), you should take the lower value between the format-enforced minimum and the size of your deck entering the 2nd or 3rd game. You should never be forced to sideboard cards to come back up to the deck minimum. (And that mostly matters for formats where you don'to have to sideboard 1:1).

As far as where cards in ante end up in between games, no they don't go into your sideboard, no they don't go into your deck. They just go into your "trunk" as it were. Not available to either player, but not in the original player's deck. I'll try to read through your mini novel and see if there is any other pointers I can give.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: [WIP] Sideboarding: Considerations, Questions

Postby Agetian » 16 Dec 2012, 15:25

Yeah, I was through quite a lot alright. To summarize, here's what I currently have:

- Sideboarding itself works. With persistence.
- Ante works correctly, as far as I can tell, in quest mode - cards that were ante'd disappear from your deck and sideboard and are "sold for 0 credits" (according to the original method call). Cards won on ante also correctly appear in your trunk after the match.
- Ante almost works correctly in other modes. In all modes, it functions correctly during the game itself, at least for the human (not sure about the AI, see below) - that is, cards lost by the human on ante disappear and do not reappear in the main or in the sideboard, even across several matches, e.g., in a Draft.
- What does *not* work for some stupid reason is that if I win something from the AI in Draft or Sealed or Constructed, it's not offered to me (I just get an empty dialog box asking what I'd like to put into my deck), I assume it probably stays in the AI deck, but the reason why is beyond my comprehension.
- What also does not work exactly as intended is that if, e.g., you start a Draft match and lose a couple games, thus losing two cards on ante, the game editor will show that you're down one card - the one you lost in the first game will disappear and the one you lost in the second will still be there. If you restart Forge, both cards reappear in the deck because the change is temporary anyway (and, as far as I can tell, always was). I wish I knew where to hook up the deck list refresh to properly reload the deck list from the original, unedited deck after the match... this should be easy to fix, but I'm missing a certain crucial link.

That's as far as I got... if I revert the latest persistence changes, ante will presumably work 100% correctly in all modes (including the deck list data) but, you know, no persistence for sideboarding. I spent the entire day (over 13 hours and counting) working on this puzzle, and this is as far as I got it thus far, and I desperately need help with those elements I just can't seem to put in their proper places in this riddle.

- Agetian
Agetian
Programmer
 
Posts: 3490
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Sideboarding: Considerations, Questions

Postby friarsol » 16 Dec 2012, 15:43

Agetian wrote:That's as far as I got... if I revert the latest persistence changes, ante will presumably work 100% correctly in all modes (including the deck list data) but, you know, no persistence for sideboarding. I spent the entire day (over 13 hours and counting) working on this puzzle, and this is as far as I got it thus far, and I desperately need help with those elements I just can't seem to put in their proper places in this riddle.
Before you assume you broke ante in the other modes, we should probably download the latest beta and confirm it actually was working. It may have been broken before you.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: [WIP] Sideboarding: Considerations, Questions

Postby Agetian » 16 Dec 2012, 15:48

Yeah, I'm going to try that - I don't know if putting a card from the AI's deck to your deck worked before, but I know that the card count in the deck list not being updated is definitely something I just need to take care of... Do you know where exactly and when the game refreshes information about decks after the game is over? I mean, if my Draft deck showed 40 cards before the game started and then after the game it shows 39, where exactly is the game refreshing this count?

EDIT: Yes, the "take a card from the AI" thing doesn't work in v1.3.3 either, so at least that's not my fault... :) At least I think it's not. It does work in v1.2.9, but not in the latest beta, and I haven't touched anything ante-related before v1.3.3. Also, the "ante panel pollution" problem where the ante panel is not being cleared between matches also existed both in v1.3.3 and long before v1.3.3 (I tried it on v1.2.9 and it didn't work correctly even back then)

So, the main problem now is getting the card count right after the game is over (unless it's a quest mode match).

- Agetian
Agetian
Programmer
 
Posts: 3490
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Sideboarding: Considerations, Questions

Postby Agetian » 16 Dec 2012, 16:09

Ohhh by the way.... v1.3.3 doesn't get the deck card count right after losing cards on ante in Limited mode either! So... it's not something my code is breaking, actually...

- Agetian
Agetian
Programmer
 
Posts: 3490
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Sideboarding: Considerations, Questions

Postby Agetian » 16 Dec 2012, 16:19

As of r18756, sideboarding must have persistence *and* interact correctly with ante (in quest mode - fully correctly, in other modes - at least as correctly as it did in stock v1.3.3).

Now, unless there's a ton of bugs in this implementation as well (keep your fingers crossed :)), the only major thing remaining is sorting... which is something, I hope, you'll be able to tackle eventually, Sol, 'cause I'm out of ideas at all about that (tried a lot but nothing really worked, and I wasn't even close).

- Agetian
Agetian
Programmer
 
Posts: 3490
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Sideboarding: Considerations, Questions

Postby Agetian » 17 Dec 2012, 04:47

kk, r18758: testing indicates no serious new issues. The infamous "cards disappearing between rounds" bug is definitely gone.

To sum up progress thus far:
We have:
- Sideboard creation support in relevant deck editor modes.
- In-game sideboarding with persistence between rounds in a match.
- Sideboard supported as a zone, with some relevant cards already in (thanks Sloth and swordshine!).
- Correct validation of decks, both before the game starts and between the rounds (Limited min 40, Constructed min 60, free-form sideboard/main in Draft and Sealed, 1:1 sideboarding with 0 or 15 cards allowed in sideboard in Constructed (all variants) and Quest; OK to have less than minimum between rounds in a match in all modes if lost cards on ante).
- Correct (fingers crossed) interaction of sideboarding with other relevant aspects of Forge rule enforcement (mulligan and ante interactions were corrected, initial hand and library between rounds were both corrected, everything else looks so far so good).

We don't yet have:
- Sorting in the in-game sideboard editor (tough for me to implement, trickier than it seemed to be).
- AI sideboarding (tough for me to implement, if anyone is willing to try this, a comment is left inside sideboardAndPrepareLibrary in GameNew.java for where to hook up the potential AI sideboarding code).

- Agetian
Agetian
Programmer
 
Posts: 3490
Joined: 14 Mar 2011, 05:58
Has thanked: 684 times
Been thanked: 572 times

Re: [WIP] Sideboarding: Considerations, Questions

Postby krevett » 17 Dec 2012, 08:07

I'm no coder, nor programmer but implementing AI sideboarding looks like a HUGE amount of work!! AI should identify what kind of deck human is playing (aggro, ramp, control, etc...) what kind of cards in his sideboard could be effective against the human deck (additional removals, anti-artefacts/enchantements, mass removals, etc...) and furthermore, what main deck cards to replace by the sideboard ones...

Seems very difficult to implement (if you manage to implement this one you guys really rock!!!!!!)
Good luck on your tries ;)
krevett
 
Posts: 109
Joined: 21 Feb 2012, 22:24
Location: France
Has thanked: 18 times
Been thanked: 9 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 9 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 9 users online :: 0 registered, 0 hidden and 9 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: No registered users and 9 guests

Login Form