More parsers requested

All additions requested or suggested to improve the card coding language.
Zethfox
Posts: 3029
Joined: Thu Jun 10, 2010 11:28 pm

Re: More parsers requested

Post by Zethfox » Tue Feb 22, 2011 3:21 pm

they were intruduce in 14.1 yeah...we're slowly converting to the use of them as we go....

Nazar-WTH-PCgamer
Posts: 60
Joined: Sat Feb 19, 2011 5:24 am

Re: More parsers requested

Post by Nazar-WTH-PCgamer » Tue Feb 22, 2011 3:46 pm

To answer your question about my intent with the "random" effects, I did wish to use it in some cases to fill in the blank for the decision making of AI. Although I agree with you it ain't fair for the AI to have no control over its own decision process so I can understand the reason for not using such random decision for AI.In some situations though, I really wished to use it really to code an effect that requires a random target permanent, creature or player. Don't ask me which card because I couldn't remember them on the spot but if I search among the ones I tried but failed to code I could find them.

If I go over my first post examples (please consider each one as a different card rather than multiple effects from same card)...

example1: {T}:damage:1 (player;random) -- {T}: Inflicts 1 damage to random player
self explanatory, but since only 2 options are available here (you/AI) a coin flip could determine the target just as well

example2: [email protected]:moveto(battlefield;random) all(this) -- every upkeep, this card may randomly change ownership
self explanatory, but again since only 2 options are available here (you/AI) a coin flip could determine the target just as well

example3: auto(bury(creature;random|opponentbattlefield) -- randomly sacrifices an opponent's creature which is in play
this would stricly be meant to code an card effect with the same text as the above...
(or equivalent like "as this card comes into play, opponent sacrifices a random creature from his battlefield")

example4: auto=moveto(opponentbattlefield) land[basic;random|opponentlibrary] -- opponent puts random basic land into play a from his library
in this case, I must speak about the real random effect (1) but also decision making (2)...
(1) the real random effect is self explanatory and is only intended to execute what the text on the card mentions
(2) in this example alone, the decision making for a monocolored deck "could" replace the decision making of AI. In fact, unless AI uses a multicolored deck, it wouldn't make any different using the random keyword to select a basic land compared to the situation for which the AI did specifically choose it all by itself. In this case, only one type of basic land is available (for example, in a green deck, one forest is no different from another forest). For that reason, "choosing" rather than "receiving at random" couldn't provide any strategic advantage to AI especially since the deck is also shuffled then. That could make AI act better for lots of cards until a complete decision process is implemented to cover for all other situations where a strategic advantage is in the balance and randomness isn't a fair option.
Nazar is meant to rule the world... Someday! Once Nazar is in charge, goblins won't have to hide or shovel orcish poops no more. Vote for Nazar!!!

Nazar-WTH-PCgamer
Posts: 60
Joined: Sat Feb 19, 2011 5:24 am

Re: More parsers requested

Post by Nazar-WTH-PCgamer » Tue Feb 22, 2011 4:15 pm

Zethfox wrote:there was only 1 card which cared about turns and i think i added support for it in 15.1/current...do you know of others?

if you can show me an exsample of a card that could use currentturn it would take but a just a few lines of code to add support for it...i just didnt see much else that needed it.
You probably meant Serra Avenger but I wanted to use the turn counter for 2 reasons...

(1) to display in the game as an improvement to the user interface
(2) to use it to code the cards with "suspend" abilities. Unles you can tell me of a newly implemented way to do it.

For "suspend", I tried so far using a combination of "become (premade) token nothing (inplay but can't do anything neither be a target) with X exile counter" along with an ability on that token "@eachmyupkeep remove 1 exile counter" then its last ability "become itself (whatever the original card name) back again". It didn't fully work for me but I'm sure I'm only bits away from making it work. I sure didn't try any such cards in AI deck. My problem is such coding is way too complex for no reason and is a perfect example of what you call workaround. That is mainly why I asked if a turn counter keyword could be added. In fact, I didn't play yet v0141 (I downloaded it yesterday evening) so I might be late asking if the access to exile zones has been implemented or not? That would be another great asset (though it is more a UI concern and not a card coding topic).
Nazar is meant to rule the world... Someday! Once Nazar is in charge, goblins won't have to hide or shovel orcish poops no more. Vote for Nazar!!!

Zethfox
Posts: 3029
Joined: Thu Jun 10, 2010 11:28 pm

Re: More parsers requested

Post by Zethfox » Wed Feb 23, 2011 12:23 pm

ok, heres where i need to fill you in on our goals. when you ask for tool to code workarounds, the general respondse will not be what you were after....suspend will have nothing to do at all with the turn.
(suspend is a triggered effect involving the use of counters...when the last is removed the player then plays the card as tho it were just cast)..
..and no workarounds, no "become" tokens...none of that...i actually have 90% working suspend right now as we speak, it is TRUE suspend...the only issue ive run into is re-instating a targetchooser for targetted suspend cards...other then that all the creatures for it and non-targetted effects are already working...as true suspend...not a workaround....

as for the random effects i think only the astral sets use this...it was a special set released for shandalar...i would not mind adding those effects..tho it is quite clear that those are not the cards you were after...and no other cards in MTG have such random effects aside from random discarding which is supported....

something you seem to over look is what having "random" choices being made actually does...consider this...you have your best card in hand which could win you the match...ai uses a card that states "target player discards a card"...some dummy decided to add this as "target(player) discard:1" which is the random discard....now in a raging mood because you lost; becuase your BEST card was discarded...you come screaming at us in our forum about how YOU were supposed to be able to pick the card....
if any of those card get added with such "random" effects it would extend to the player also...as currently we only support one primitive per card name....making those card "borderline" at best....personally if im going to sit and code an effect as a workaround...why wouldnt i just code the REAL support instead?

since i joined the project my main focus has been in replacing some of the most gruesome workarounds that were used in wagic with true support...ive roughly effected over 1k of the existing cards in wagic...and added close to 3k new ones...the 1k cards were all using workarounds...bug ridden, erroneous, and incorrect...less then borderline....i almost laugh at how "old bushido" was coded...what a mess....

moral of the story...we're not adding tools to create workarounds...atleast im not going to...and im the main ability coder at the current time....
you mentioned coin flip again...and again i will mention its already coded as TRUE coin flip...im just waiting for better menu support to get added so the player can choose "heads or tails" becuase im sure if i dont add it with that choice people will complain....

as for exile gui access...i added it once...but since suspend or any exile interaction was a FAR away dream at the time...i opted to remove it...it was added the same time i added access to opponents hand...

link to astral set....these are the only cards matching the use of random...
http://www.wizards.com/magic/magazine/A ... arcana/124

wololo
Site Admin
Posts: 3727
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: More parsers requested

Post by wololo » Wed Feb 23, 2011 11:54 pm

Zethfox wrote:


moral of the story...we're not adding tools to create workarounds...atleast im not going to...and im the main ability coder at the current time....
Zeth´s words are to be taken with a grain of salt. Although I agree with him when it comes to Magic, one of my goals for wagic in the long term is to support more games. So if you have a valid use case I want to take this kind of request into account.

Nazar-WTH-PCgamer
Posts: 60
Joined: Sat Feb 19, 2011 5:24 am

Re: More parsers requested

Post by Nazar-WTH-PCgamer » Thu Feb 24, 2011 8:16 pm

Zethfox wrote: [...] your BEST card was discarded...you come screaming at us in our forum about how YOU were supposed to be able to pick the card.... [...]
Please be assured I wouldn't want that to happen in any way ;) Let's just say I want to enjoy the game to its best. If some existing workarounds let me use a few more wonderful cards without any risk, then I like coding them all by myself but won't beg for you guys to work on that. I agree with you that long term progress for the game is far more relevant for devs to work on than coding workaround-keywords or full workaround-cards. Yet, I'm sure other users would agree that we still appreciate comments and suggestion on how to add certain cards or improve our homemade coded cards until the real tools are created to support them fully. The reason I raised the "turn" and "suspend" subject is because a lot of cards require this and I thought I could suggest a way of coding them if the "turn" would already exist in the game without being specifically used for keyword yet. Since you've already covered most of the "suspend" coding, my request becomes irrelevant and I will now wait knowing it will be solved in the future.

As for wololo's reply, I will have to search back which specific cards with random effect I tried to code but couldn't. I have none I can name atm.
Nazar is meant to rule the world... Someday! Once Nazar is in charge, goblins won't have to hide or shovel orcish poops no more. Vote for Nazar!!!

Zethfox
Posts: 3029
Joined: Thu Jun 10, 2010 11:28 pm

Re: More parsers requested

Post by Zethfox » Fri Feb 25, 2011 12:32 pm

thats what the card code and custom cards section is all about...tho alot of people assume that becuase a workaround does work, that the dev team is going to add it, i tend to recieve emails like "why can't this be added" which i have to explain to them that we are trying to navigate away from workarounds..at which point some people feel offended and reply "well X workaround was added, my card is the same, why cant it be in too".

..as the ability coder for the last (guesstimate) 9 months...i was CONSTANTLY recieve private emails concerning "X and Y workaround not working blah blah after blah patch" to which i would waste my free time trying to find out why....it would end up being that a loophole bug was fixed somewhere in an ability that was allowing the workaround to work...so it became a matter of deciding "break this ability again so the workaround works? or leave the fixed ability as it is and say "too bad so sad"...you can see what i choose to do...not to mention it deprecates my card counts when real support is added...

since then doc and i have worked pretty hard at "workaround" smashing...and trust me, i want nothing more then to fill the parser with wonderful new keywords and tools...but im limited by what im allowed to add...
there was a point where i was adding "extra support that doesnt have to do with MTG, just incase they make cards that would do X and Y" but i was told to stop doing that and to stop "trying to predict the future of MTG"...when i would mention "well what if a player wants to use it to code cards"...the answer was a blunt "no"....so now i add the base support exactly as the cards state...nothing more...

even more so now lately that the parser for these abilities has almost grown to 4 times its original size...the amount of code i add for abilities has too be watched carefully...i cant just go "im going to add 200 lines of code to the parser for random abilities that MTG cards dont use"...as it likely to have wololo flying to florida,usa to personally shoot me in the head executioner style...

i do have freedom to add support for real code...which that im happy with... just cant go all out adding a bunch of stuff thats "custom" support....

also about suspend, it has nothing to do with "turn" at all...it has to do with counters, and when you remove the last one the spell is to be cast without paying its mana cost...

there is a very limited amount of cards that use "turn" and i beleve i already added support for them...

when you are looking at an ability and trying to decide whats needed to code it, you have to look at this...
what does it do?
what OTHER existing abilities do something similar?
how will i execute this without adding 2000 lines of code to the svn?

ill dissect suspend for you...so you get an insiders point of view of how i add support

Image

Creature — Bird (3/3)
Flying, protection from black
Suspend 3— (Rather than cast this card from your hand, you may pay and exile it with three time counters on it. At the beginning of your upkeep, remove a time counter. When the last is removed, cast it without paying its mana cost. It has haste.)


ok first thing i see i need right off the bat is a new alternative cost type...which means adding a parser in primitives...suspend=...which mind you tends to always get me yelled at when i do...

suspend={3}
this line will simply set the suspend cost on the card...
now i need to add a new play type...suspend...in the rules.cpp
this will allow you to pay the suspend and send the card on its way to the exile with the counters placed on it....
i will now need to add new discriptors that state a card is "suspended" for use only internally...and maybe at this point ill add the targetchooser descriptor while im at it, for cards like jund bug...

luckly we have the trigger to make suspends "removel of counters" tho some would contest that the removel should be done by the player manuelly...it will look like this
[email protected] my upkeep: counter(0/0,-1,time) && this(counter{0/0.1.time}<0) unsuspend

unsuspend would of course be a new keyword in the parser, simply the action of unsuspending a card...
now im not a big fan of the above style...i would much rather code it as a rule to handle the "unsuspending"...

now after all that, right off the bat i see a bug i might intruduce...when 2 cards with suspend enter play at the same time and both can target something...only one of them will have a targetchooser the other will fizzle with no effect....

back to the drawing board...

anyways with just what you read above, your looking at close to 700 lines of code maybe a little more...the current iteration of it i have saved is about 700-800ish lines...but still have some work to be done...

thats not all, now people will want "access to the exile gui" so i will need to modifiy the gui once again to allow people access to the exile...at which point you will see what workarounds produce...those workaround tokens all end up in exile...looks so ghetto and what a mess....

anyways i could add suspend cards which dont require interaction like the one you see above...theyre already 100%...it has no time counters, boom it moves into play.(of course i would have it act as it was cast) becuase that what it states...

but then people would be upset that i didnt add the ones the liked....

Zethfox
Posts: 3029
Joined: Thu Jun 10, 2010 11:28 pm

Re: More parsers requested

Post by Zethfox » Fri Feb 25, 2011 1:20 pm

heres a question...would you be happy with basic support for suspend without exile gui access and some of the cards not supported?

Zethfox
Posts: 3029
Joined: Thu Jun 10, 2010 11:28 pm

Re: More parsers requested

Post by Zethfox » Fri Feb 25, 2011 10:13 pm

for basic suspend...less then 200 lines....not to shabby....the other half require gui access :/ that alone will increase the code by alot...and by the time its done for full support we'll be looking at 600-700 lines of code i might opt to leave it as basic support for now....

Nazar-WTH-PCgamer
Posts: 60
Joined: Sat Feb 19, 2011 5:24 am

Re: More parsers requested

Post by Nazar-WTH-PCgamer » Fri Feb 25, 2011 10:18 pm

To answer your question Zethfox, I would say "yes" add it minimal. I would bet on this: more playable cards is a wish shared by most users. That being said, while a few cards with suspend ability is better than none (or even some homemade/workaround version), it has a downside... it implies that you and the other devs will get more questions and private messages about "why do you support this card and not that one". In conclusion, I would suggest if you're on the verge of a breakthrough solving everything that is involved (near and far) by the suspend ability, then wait before adding only partial progress work. If you think it could be a whlie and you feel like letting users enjoy and comment the work you've done so far, then add the partial progress made to next release or right away. This is just my humble opinion and in the end, it's up to you.
Nazar is meant to rule the world... Someday! Once Nazar is in charge, goblins won't have to hide or shovel orcish poops no more. Vote for Nazar!!!

Post Reply