Monday, January 31, 2011

New Version - Improved GUI

New versions are great.  People get all excited and everywhere you look you see rainbows.  Forge now has 5,995 cards.  Thanks to the efforts of many people, Forge has 303 new cards and a wealth of user interface upgrades.  We had 15 people, who are listed below, that directly helped with this version of Forge.  This is our biggest number yet.

For a complete list of new cards, go to the post here.  Scroll down to find the text "Added many cards, including:" then click "Open".


Above is Forge's new look.  The current picture is just a temporary picture to give you an idea of what this will look like when finished. If you want to replace this picture then copy a new picture of your choice into the /forge/res/images/ui/ folder. The code will look for a file named "newgame_background.jpg" in this folder.  Wizards Wallpaper of the Week archive is a great place to find replacement art.

Let me briefly explain the options that Forge has.  The "Stack AI Land" option will make the AI a little better by stacking its deck so it doesn't get mana screwed or flooded.  The "Developer Mode" option allows people use very small decks, only 4 cards, in order to make sure that a specific card works correctly.


Above is a picture of the improved deck editor.  Each of the icons at the top represents instant, sorcery, etc..  Now you can easily search by card name, to see if Forge has your favorite.  The text search is very useful and I quickly searched for all cards that deal 2 damage.

To find cards that have alternate winning conditions search for "win " with a space.  If you only search for "win" you will finds cards like Windwright Mage that have "win" somewhere in their card text.  In the past the deck editor was slow when searching or filtering cards but now it is much faster.

A few of the interesting new cards are:  Boon Reflection (5W, Enchantment) - If you would gain life, you gain twice that much life instead.  Clone (3U, Creature) which is a great card because you can copy any creature and if I understand the rules correctly, Clone can also kill annoying legendary creatures. Cryptic Command (1UUU, Instant) - "Choose two — Counter target spell; or return target permanent to its owner's hand; or tap all creatures your opponents control; or draw a card."  Cryptic Command is impressive from a programming point of view because it is more complicated than your average card.  I programmed the red version, Incendiary Command, years ago.

Below is taken from changes.txt which was written by Chris H. (I have also stolen one other sentence which I used in this post.)

Sloth, Dennis and Choppic worked together to contribute a neat, new feature for the New Battlefield user interface. There are now three symbolic icons that will overlay creature cards. These icons are used to denote summoning sickness and whether a creature is attacking or blocking. Please note that you must use have the "New GUI" checkbox marked "yes". The battlefield icons are 32 x 32 pixel .png type pictures. You may be able to replace them with icons from one of the icon archives that can be found on the internet.

The constructed mode deck editor card filters are now icons rather than the old style checkbox type filters. The deck editor filter icons are now 24 x 24 pixel .png files. The constructed mode deck editor now includes three textboxes that you can use to apply additional filtering to the cards that are listed in the All Cards table. These three filters allow you to filter by card name, type, and text.

[Now back to me.]

Forge.zip (11 MB) - This is the 1/14 version which was released on the forums.

12-22.zip (115 MB) Card Pictures - Put these in your /res/pics directory.  If that link doesn't work try this.

This is most of the card pictures.  You can download the rest of them from Forge's opening screen by selecting "Menu", then "Download Card LQ Pictures".  LQ stands for low-quality.  Forge also allows you to download bigger, high-quality (HQ) card pictures.

Many people helped with this version. A special thank you goes out to them:

Dennis Bergkamp
Rob Cashwalker
Friar Sol
Slapshot5
Sloth
Hellfish
Snacko
Choppic
SoulStorm
Fnoed
Jaedayr
Gofishus
Sentient6
jhhh
Zirbert
Chris H

p.s.
--I try to avoid jargon but it is useful.  GUI stands for graphic user interface.

--This document was painfully constructed using Word 2010, which is horrible.  I don’t really think Microsoft is evil but the user interface is awful.  For some unknown reason, menus are bad and the ribbon interface is good, i.e. I have to hover my mouse over the little icons so I can see the tooltip text that pops up.  And for some reason Word double spaces things even when it should single space them and when I cut-and-paste it from Word into blogspot.com then it comes out single spaced.  

If I could revert Word's user interface to the previous, menu-based version, I would make millions.  Word 2010, the worst videogame ever.

Monday, January 24, 2011

Insider Turned Outsider


I used to be an "insider".  I knew everything that was going on with Forge.  I knew all of the cards.  I knew why these specific cards were added and I knew the internals of Forge.  Being an insider was great because everything made sense.  I knew everything about Forge frontward and backward.

The Forge project has progressed without me for more than 2 years and I'm astonished at their progress although my lack of involvement has turned me into an "outsider".  I have no idea why the new cards were chosen.  I don't know which cards are buggy and which one's aren't.  I read about the changes but I don't feel like I really know what's going on.  I've changed from being an omnipotent programmer to a mere user. 

Way back in the day when I was the only programmer, people would ask me all types of questions.  One commonly asked question was, "Why did add card X?" because card X seemed to be a completely random card.  It was confusing to the user because they didn't understand my decision to add card X and even after I told them my reason, I could sense that they still didn't understand my decision. 

(The truth is that I added cards that were powerful or cards that I read about on dailymtg.com or cards that were expensive or cards that Forge could support.  These reasons also apply to the current developers and how they choose cards to add.)

Since I've morphed into a regular user I have to accept other people's choices.  I'm not saying this is a bad thing, I'm just saying that it is very different.  As a user I feel less involved, mostly because I am less involved.  As a programmer I was in the driver's seat but as a user I'm definitely a passenger. 

I created this blog so that user's could learn more about Forge.  Without this blog Forge would be some random program that was pretty cool but hardly anyone would download.  With this blog you get to see a little bit "behind the scenes". 

On a side note, Forge is the biggest project that I've ever worked on and I'm glad that it fills a niche.  (Not that I didn't make any mistakes.  I built Forge about 3 times before the program became too complicated and would fall apart.)  Hats off to the new developers who keep the dream alive. :+)

Keep on forging,
mtgrares

p.s. 
--I see myself as the PR (public relations) guy for Forge.

--I loving using Magic lingo like the word morph, "I've morphed into a regular user".

-- I really enjoyed the "feature" the let you use the activated abilities of the computer's creatures, I thought it was just the type of bug the Forge should have.  (This feature has been fixed so it doesn't work now.)

Monday, January 17, 2011

Great Complicated Cards


Forge implements a huge number of cards and many of those cards are really, really complicated.  Some cards are so complicated that even I didn’t think Forge would ever have like Hypnotic Specter (HP).  HP is a great card but I did not have any idea how to implement him.  Granted the combat code does specifically look for HP but he works and that is the only thing that really matters. 

Swans of Bryn Argoll (costs: 2 W/U W/U, 4/4 flying) is another great, thorny card.  Swans says, “If a source would deal damage to Swans of Bryn Argoll, prevent that damage. The source's controller draws cards equal to the damage prevented this way.”  Forge is relatively “primitive” and prevention effects are complicated.  I was happily surprised when I first saw Swans.  Someone on the forum mentioned that Swans and Phytohydra (2GWW, 1/1) “If damage would be dealt to Phytohydra, put that many +1/+1 counters on it instead” did not correctly work together.  Thankfully Sloth (one of the programmers) jumped on the case and said that the next version will fix this problem.

Pillory of the Sleepless (cost: 1WB) enchants a creature and has “Enchanted creature can't attack or block.  Enchanted creature has ‘At the beginning of your upkeep, you lose 1 life.’”  I have no idea how Forge implements “this creature can’t attack or block” but those cards are really fun to use.  I actually won a match against the computer because of Pillory.  Losing 1 life a turn isn’t usually a game-winner but in a stalemate it will tip things in your favor.

Planar Gate (cost: 6, artifact) “Creature spells you cast cost up to 2 less to cast.”  Cards that arbitrarily affect other cards are the most complicated.  Since Planar Gate changes mana costs for other cards, Forge has to reduce the cost of only creature spells and only creatures spells that can use any color of mana.  Cards like Planar Gate are very hard to code and very fun to use.

Platinum Angel and Platinum Emperion are both great, powerhouse cards that change the winning conditions.  Platinum Angel (cost: 7, 4/4) “You can't lose the game and your opponents can't win the game” and Platinum Emperion (cost: 8, 8/8) “Your life total can't change. (You can't gain or lose life. You can't pay any amount of life except 0).”  Changing the winning conditions can be difficult and I’m glad that Forge was flexible enough to accommodate these cards.

Predatory Advantage (3RG, enchantment) gives you a 2/2 creature if your opponent did not play a creature, thus punishing control strategies like blue counterspell decks.  This type of card needs to know the game’s “history” and whether a creature was played.  “History cards” can be complicated and Forge has a simple history class that holds information about what happened during the current and previous turn.

Thanks for reading,
mtgrares

p.s. Recently I’ve been watching “Hogan’s Heroes” and even though it is 40 years old, it is a great show.  It's even in color!

Monday, January 10, 2011

New Version

I hope everybody had a great Christmas this year.  Thankfully Santa forgot a few things including this new, radical version of Forge.  Forge now has 251 new cards, which brings the total up to ginormous 5,692 cards.  (Word 2010 even recognizes ginormous as a real word, maybe Microsoft is getting hip?)

I’ll mention a few of the spectacular new cards like Baton of Courage (4, artifact) which has Sunburst and “Remove a charge counter from Baton of Courage: Target creature gets +1/+1 until end of turn.”  Sunburst is pretty cool and means, “This permanent enters the battlefield with a charge counter on it for each color of mana spent to cast it.” 

Other sunburst cards include Etched Oracle (4, artifact creature, 0/0) “1, Remove four +1/+1 counters from Etched Oracle: Target player draws three cards.”  I didn’t even know Forge supported sunburst but I guess it does, yeah!  And if you enjoy multicolored decks, you’ll love Conflux (see card picture above).  You should also try Dragon Arch (5, artifact) which lets you put a multicolored creature onto the battlefield for only 2.

Citanul Flute (5, artifact) is a nice rare that has “X, tap: Search your library for a creature card with converted mana cost X or less, reveal it, and put it into your hand. Then shuffle your library.”  If you need a card that changes the rest of the game, look no further than Dueling Grounds (enchantment, 1GW) “No more than one creature can attack each turn. No more than one creature can block each turn.”  Another great card to build a deck around is Metalworker (3, artifact creature, 1/2) which lets you reveal artifact cards from your hand and then you gain 2 for each card revealed.  Metalworker is so powerful that it has been banned in the past.

Chris (from the forum) mentioned quite a few changes and here are a few of them. 

Additional changes have been made to the AI and we hope that the computer will now make better decisions when it comes to attacking and blocking. We would like people to give it a thorough test and report back their observations.  You can post observations on the forum here.

We have an artist (Choppic) who is donating time to our project. Massive changes in the GUI will take substantial amounts of new code. As such, we will likely move forward at a slow pace. Sloth has created a very basic x shaped icon to overlay the attacking creatures. Choppic is working on some initial sketches and we are looking forward to having a number of nice icons to denote attack, block, summoning sickness, the graveyard, etc. Rob contributed a collection of black and white icons to serve as inspiration. This is also a work in progress.

Download – Forge (11 MB) – This is the 12-22 version because that is when it was released on the forums.

Download – Card Pictures (160 MB) – These are the low-quality (LQ) card pictures.

Keep on forging,
mtgrares

p.s.
--All of the Koopa Kids in Super Mario Brothers 3 are named after musicians, who knew?  You can read about it on Wikipedia, everybody’s favorite unofficial source.

--Many people helped with this version. A special thank you goes out to them:
Rob Cashwalker
Friar Sol
Slapshot5
Sloth
Hellfish
Gofishus
Chris H

Wednesday, January 5, 2011

Min-Max Combat - A Failure

My goal was to build the new combat code completely separate from the rest of project.  Unfortunately this was not possible because of Forge’s architecture.  The more that I tried to update the combat code, the more messy things became.  Forge does not allow you to easily update one part of the AI without updating the whole thing.  In my mind Forge has grown from a collection of objects to sub-systems, which is the difference between a 3 story house and a skyscraper. 

Giant Growth’s AI code checks to see if a creature is attacking and then targets that creature.  There is no “wait time” for the computer and the new code definitely will need a few seconds in order to generate future combat situations.  I thought that I knew what I was getting into but I didn't.

Programmer note: The reason that it is good to create and use interfaces (or abstract classes) is because you have the opportunity to update them later.  Of course you can be too abstract and become lightheaded but in general, some interfaces are better than no interfaces.

Monday, January 3, 2011

Min-Max Combat

Combat is a major component of any Magic game but unfortunately combat is also one of the areas where the AI struggles.  The AI falters in combat because it only follows a few "rules of thumb" like attack if you have the biggest creature or attack if no other creature can block.  Since combat can be hugely variable these rules of thumb break down and the AI doesn't play competitively. 


The two biggest problems with AI combat are:

1. Sometimes the AI attacks with all of its creatures and then you easily attack and win.  The AI should have held back a few creatures.

2.  The board becomes crowded with many creatures and the AI is afraid to attack.  This is a stalemate where each player has plenty of creatures on the board but not a winning position so you just hope you draw something good and usually you can beat the computer.

I am working on making the AI combat better by applying min-max.  This would allow the AI to "see" several turns in the future and make much better combat decisions.  The new code should be able to process common keywords like flying and defender.  Hopefully in the future the new code will handle other keywords like wither and "this card must always attack".

The downside is that this new combat code won't be 100% perfect and the computer won't suddenly be playing like a pro.  The new code won't consider static, triggered or activated abilities like regeneration.  This seems really bad except that the old combat code didn't consider these abilities either.  The new combat code should be an improvement but I don't know how much of an improvement.

Planeswalkers are confusing to the old and new combat code.  With the old code, the AI attacked a planeswalker 50% of the time.  While this seems incredibly lame, it ensures that you will not be able to predict what the AI will do.  The new code will probably do the same thing because the AI cannot generate future events like a planeswalker using his devastating, ultimate ability.

Hopefully I will finish the new combat code so everybody can see if it makes a difference.  I want to guess that I will be done in a week but I probably should guess a month (which is way too long but is probably more realistic).

The only way to improve the AI combat code so that it plays perfectly is to use min-max for all parts of the AI.  Forge has a very simple AI implementation so we can't use min-max because it requires the computer to generate thousands of future events so the AI can determine which future path would be the best. 

To get a taste of a good Magic AI download Magarena.  It only has 450 cards but the AI is very good.  You can read more about Magarena here.

Keep on forging,
mtgrares

p.s.
--I'm glad that my previous post about other offline TCGs was interesting.  Personally I thought the article was a little bit "weak" but I'm glad that people enjoyed it.  Picking a topic each week feels very random but I'm glad that I occasionally strike writer's gold. 

--Just for reference, here is the old combat code.  The attacking code is 290 lines and the blocking code is 260 lines.  You can view the Java attacking code here and the blocking code here.

--Crap, I was looking over the old combat code and I saw that it mentioned lure.  Man, I really hate lure right now.

Should Forge Have Crappy Cards?

I don’t have any grand topics to talk about. Nothing about world conquest or how I’m coding a secret, underground Magic Online clone which is going to be based in Russia. (The Russian mafia is paying me in rubles, so I’m doing ok.) Today I’m going to just mention some random thoughts that don’t fit anywhere else.
Forge has almost 10,000 cards which is unbelievable, I remember getting to 1,500 cards and thinking, “I don’t know how to add any more cards.” Magic has (roughly) 16,000 cards in existence. I know that the new cards get the most attention but some of the older cards are fun also. Some older cards are game winners and I enjoyed abusing unique cards like Land Tax and Armageddon.

Since Forge has so many cards, this also brings up a thought that I had awhile ago, “Should Forge have crappy cards?” The short answer is yes. Without crappy cards (paying 2W for a 2/1) you couldn’t enjoy powerhouses (paying 1W for a flying 2/2).

Every set has a few “underachievers”. Bad cards are a real part of Magic and I have enjoyed using a variety of sub-par cards while questing. Many of those cards are uniquely suited for restricted formats. My new personal catch phrase is “crappy cards are fun to use.” (Disclaimer: It is easier to use cheaper bad cards that cost 3 or less, versus expensive crappy cards which are over-costed.)

If Forge only had great cards, the game would be unbalanced because every card would be too powerful. It would be like trying to eat a 100 foot long Twinkie. Twinkies are good but sometimes less is more. (Kudos to Ghostbusters for the random Twinkie analogy.)

Since I’m talking about the number of cards in Forge, I need to really give a big shout-out to the programmers. Those guys work themselves to the bone so that we can have shiny, new cards to use. The developers don’t get enough credit. (Quiz: What is a great way to show appreciation without money?)

On a side note, I started the Forge project but I don’t currently contribute to it. I blame burnout but I’m probably just getting lazy :)

There are no crappy cards, just crappy players,
mtgrares

p.s.
--I’m only joking about creating a Magic Online clone. The exchange rate of rubles to dollars is horrible.

--Open source can work miracles. Even though “open sourcing” a project means that anybody on the whole planet can contribute, most of the time people just aren’t interested. I have no idea what makes a good open source project but I’m glad that Forge has attracted many dedicated programmers. (One small contributing factor is that Forge is a game, versus a random utility, and games are inherently fun.)

--Here are the current developers of Forge and I greatly appreciate their work.

ArsenalNut
Chris H
Dave
Doublestrike
Friar Sol
Hellfish
Jeff Wadsworth
Marc
Rob Cashwalker
Slapshot5
Sloth
Slowe
SoulStorm
Squee1968

--Miscellaneous Innistrad token.