It is currently 16 Apr 2024, 16:01
   
Text Size

Puzzle Mode

Post MTG Forge Related Programming Questions Here

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

Re: Puzzle Mode

Postby friarsol » 09 Apr 2017, 03:26

I fixed a few issues with Game State tonight.. It looks like there's an issue with the token serialization not serializing inherent abilities, which means we won't be able to do Possibility Storm #2 100% correctly. I'll see if there's a way to improve that the next time I have some coding time. Hanmac is trying to con me into adding Exert, so Puzzle Mode stuff might have to wait till after that.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Puzzle Mode

Postby bink » 09 Apr 2017, 14:44

You're the man Sol.
Thank you.
User avatar
bink
 
Posts: 38
Joined: 18 Nov 2015, 22:08
Has thanked: 14 times
Been thanked: 19 times

Re: Puzzle Mode

Postby friarsol » 09 May 2017, 02:36

Hey bink,

Did you get a chance to try this out? I have three sample puzzles in the trunk now.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Puzzle Mode

Postby Rooger » 28 Jun 2017, 05:37

I have started to port into Forge some puzzles. I really liked the challenges from Duels of the Planeswalkers and this is a great feature to have in Forge. Well done Sol =D>

For now I only scripted all of Possibility Storm's puzzles (until Amonkhet #8). Even though some are not 100% Forgeable with the current limitations of the engine, they are scripted in case in the future we find ways to make them work. I'll list the problems i came across when trying to make the puzzles and I'll try to update the list with future problems that might show up.

**Implementation Issues**
(click link to see the puzzle)

PS AER #6 - AI can't properly counter CopyCat combo (still 100% playable but easily cheated)
PS AER #7 - Double-faced cards revert to base form if the game state is set to use transformed (Bearer of Overwhelming Truths enters as Daring Sleuth)
PS AKH #0 - Activated Gideon's +1 ability on Ayli can't be Forged (might be able to replicate the effect with another card though)
PS AKH #2 - Double-faced cards revert to base form if the game state is set to use transformed (Wayward Disciple enters as Pious Evangel)
PS AKH #7 - Emblems enter the battlefield but abilities aren't working (Knight Ally does not get +1/+1)

These are the most problematic puzzles that i've scripted, they are included in a separate folder inside the rar. Please, feel free to post your solutions to the mentioned issues, some of them might be overcome with a workaround.

**Other Issues**
(problems with puzzles I havent forged yet)

Start puzzle during Declare Blockers Phase and AI attacking with creatures [example] - this is probably one of the most common issues we might find puzzles for. We can start game states during declare blockers phase but tapped attacking creatures enter the puzzle just tapped and not attacking because in the game state we can't set attacking creatures. Something like this would be great:
Code: Select all
...
activeplayer=human
activephase=COMBAT_DECLARE_BLOCKERS
...
aibattlefield=Grizzly Bears|Tapped|Attacking:Human
Or this for attacking Planeswalkers
Code: Select all
...
activeplayer=human
activephase=COMBAT_DECLARE_BLOCKERS
...
humanbattlefield=Liliana of the Veil|Counters:LOYALTY=5|Id:20
aibattlefield=Grizzly Bears|Tapped|Attacking:20
Here are other sources for puzzles that I found and will look for scriptable game states Gathering Magic, ChannelFireball, Pauper Puzzles, Magic: The Puzzling from Bog Wraith's topics (the old rules might be hard to implement though) and would also like to do the DotP Challenges for nostalgia's sake. Hopefuly we'll fix most of the common issues with game states and more puzzles will be ready to implement.

Note: I've renamed the 2 files already available within Forge from PS1 to PS_AER1 to better represent the naming scheme of Possibility Storm puzzles, i.e PS_(Set Code)#.

Note2: There was a problem with the included Puzzling Magic #3 where it wasn't properly attaching Viridian Harvest to Shrine of Boundless Growth, i believe this was due to card id conflicts when loading the game state. I think i've fixed it, but please let me know if there is any problem on your side.

Note3: There is an "Empty" puzzle that I used for testing purposes only but might be handy for you guys as well. It is just a clear game state with no cards and 20 life for both Human and AI. This was mostly useful to reset the board between tests and to check card ids issues.
Attachments
puzzle.rar
Extract contents to .\Forge\res\puzzle
(8.41 KiB) Downloaded 279 times
Rooger
 
Posts: 88
Joined: 06 Jan 2013, 06:59
Has thanked: 44 times
Been thanked: 35 times

Re: Puzzle Mode

Postby Agetian » 29 Jun 2017, 16:13

Thanks for your effort, Rooger! I integrated the puzzles which you reported as working upstream. Would be nice if you code more puzzles! :)

Can you please clarify the issue with AER #6? I'm not sure if it's worth committing it upstream yet or not, and if maybe the problem with it is easy enough to address.

- Agetian
Agetian
Programmer
 
Posts: 3471
Joined: 14 Mar 2011, 05:58
Has thanked: 676 times
Been thanked: 561 times

Re: Puzzle Mode

Postby Rooger » 29 Jun 2017, 23:06

No problem Agetian i'm glad i can help. I'll try to bring more content to the puzzle section, since it's a relatively new feature it's lacking a bit. In the meantime i'll also try to report here the problems i come across while scripting the puzzles, i'm afraid the game states feature will need some work to overcome some limitations.

As for the AER#6, to be completely honest I don't really understand how the puzzle is supposed to work.
In theory, I believe it was made as a way to illustrate the copycat combo that lead to the banning of Felidar Guardian in standard, however you aren't supposed to rely on it to win because it is countered by Walking Ballista.

The problem is that in forge you can simply cast Felidar cat and the AI wont react (this puzzle has a very specific setup).
So as soon as you cast the cat,
Use Saheeli's -2 ability on it, this will create a copy of the creature and is an artifact as well,
When the copy enters the battlefield the Felidar Guardian's ability will trigger,
You use it on Saheeli, effectively reseting her loyalty counters and you are now able to use her -2 ability again to create another copy of the cat
Repeat ad infinitum
And to make matters worse there is a Reckless Fireweaver in the battlefield as well, you wont even need to attack with the cats to win because it makes sure you deal 1 damage to every opponent every time you make a cat (they enter the battlefield as an artifact in addition to their other types).

And this is basically the puzzle, it is forgeable and you can still win it the way it was intended to be won but i think that unless you force yourself not to use the copycat combo you can easily cheat on this one. Maybe we could put a small note in the puzzle's name stating that "You are not allowed to use the copycat combo" or something like that, but i dont know...what do you guys think about it? Is it worth it to include this one? The puzzle can be fun but have this little limitation

Edit: My screen resolution is 1680x1050, im on revision 34432 and I noticed that the puzzle select window only displays the first 11 puzzles, I can select more with the arrow keys but the aditional puzzles aren't visible. The panel isn't scaling properly and needs a scrollbar, also it isn't adopting themes colors like the other sections. I understand that this game mode is in testing phase, this is just my feedback as i'm play around with it. Haven't tried this on Android yet.
Rooger
 
Posts: 88
Joined: 06 Jan 2013, 06:59
Has thanked: 44 times
Been thanked: 35 times

Re: Puzzle Mode

Postby Rooger » 30 Jun 2017, 23:25

New batch of challenges ready to melt our brains :D
This time i've scripted all of Pauper Puzzles until now (#30).

New puzzles means new issues. I'll list below the problems i've found with the ones that didn't make it into Forge. Like my previous pack, there is a separate folder with said puzzles for future use.

As for the ones that supposably are working. I haven't tested them all myself and can't say for sure that they are 100% error-free, however, the ones that i've solved, worked great and in fact are quite challenging, forcing you to play with the stack, to keep your eyes on the library/graveyard and other tricky stuff.

**Implementation Issues**

The major problem i've found was the inability to make puzzles with more than 1 turn. In the metadata section of the pzl files there is a field to set the number of Turns, however changing this value to 2 for instance, as soon as you enter cleanup step on your Ending Phase to pass the turn, if you have one or more cards in hand Forge will request you to discard them stating the maximum hand size is 0, this will break some puzzles, after discarding the cards/if no cards are in your hand you automaticaly lose the match without passing the turn to AI. Unless i've missed some parameter that is needed for multiple turn puzzles I believe this is a feature that is still under construction and will be available in the future. Also, I would like to ask if there are more values for Goal other than Win. A couple of puzzles only require you to survive until your next turn without the need to zero opponents life, this could be one of the winning conditions available for the Goal field.

#10 | #13 - Survive until next turn / Multiple turn puzzle

#17 | #19 | #20 | #25 - Multiple turn puzzle

#05 - Multiple turn puzzle / Starts during Declare Blockers Phase with AI's attacking creatures / Double-faced Card (Insectile Aberration enters as Delver of Secrets)

--------

Attachments are also a bit tricky to get right sometimes. To attach two or more cards you have to manually set an Id value for the card you want to be attached and an Attaching variable to the attached card for example:

Veteran Cathar|Id:22 ; Bonesplitter|Attaching:22 ; Lifelink|Attaching:22 - Veteran Cathar will have Bonesplitter and Lifelink attached to it.

However, occasionally the cards don't attach properly (even if you set the correct ids) and you have to do it yourself manually while the puzzle is loading. This is not ideal because it requires the user to know the puzzle setup beforehand.
(you can check ids in game, its the little grey value on the left bottom corner of the cards, if you don't see this number is because you have it turned off, click on the Forge icon (top left corner of the screen) -> Game -> Card Overlays -> Card id this will toggle it on/off)

The following puzzles have problems with attachments.

#14 - This puzzle have 3 cards with attachments, 2 on the Human side and 1 on the AI side, the ones on the Human side aren't working for me no matter the order I place them (i.e. changing card ids, this sometimes fixes issues like this). Not sure if the problem is the land or other factor unknown to me. This challenge also suffers from the previous issues of Multiple turn puzzle / Starts during Declare Blockers Phase with AI's attacking creatures

#04 - I have noticed that human cards are all loaded before the ai's, usually the game loads human hand, then human library, human graveyard, human battlefield and so on (in this particular order), only after that it loads the ai hand, ai library, ai battlefield, etc. You can check this by the card ids automaticaly assigned by the program. Now, the problem with this specific puzzle and other similar is when one of the Human's cards attaches to one of the AIs cards (the other way around works). Take this puzzle as an example:
Human's Pacifism enchants AI's Aura Gnarlid, the problem is that Pacifism loads before Aura Gnarlid and breaks the loading of the human cards because it targets a card that isn't in the battlefield. I'm not sure if this is fixable but maybe finding a way to make attachements only after all the cards are loaded could work. Then again, i'm not a programmer and i don't really know if the work behind the fix is worth it.

#27 - This puzzle is similar to the previous one in the way that it attaches one human's card to one ai's card but it also brings one more level of complexity to the mix, zones. In this example human's Faceless Butcher attaches and exiles ai's Wild Mongrel, so in terms of game state setup how do we script this? Faceless Butcher is in the battlefield targeting and loading before Wild Mongrel that is in the exile? Or load Wild Mongrel in the battlefield and the game takes care of sending it to the graveyard? Either way i think this doesn't work.

--------

Other minor issues:
#26 - This puzzle works in a specific way that AI can't evaluate. Opponent is supposed to Counterspell only direct damage, because they need the mana to keep them alive. Give the puzzle a try and see what I mean, check the solution in the site if you are stuck. The puzzle works but it is very easy when AI counter Tandem Lookout.

#21 - Standard Bearer is not yet implemented in Forge
---------------------------------------------
#30 - Please let me know whats the best way to set up this. I've scripted as it is intended (yeah 1000 elf tokens is kind of overkill) but i'm afraid this number of instances might break your game at some point. It loaded fine on my pc but haven't tested this on Android or other machines. We probably don't even need that many life points/tokens to make the point. This challenge is NOT in the "Not Working" folder but I wouldn't commit it before knowing your opinion about it.

And that's it for now, I apologize for the extensive post but i'm trying to help in documenting every thing that might be worked on in the future and maybe this might be helpful when prioritizing efforts.
Give the new puzzles a try a let me know what you think.
Attachments
Pauper_Puzzles.rar
Extract contents to .\Forge\res\puzzle
(14.87 KiB) Downloaded 260 times
Rooger
 
Posts: 88
Joined: 06 Jan 2013, 06:59
Has thanked: 44 times
Been thanked: 35 times

Re: Puzzle Mode

Postby Agetian » 01 Jul 2017, 03:34

Thanks a lot for your effort, Rooger, it's much appreciated! :) I'll try to integrate these puzzles today! And also, thanks a lot for the detailed breakdown of issues, I'll see if I can improve some of those areas. For starters, the puzzle selection box is now themed and scrollable :) (haven't looked into how to properly resize it yet...).

- Agetian
Agetian
Programmer
 
Posts: 3471
Joined: 14 Mar 2011, 05:58
Has thanked: 676 times
Been thanked: 561 times

Re: Puzzle Mode

Postby Rooger » 01 Jul 2017, 03:47

You are welcome Agetian, i'm just doing my part for the community with the little I know, scripting these puzzles isn't exactly rocket science :D

Nice! Looking forward to test the new box. The size isn't really an issue for me honestly, but the scrollbar is a great thing to have and thanks for looking into it. Also have you checked puzzle #30? What do you think of all that nonsense eheh. I'm afraid that it might be too much to handle, especially on android...We can probably cut down on the tokens and life, or just remove the puzzle.
Rooger
 
Posts: 88
Joined: 06 Jan 2013, 06:59
Has thanked: 44 times
Been thanked: 35 times

Re: Puzzle Mode

Postby Agetian » 01 Jul 2017, 03:57

Rooger wrote:You are welcome Agetian, i'm just doing my part for the community with the little I know, scripting these puzzles isn't exactly rocket science :D

Nice! Looking forward to test the new box. The size isn't really an issue for me honestly, but the scrollbar is a great thing to have and thanks for looking into it. Also have you checked puzzle #30? What do you think of all that nonsense eheh. I'm afraid that it might be too much to handle, especially on android...We can probably cut down on the tokens and life, or just remove the puzzle.
Umm Puzzle mode is not yet in on Android, I think it shouldn't be an issue for a powerful device, but weaker ones might struggle/hang, yeah. On desktop PCs I did not have an issue with it. I think I'll commit for the time being, we can always cut it down later if it proves to be a problem. Looks pretty cool and unique to me btw :)

- Agetian
Agetian
Programmer
 
Posts: 3471
Joined: 14 Mar 2011, 05:58
Has thanked: 676 times
Been thanked: 561 times

Re: Puzzle Mode

Postby Rooger » 01 Jul 2017, 04:16

Oh, I thought it was, sorry my bad then.

Cool, i'm fine with that also, and I agree it looks kind of funny having that many tokens on the battlefield, when I tried infinite combos i've never put so many at the same time. Let's say it serves the purpose of a stress test for the time being :D
Rooger
 
Posts: 88
Joined: 06 Jan 2013, 06:59
Has thanked: 44 times
Been thanked: 35 times

Re: Puzzle Mode

Postby Agetian » 01 Jul 2017, 04:43

Hehe indeed :)

- Agetian
Agetian
Programmer
 
Posts: 3471
Joined: 14 Mar 2011, 05:58
Has thanked: 676 times
Been thanked: 561 times

Re: Puzzle Mode

Postby Ikeda » 01 Jul 2017, 12:21

This is my first post, so I apologize in advance if I break protocol in any way.

First, I've set up two puzzles from Perplexing Chimera, specifically numbers 19 ("Demons and Dragons") and 50 ("Toothless"). These are not exactly the same as the online versions - mostly because I can't for the life of me figure out how to set up tapped permanents - but this shouldn't affect them too much.

Second, I greatly appreciate Rooger's list of implementation issues; it gives some ideas as to what problems exist with puzzle setup, and got me trying my hand at the scripting (which resulted in the two puzzles attached).

Third, there's a broader spectrum of puzzles than expected. I'm aware of the following variations off the top of my head:
  • "Win" conditions: Win the game by a given phase, remove one or more permanents, survive the turn, get a given card onto the battlefield, force a draw
  • Starting phase: First main phase, second main phase, opponent's combat phase, opponent's end step (the last of which is usually to make "beginning of upkeep" triggers relevant)
  • Initial decision, e.g. "You're resolving Dig Through Time and must first choose two out of the top seven cards of your library to keep."
  • Predetermined knowledge, e.g. "You know what cards are in your opponent's hand," or "You know that you have a Lightning Bolt somewhere in your library."
  • Opponent's predetermined action, e.g. "Your opponent has an Essence Scatter and will always cast it on the first creature spell you cast."
  • Opponent's anticipated action, e.g. "Your opponent has an Essence Scatter and may choose to counter any creature spell you cast."
Given the above, perhaps a log of puzzles that have conversion issues might be good, similar to the "Missing" cards list that's noted for each release?
Attachments
PC 19 and 50.zip
Perplexing Chimera puzzles 19 and 50
(1.11 KiB) Downloaded 244 times
Ikeda
 
Posts: 7
Joined: 11 Jun 2017, 05:58
Has thanked: 0 time
Been thanked: 5 times

Re: Puzzle Mode

Postby Agetian » 01 Jul 2017, 13:28

@ Ikeda: Hello and welcome! :) Thanks for your contribution!
The syntax for the tapped card on the battlefield is rather simple: card_name|Tapped (instead of just card_name), e.g. Plains|Tapped.

Can you please update the submissions so that they're more faithful to the original now using the Tapped syntax? Thanks in advance!

- Agetian
Agetian
Programmer
 
Posts: 3471
Joined: 14 Mar 2011, 05:58
Has thanked: 676 times
Been thanked: 561 times

Re: Puzzle Mode

Postby Rooger » 01 Jul 2017, 13:44

Really nice Ikeda, thanks for joining the community hope you like it here! The more puzzles the better eheh. I'm not sure if you already tried it while scripting these challenges but there is a developer mode in forge that might be useful to test things out. It's under Game Settings - Preferences - Advanced Settings. It gives you the ability to do things that otherwise you couldn't, like for instance Save Game States and Load Game States (basically puzzles), setup the board with particular cards etc. Play with it a bit and you will see how useful it is.

To setup tapped permanents you just write |Tapped after the cards name, like Mountain|Tapped. For now this doesn't make creatures attack they just enter the battlefield tapped and thats it. By dumping game states you can analyse this and other variables that you can use. Let me know if you have any questions i might be able to help you out.

Also, tokens are a bit different, to make a token you need to input something like this:

t:Elf Warrior,P:1,T:1,Cost:no cost,Types:Creature-Elf-Warrior,Keywords:,Image:g_1_1_elf_warrior_ORI

t:(Name in the card),P:(power),T:(toughness),Cost:(usually no cost),Types:(type as writen in the card but notice the - between each word),Keywords:(i believe this is the abilities but i might be wrong, the ones i made so far had this empty),Image:(check your tokens image folder, go to Game Settings - Preferences - click on the button at the top that says Open Content Directory - Pics - Tokens, if you have downloaded the card pics this folder should be populated and pick the one you want)

This will make a 1/1 Elf Warrior token, I haven't find a puzzle that includes tokens with abilities so i'm not really sure how to set them up yet, but if you need to you can just add a card to play that produces said token, make one, dump game state and check the output.

Edit: Eheh Agetian you have beaten me to it :D
Rooger
 
Posts: 88
Joined: 06 Jan 2013, 06:59
Has thanked: 44 times
Been thanked: 35 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 35 guests


Who is online

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

Login Form