It is currently 26 Apr 2024, 05:25
   
Text Size

Forge version 1.5.7

Post MTG Forge Related Programming Questions Here

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

Re: Forge version 1.5.7

Postby drdev » 08 Dec 2013, 23:51

To fix the issue with the card being used to pay its own additional/alternative cost, I opted to simply remove the source card from the list built in canPay and payHuman of CostDiscard/CostExile. That way the card still remains in its old zone until prerequisites are met, and the Reprisal/Guul Draz Specter corner case remains fixed.

Can anyone think of any other corner cases I would need to worry about here?
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Re: Forge version 1.5.7

Postby friarsol » 09 Dec 2013, 00:16

drdev wrote:To fix the issue with the card being used to pay its own additional/alternative cost, I opted to simply remove the source card from the list built in canPay and payHuman of CostDiscard/CostExile. That way the card still remains in its old zone until prerequisites are met, and the Reprisal/Guul Draz Specter corner case remains fixed.

Can anyone think of any other corner cases I would need to worry about here?
I honestly don't understand what these changes are about. We were following the rules the way they were setup and didn't have to worry about corner cases and changing values like this. Why can't you just find a better way of displaying the card that's being cast?

Edit: Like say, if you hover over the input prompt while a spell is being cast, it shows the card in the CardDetailPanel.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Forge version 1.5.7

Postby drdev » 09 Dec 2013, 03:42

friarsol wrote:
drdev wrote:To fix the issue with the card being used to pay its own additional/alternative cost, I opted to simply remove the source card from the list built in canPay and payHuman of CostDiscard/CostExile. That way the card still remains in its old zone until prerequisites are met, and the Reprisal/Guul Draz Specter corner case remains fixed.

Can anyone think of any other corner cases I would need to worry about here?
I honestly don't understand what these changes are about. We were following the rules the way they were setup and didn't have to worry about corner cases and changing values like this. Why can't you just find a better way of displaying the card that's being cast?

Edit: Like say, if you hover over the input prompt while a spell is being cast, it shows the card in the CardDetailPanel.
This change is mostly to address the disappearing card issue that had bothered me since I started on Forge. For the card to disappear from your hand when you first click on it and then go seemingly nowhere, it was always very jarring. It was particularly bad when clicking cards that couldn't be cast for lack of targets, which would disappear then immediately animate their way back into your hand. I'm also coming from MTGO, where cards didn't leave the hand until all costs were paid and targets chosen, which always made sense to me. It's not like the other players in the game should get to know about cards you cancel casting, whereas with the old implementation those cards would spend time on the stack before returning to your hand upon cancel, theoretically giving AI logic a chance to see the spell.

And onto that issues like Hellbent cards activating when casting the last card in hand before targets were even chosen, and it was a definite issue that needed fixing.

I did spend quite a bit of time today trying to see if I could still change the card's zone but have everything else work as I'd like, and the way I ended up implementing it was by far the simplest I could come up with. I get that the rules state that spells go "on the stack" as soon as they're declared, however that doesn't translate as well to a computer version of the game, which MTGO's implementation clearly illustrates. I also don't feel it's truly on the stack at that point, as otherwise Counterspell should be able to target itself since it would be on the stack when choosing targets.

If you can think of a case that my fix doesn't handle, let me know and I'll update my fix as needed. But I assure you that the card remaining in the zone it was cast from simplifies things considerably.
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Re: Forge version 1.5.7

Postby Doomlord » 09 Dec 2013, 13:04

By the rules, the spell goes on the stack the moment you start casting it.

If you do it another way, the game is no longer Magic: The Gathering as it is played IRL. Forge has to follow the Comprehensive Rules down to the last jot, at least in theory, if it wants to be a Magic program. (I understand that there may be cases where Forge is not yet perfect, and so the current implementation might not be exactly the correct one. But there is a correct one, and to choose intentionally to do it a different way is flat-out fundamentally wrong.)
Doomlord
 
Posts: 47
Joined: 07 Dec 2011, 21:07
Has thanked: 0 time
Been thanked: 2 times

Re: Forge version 1.5.7

Postby swordshine » 09 Dec 2013, 13:57

drdev wrote:This change is mostly to address the disappearing card issue that had bothered me since I started on Forge. For the card to disappear from your hand when you first click on it and then go seemingly nowhere, it was always very jarring. It was particularly bad when clicking cards that couldn't be cast for lack of targets, which would disappear then immediately animate their way back into your hand. I'm also coming from MTGO, where cards didn't leave the hand until all costs were paid and targets chosen, which always made sense to me. It's not like the other players in the game should get to know about cards you cancel casting, whereas with the old implementation those cards would spend time on the stack before returning to your hand upon cancel, theoretically giving AI logic a chance to see the spell.

And onto that issues like Hellbent cards activating when casting the last card in hand before targets were even chosen, and it was a definite issue that needed fixing.

I did spend quite a bit of time today trying to see if I could still change the card's zone but have everything else work as I'd like, and the way I ended up implementing it was by far the simplest I could come up with. I get that the rules state that spells go "on the stack" as soon as they're declared, however that doesn't translate as well to a computer version of the game, which MTGO's implementation clearly illustrates. I also don't feel it's truly on the stack at that point, as otherwise Counterspell should be able to target itself since it would be on the stack when choosing targets.

If you can think of a case that my fix doesn't handle, let me know and I'll update my fix as needed. But I assure you that the card remaining in the zone it was cast from simplifies things considerably.
We may take a poll to see if more users like this new implementation. I vote for the original implementation. The latest changes made me a little confused because they gave me an illusion that I hadn't click the card to cast it.
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Forge version 1.5.7

Postby friarsol » 09 Dec 2013, 16:43

drdrv,

I get that you come from MTGO, but not everything needs to work exactly like MTGO does. In fact, many people I know who play MTGO complain about a lot of the ways their interface works. Personally, the card not being removed as you've changed it is jarring to me, and I imagine others that have been using Forge for some time will feel the same.. While I understand the whole "just because that's the way things are, doesn't mean I shouldn't change it" but it also feels like you are just changing things the way it suits you and not taking the existing coders and userbase into consideration at all. This is very frustating. Especially when we are following the rules more accurately than MTGO is.

drdev wrote:It's not like the other players in the game should get to know about cards you cancel casting
If you start casting a spell in a tournament, and then realize that you can't afford it (or something else illegal happened), that's exactly what happens. The game rewinds to just before you started casting your spell, you potentially get a Warning from the Judge, and you inadvertently give information to your opponent. I honestly don't see where you are drawing this distinction of "Computer form Magic" with "Real life Magic" for casting spells. One example of how one developer choosing to do a certain set of actions is not a "clear illustration", it's a design decision. I disagree with your notion that this makes things "simpler" as you've had to add hacky code into costs to handle corner cases, where none were needed for these cases previously.

drdev wrote:And onto that issues like Hellbent cards activating when casting the last card in hand before targets were even chosen, and it was a definite issue that needed fixing.
Do you have an example of this? Was this in reference to the previous method, or your method?


It seems your real problem is that the card disappears, but your solution of leaving it in your hand doesn't make sense to me. If you want it to be visible somewhere for Spell Casting, I can totally understand that. But the way it is it just kinda sits there, in a zone it's not in feels wrong. Nothing even changes on the UI where I clicked!

I've pasted the comprehensive rules below, so you can see that it is indeed on the Stack at this point. In addition, spells can never target themselves, which is why it's not a legal target, not because it's not on the stack. (This is why when you Redirect a Counterspell, you can't redirect the Counterspell to itself, but you can target the Redirect itself, since it's still in the middle of resolving.)

Comprehensive Rules | Open
601.2. To cast a spell is to take it from where it is (usually the hand), put it on the stack, and pay its costs, so that it will eventually resolve and have its effect. Casting a spell follows the steps listed below, in order. If, at any point during the casting of a spell, a player is unable to comply with any of the steps listed below, the casting of the spell is illegal; the game returns to the moment before that spell started to be cast (see rule 717, "Handling Illegal Actions"). Announcements and payments can't be altered after they've been made.

601.2a The player announces that he or she is casting the spell. That card (or that copy of a card) moves from where it is to the stack. It becomes the topmost object on the stack. It has all the characteristics of the card (or the copy of a card) associated with it, and that player becomes its controller. The spell remains on the stack until it's countered, it resolves, or an effect moves it elsewhere.

601.2b If the spell is modal the player announces the mode choice (see rule 700.2). If the player wishes to splice any cards onto the spell (see rule 702.46), he or she reveals those cards in his or her hand. If the spell has alternative or additional costs that will be paid as it's being cast such as buyback or kicker costs (see rules 117.8 and 117.9), the player announces his or her intentions to pay any or all of those costs (see rule 601.2e). A player can't apply two alternative methods of casting or two alternative costs to a single spell. If the spell has a variable cost that will be paid as it's being cast (such as an {X} in its mana cost; see rule 107.3), the player announces the value of that variable. If a cost that will be paid as the spell is being cast includes hybrid mana symbols, the player announces the nonhybrid equivalent cost he or she intends to pay. If a cost that will be paid as the spell is being cast includes Phyrexian mana symbols, the player announces whether he or she intends to pay 2 life or the corresponding colored mana cost for each of those symbols. Previously made choices (such as choosing to cast a spell with flashback from a graveyard or choosing to cast a creature with morph face down) may restrict the player's options when making these choices.

601.2c The player announces his or her choice of an appropriate player, object, or zone for each target the spell requires. A spell may require some targets only if an alternative or additional cost (such as a buyback or kicker cost), or a particular mode, was chosen for it; otherwise, the spell is cast as though it did not require those targets. If the spell has a variable number of targets, the player announces how many targets he or she will choose before he or she announces those targets. The same target can't be chosen multiple times for any one instance of the word "target" on the spell. However, if the spell uses the word "target" in multiple places, the same object, player, or zone can be chosen once for each instance of the word "target" (as long as it fits the targeting criteria). If any effects say that an object or player must be chosen as a target, the player chooses targets so that he or she obeys the maximum possible number of such effects without violating any rules or effects that say that an object or player can't be chosen as a target. The chosen players, objects, and/or zones each become a target of that spell. (Any abilities that trigger when those players, objects, and/or zones become the target of a spell trigger at this point; they'll wait to be put on the stack until the spell has finished being cast.)
Example: If a spell says "Tap two target creatures," then the same creature can't be chosen twice; the spell requires two different legal targets. A spell that says "Destroy target artifact and target land," however, can target the same artifact land twice because it uses the word "target" in multiple places.

601.2d If the spell requires the player to divide or distribute an effect (such as damage or counters) among one or more targets, the player announces the division. Each of these targets must receive at least one of whatever is being divided.

601.2e The player determines the total cost of the spell. Usually this is just the mana cost. Some spells have additional or alternative costs. Some effects may increase or reduce the cost to pay, or may provide other alternative costs. Costs may include paying mana, tapping permanents, sacrificing permanents, discarding cards, and so on. The total cost is the mana cost or alternative cost (as determined in rule 601.2b), plus all additional costs and cost increases, and minus all cost reductions. If the mana component of the total cost is reduced to nothing by cost reduction effects, it is considered to be {0}. It can't be reduced to less than {0}. Once the total cost is determined, any effects that directly affect the total cost are applied. Then the resulting total cost becomes "locked in." If effects would change the total cost after this time, they have no effect.

601.2f If the total cost includes a mana payment, the player then has a chance to activate mana abilities (see rule 605, "Mana Abilities"). Mana abilities must be activated before costs are paid.

601.2g The player pays the total cost in any order. Partial payments are not allowed. Unpayable costs can't be paid.
Example: You cast Altar's Reap, which costs {1}{B} and has an additional cost of sacrificing a creature. You sacrifice Thunderscape Familiar, whose effect makes your black spells cost {1} less to cast. Because a spell's total cost is "locked in" before payments are actually made, you pay {B}, not {1}{B}, even though you're sacrificing the Familiar.

601.2h Once the steps described in 601.2a-g are completed, the spell becomes cast. Any abilities that trigger when a spell is cast or put onto the stack trigger at this time. If the spell's controller had priority before casting it, he or she gets priority.

601.3. Some spells specify that one of their controller's opponents does something the controller would normally do while it's being cast, such as choose a mode or choose targets. In these cases, the opponent does so when the spell's controller normally would do so.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Forge version 1.5.7

Postby drdev » 09 Dec 2013, 21:28

The Hellbent issue is one with the old method, as can be seen by your ability target Guul Draz Specter using a Reprisal that's your last card in hand (an example pointed out by Marek14 on the last page of this thread). Unless I completely misunderstood him and that's actually how it should work?

You say the old way is better than MTGO because it follows the rules more stringently, but have you considered that MTGO was designed with the conscious choice to use a slightly looser version of the rules that translated better into a computer version of Magic? The computer version offers features like validating if you can pay for a spell or if there are valid targets, so should we be punishing users for using these features by having the card revealed to other players? The AI doesn't reveal each card in its hand as it uses the same validation logic to determine what it can cast, so why disadvantage the human player here?

You also say my fixes were "hacky", however all I did was enforce that a spell couldn't exile or discard itself to pay its own additional/alternative cost (assuming the cost wasn't Discard/Exile CARDNAME), which is technically correct under the rules. I see these rules enforcement checks being good to have even with the card moving to the stack earlier.

Ok, I've said my piece. Ultimately, I want to respect the rules and everyone's concerns. So here's my proposal:

  • Cards go on the stack when they are first clicked while meeting prerequisites, but actually display on the stack pane during that time.
  • If a spell has no valid targets, it still goes on the stack right away, however instead of immediately returning to your hand, you're given a prompt indicating that there are no valid targets, with only the Cancel button enabled to return it to your hand.
  • If you cancel a spell, the card is returned to the same position in your hand as it was cast from instead of to the end.
  • If I understood correctly about the Guul Draz Specter + Reprisal scenario, we simply avoid checking static abilities until the spell's prerequisites are met. If I misunderstood Marek14, we can continue to check static abilities as before.

Does that sound agreeable to everyone?
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Re: Forge version 1.5.7

Postby friarsol » 09 Dec 2013, 21:38

drdev wrote:The Hellbent issue is one with the old method, as can be seen by your ability target Guul Draz Specter using a Reprisal that's your last card in hand (an example pointed out by Marek14 on the last page of this thread). Unless I completely misunderstood him and that's actually how it should work?
I believe Marek was telling you that you that since the Reprisal is moved to the Stack before Targets are chosen, your own Guul Draz Specter is a legal target. If the Reprisal is still in your Hand at the time targeting happens, it wouldn't work.

Edit: Basically, you should be able to Reprisal your own Specter, but if the Spell isn't moved to the Stack as we had it, that corner case would no longer be allowed, even though it should.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Forge version 1.5.7

Postby drdev » 09 Dec 2013, 22:17

friarsol wrote:
drdev wrote:The Hellbent issue is one with the old method, as can be seen by your ability target Guul Draz Specter using a Reprisal that's your last card in hand (an example pointed out by Marek14 on the last page of this thread). Unless I completely misunderstood him and that's actually how it should work?
I believe Marek was telling you that you that since the Reprisal is moved to the Stack before Targets are chosen, your own Guul Draz Specter is a legal target. If the Reprisal is still in your Hand at the time targeting happens, it wouldn't work.

Edit: Basically, you should be able to Reprisal your own Specter, but if the Spell isn't moved to the Stack as we had it, that corner case would no longer be allowed, even though it should.
Ok, so I did misunderstand then. I thought Marek was stating a corner case with the old logic that I was actually fixing. Thank you for clearing that up.

I will definitely move forward with having the card move to the stack immediately then. Sorry for the confusion and any stubbornness projected on my part. I mostly just hated the disappearing card issue and was trying to fix it to work like MTGO with the fewest code changes possible. Hopefully my next attempt will be more agreeable to everyone.
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Re: Forge version 1.5.7

Postby friarsol » 09 Dec 2013, 22:31

drdev wrote:I will definitely move forward with having the card move to the stack immediately then. Sorry for the confusion and any stubbornness projected on my part. I mostly just hated the disappearing card issue and was trying to fix it to work like MTGO with the fewest code changes possible. Hopefully my next attempt will be more agreeable to everyone.
It's fine. I've definitely been plenty stubborn on these boards before. It's a bit tougher when it's just over posts, certain phrasing can be taken harder than they were meant, and mostly positive intentions can spin out of control.

Spells are already replaced to the same place if canceled from the graveyard, so going back to the same place in your hand should be fine. And showing a little prompt to explain why you can't do what you were trying to do would be helpful. I've definitely done the "Oh shit, I'm still in Combat" thing before.

The biggest thing to be careful for is the actual Stack panel that we display lists SpellAbilityStackInstances, which aren't actually created until the whole SpellAbility is fully paid for. Maybe there's a way to display a spell you are actively casting on the top of that list for you, but not show it for anyone else. Since the Stack Zone isn't really visible to anyone, just the SpellInstances, you wouldn't be giving away information to a remote player, and we can probably make sure the AI doesn't cheat and peek at you while you are moving Cards to the Stack Zone, only when you move SIs there.

0. Lightning Bolt (Casting)
1. Giant Growth targeting Atog.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Forge version 1.5.7

Postby Marek14 » 09 Dec 2013, 23:21

As for Guul Draz Specter / Reprisal, yes, I was saying that you should be able to target it (though opponent's specter, not your own -- Guul Draz Specter gets bonus if opponent's hand is empty). Consequently, you wouldn't be able to target your Maro if you have exactly 4 cards in hand, including Reprisal.

Corner cases are the most fascinating specimens, aren't they?
Marek14
Tester
 
Posts: 2761
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 297 times

Re: Forge version 1.5.7

Postby drdev » 13 Dec 2013, 02:48

I just finished implementing a usability improvement such that optional triggered abilities are now confirmed via the Prompt pane rather than a dialog. This change utilizes the new InputYesOrNo input class I added.

As part of this, I made it so the trigger description is not included in the message if the Compact Prompt setting is on. The result looks like this:

ConfirmTrigger.png

My plan is to transition other message/confirmation dialogs (with 1-2 buttons) to use the Prompt pane instead where it makes sense. Hopefully this should significantly reduce the frequency of popups during game play.

Let me know if you have any requests for specific dialogs, or concerns over this plan in general.

Thanks.
-Dan
drdev
Programmer
 
Posts: 1958
Joined: 27 Jul 2013, 02:07
Has thanked: 189 times
Been thanked: 565 times

Previous

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 127 guests


Who is online

In total there are 127 users online :: 0 registered, 0 hidden and 127 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 127 guests

Login Form