Monday, February 27, 2012

Dark Ascension is Coming

I thought about posting a new version of Forge today but the most recently released version on the forums does not download the new Dark Ascension card pictures, and I know that everybody loves to use and abuse new cards. Hopefully a new version of Forge will be posted to the forums on March 2nd but that is only a tentative date and it may change. The next version will have at least 149 cards from Dark Ascension.

The Forge team is very happy to announce that Forge now supports more than 10,000 cards, which is a major milestone. Here is the announcement that they posted on the forum. (This relates to the 02-03 version which does not download the Dark Ascension card pictures.)

{begin quote}

The Forge team is very proud to announce that more than 10,000 cards are now available for play! This is an impressive amount, particularly considering that as of October 2011, the official game has produced 12,246 unique cards.

Rares, the creator of Forge, generously shared his work as an open source project about five years ago. Since then, dozens of people have contributed their talents to evolve the codebase to the point it's reached today: a game engine that can successfully juggle 10^5 10^4 unique cards, available for free.

The honor of writing the 10,000th card has gone to an unnamed hero, which is suitable since it's these brave code warriors that make the game what it is. A well-deserved thanks to anyone who has volunteered their time to script, test, maintain, report, code, suggest, debug, design, or in any way contribute to this project.

A special thanks in particular to the CCGH web site and its administrators for providing us with the Forge forum, and to the unsung team of people who quietly maintain the servers which assist this project in one fashion or another.

With this in mind, we move onward and upward. Enjoy your next game of Forge!

{end quote}

I sarcastically asked, “What will the developers do once Forge supports every card in existence?” and someone replied, “Start debugging”. That was a joke but it was very funny. Although I know Forge can be buggy, it is also awesome. (I have heard much the same thing about Elder Scrolls V: Skyrim, awesome but buggy.)

Dark Ascension
I presume most people know about magiccards.info but I will mention it anyways. Magiccards.info is similar to Gatherer but has very, high-quality scans of Magic cards. You can view a visual spoiler for Dark Ascension at magicards.info here.

If you want to download all of the card pictures and peruse them offline, link (26 MB).

Deck Forum
Forge has a separate forum just for decks and you can upload and download a ton of new/different decks. The “New Quest Deck” post allows people to post decks and then adds them to the list of opponents for Forge’s quest mode. You can also download a different set of files for sealed and draft, which is called a “cube”. Another person posted the top 8 decks from the Grand Prix Lincoln 2012 as well as 256 decks from “Building on a Budget” which is posted weekly on dailymtg.com.

That is about it. Have a grape (great) week :)

-mtgrares

p.s.
I have started to get into miniature wargaming, which is pretty cool. I love making strategic decisions and talk about a genre that really needs a good videogame. Awhile ago I played a ton of Advance Wars for Gameboy Advance. While it isn't really a “wargame”, it is still an excellent game.

Tuesday, February 21, 2012

Magic: The Gathering For iPhone and Android

(I don't have much to say this week.)

The Wagic project lets you play Magic on your iPhone or Android.

Wagic works on Windows, Linux, the nokia N900 (maemo), the Nokia N9 (meego), Android (tablets and phones), iOS(iPhone/iPad/iPad2) and the Sony PSP (Wagic does not require you to hack your PSP).

Wagic Link

Saturday, February 11, 2012

Browsing Forge’s Source Code – Part Deux

Similar to the line that Morpheus said in the Matrix, “Some things changes and some things don’t.” Much of Forge has been changed and improved but the core foundation is the same. Card objects, hold one or more SpellAbility objects. Today I will be looking through the “creature cardfactory” that handles the weird, oddball abilities that are not scripted. (Scripting only cares about multiple cards with the same ability.)

The creature cardfactory is relatively small, only 2,600 lines including blank lines, and handles around 69 creatures. (You can view the Java source code here.) The first creature is one that I recognize “Force of Savagery”. It is an enigmatic 8/0 creature that only costs 2G. Obviously the key is that it needs to be pumped up by Glorious Anthem or similar cards.

The code below is just for the AI and checks to see if Glorious Anthem or its green cousin Gaea's Anthem is in play. The problem is that checking for specific cards is that new cards are added/created all of the time.
if (cardName.equals("Force of Savagery")) 
{
  final SpellAbility spell = new SpellPermanent(card) 
  {
    public boolean canPlayAI() 
    {
      final CardList list = AllZone.getComputerPlayer().
          getCardsIn(Zone.Battlefield);

      return list.containsName("Glorious Anthem") 
          || list.containsName("Gaea's Anthem");
    }
  };

  card.clearFirstSpell();
  card.addSpellAbility(spell);
}

Drekavac is the next card that I recognize. I originally added it but the code has been updated as Forge has changed. Drekavac (2B, 3/3) the drawback is that you must discard a non-creature card. In the code that tells the AI not to play this card I see this comment.

I could never get the AI to work correctly, it always played the same card 2 or 3 times

This takes me back because that is my original comment. Now I know how to fix the problem but the AI probably should not play cards with a drawback anyways, since it cannot tell when the drawback is tactically prudent or not. I always liked using Drekavac for some reason.

The next card is Phylactery Lich. It is a pretty cool rare that gets you a 5/5 indestructible creature for only BBB if you own an artifact. The code here only deals with letting the player choose an artifact. Elsewhere, where static or state effects are checked, the code checks to see if the artifact with the phylactery counter is destroyed. The AI for this card is simple and just makes a “sanity check” to see if the computer has an artifact on the battlefield.
public boolean canPlayAI() 
{
return (!AllZone.getComputerPlayer()
  .getCardsIn(Zone.Battlefield)
  .getType("Artifact")
  .isEmpty() 
  
  && 
  
  AllZone.getZoneOf(this.getSourceCard()).
  is(Constant.Zone.Hand));
}
Sky Swallower is another card that I coded back in the day. Sky Swallower is another situational card that the AI plays badly. I thought it might be a good card but I don’t think I have ever won a game with it. I know it could win a game. In the code there is my original comment that has not been updated.

// TODO - this needs to be targeted

Technically Sky Swallower’s ability is targeted and Forge does not target the opponent because it makes the code a few lines shorter. I know that Magic has a few cards that give protection to a player but years ago, I knew that Forge did not have any of those cards. I used Forge’s excellent deck editor to search for cards that give protection to players and I could not find any but I could be wrong.

While these were just small snippets of code, it felt good to look at actual source code.

Huzzah,
mtgrares

p.s.
“Part deux” is taken from one of my favorite movies, “Hots Shots: Part Deux”. Deux is French for “two”.

Tuesday, February 7, 2012

Just a Bit of Humor

I can't think of anything to write about, so here is something to distract you. Dork Tower is great. The picture is a little small but you can see it full size here.