Monday, December 27, 2010

Other Offline TCGs

I hope everyone had a great Christmas.  Instead of talking about Forge's great features and its great gameplay and its great AI and its great new cards, I figured I would mention a few other trading card games (TCG) that you can play offline against the AI.  Please keep in mind that none of these games are as good as Forge but they try :-)

Blue Moon is a traditional card game where you choose from one of several decks and then play against the AI.  There are 8 decks that you can use and play against.  The AI is very sophisticated and uses neural networks. (Download links are at the bottom of the page.)


Another traditional card game (from the same programmer) is Race for the Galaxy.  Instead of having individual decks, both player draw from the same deck.  (Download links are at the bottom of the page.)

Both of these games have a nice user interface and a challenging AI opponent.  The rules for the two card games are very complicated and while I have mastered the rules of Magic, I have yet to master the rules for Blue Moon or Race for the Galaxy.  It's not that the rules are bad but they have many details like Magic.

While this next program isn't a card game, it has many related elements.  Carcassonne is a board game where you draw a game piece and build town and roads.  The rules are very simple while mastering those rules is challenging.

After you draw a random board piece you have to add it to the current map while keeping all roads and cities connected, which restricts you from adding a piece anywhere that you want to.  After you place your map piece, you may put a settler on that piece.  The program has a good AI and lets you play against one or more AI opponents.  The programmer also lets you play against other people on the Internet and writing network code is never easy.

I have yet to win a game against the AI even though I enjoyed the fun aspects of creating a new map.  I find myself wanting to be able to play a shorter game against the AI so I can evaluate my progress quicker.  Playing a game that uses all 60 pieces can be long, especially if you are losing.

All three of these games are quite good and will consume many hours.  Please tell me if you happen to beat the AI in any of these three games.

Blue Moon
Windows Executable
GTK Library (required) 
Rules
Programmer Homepage

Race for the Galaxy
Windows Executable
Rules
Programmer Homepage - Also has a Mac OS X version that you can download.

Carcassonne
JCloisterZone - requires Java
Programmer Homepage

Keep on forging (my new catch phrase),
mtgrares

Monday, December 20, 2010

Odds and Ends

I wanted to name this column “Todds and Tends” but I wasn’t sure that anybody would get it.  When I post something I try to have a specific topic in mind but today I’m going to wonder a little bit and talk about various magically related subjects.

Forge continues to be developed by about 5 serious programmers who tend to spend many hours a week programming new features.  One of the areas of improvement is the attacking and blocking code.  They have been working on improving this important piece of code.  Considering all of the combat modifers in Magic like first strike, deathtouch, regeneration and planewalkers the AI combat code has to take into account a lot of information.  Improving this area of the AI is very tough because the AI cannot “see” activated abilities and treats insanely, powerful creatures like Royal Assassin as generic 1/1 creatures.

I’ve been playing Magarena all week and it has been great.  Magarena has a great AI and it will make some very good tactical decisions.  The other good thing is that the AI is very fast and I only have to wait a few seconds, even though my computer is ancient.  Magarena has 450 cards but all of the cards are game winners, no stupid 2/2 for 3 mana.  The AI can be very aggressive, one time it killed my 8/8 with 2 spells and another time he totally devastated me with a trampling 24/24.

I’m thinking about adding a quest mode to Magarena because I think it would be really fun.  I’ve really enjoyed using randomly generated decks but the quest mode provides some real depth and is very engaging (you don’t want to quit).  Magarena happens to be written in Java, so at least I have a chance of modifying the source code.  I’ve written about Magarena previously here.

I’m not sure how many of you know about stackoverflow.com, which is a question and answer website that only deals with computer programming.  There is a new-ish website called draw3cards.com that deals with Magic questions.  Draw3cards isn’t a very “serious” website but it does let people ask and answer a variety of questions like: What is the least printed magic card? and Are there any colored lands? (only Dryad Arbor which is green.)  I even asked my own question, “Is there a downside to being able to play any card as a land?” I didn't know about the Dakkon Blackblade Magic Online avatar that lets you play any card as a land.  Vanguard seems to have some great avatars like Momir Vig which have spawned whole new formats.

The card art is from  Jace vs. Chandra which are Japanese duel decks with new manga art for the planeswalkers.  You can read the official announcement here.

Keep on tapping,
mtgrares

p.s.
This is a little bit random but just sit back and enjoy something: look outside, tell a joke, or just say ‘hi’ to the people sitting next to you.  I love computers, the internet, and always being connected but it can be very stressful.  And truthfully you don’t need to read the latest gossip or read about the latest technology or read somebodies twitter feed (I’ve never used twitter myself).  Try to relax for a whole 2 minutes. :+)


Thursday, December 16, 2010

Duels of the Planeswalkers - Adding Cards and Modding

The new PC game can be modded so extra cards can be added.  I don’t know anything about it myself but the SlightlyMagic.net forum has tons of info.  The forum seems to have quite a following with 105 topics and 1,413 posts.

Monday, December 13, 2010

Understand Changes.txt

Every version of Forge comes with the file “changes.txt” which describes some of the changes.  Unfortunately changes.txt is extremely brief and full of jargon.  Today I thought I would decode changes.txt and describe some of the changes in common English. 

First a little background info.  In Forge cards can be encoded in one of two ways: Java or scripted.  A Java card is in regular Java and you can see everything that is going on.  A scripted card uses only text.  Scripting is one of the reasons that Forge has so many cards, scripting saves a ton of time versus coding in Java.  The “script” for Shock looks like this A:SP$DealDamage | Cost$ R | Tgt$ TgtCP | NumDmg$ 2 | SpellDescription$ Shock deals 2 damage to target creature or player.

From changes.txt, “Rob added code that can display different images for cards that are included in multiple sets.”  Going back to Shock, which is in /res/cardsfolder/shock.txt, I can see 8 different card pictures that are downloaded for Shock.  Unfortunately, as of right now, you can’t specify which Shock card picture you would like.  (On a side note, I didn’t deal with “set of cards” in Forge because I had a hard enough time getting stuff working.  As Forge has gotten bigger, the issue of “what set is this card in?” becomes more important.)

“Sol added code that gives us and the computer access to the other phases that were missing in earlier versions.”  This change is pretty easy to understand, now you have access to all of the phases in Magic, woot!

“We are currently in the process of creating a new AbilityFactory system which is designed to replace many of the scripted keywords.”  The scripting code has become messy so they are refactoring (moving) the code around in order to make it cleaner.  Cleaner code is much easier to deal with, so you don’t feel like pulling your hair out.

“Moved majority of discard code to Player classes.”  Initially Forge didn’t have a Player class.  A player was specified using only a string, “Human” or “Computer”.  This is why Forge sometimes says “Human draws a card” instead of “You draw a card”.  Since Forge has grown, creating a class to represent a player has become more important.  Instead of the discard code being separate, now it is part of the player class.  I presume you, the human player, and the computer have different player subclasses but I’m not sure.

“Fixed null-pointer error for non-Targeted Fetch cards played by the AI.”  As a Magic player you know that your brain automatically looks for the word “target”.  Many cards aren’t targeted and they have to be handled a little differently.  Apparently the AI caused an error when it used certain types of cards.  (Null errors are the bane of programming.  Every programmer has encountered them zillions of times.)

“Convert Library of Alexandria, SearchMerc/Rebel to use abCost and Target.”  Many of the changes involve removing the Java code for a card and replacing it with scripting, which is a good thing because this actually reduces the number of lines of code.  This is the script for Library of Alexandria

A:AB$Draw | Cost$ T | NumCards$ 1 | ActivatingCardsInHand$ 7 | SpellDescription$ Draw a card. Activate this ability only if you have exactly seven cards in hand.


“Mishra's Factory now uses AF_Pump.”  Java code replaced by scripting again.  Mishra's Factory lets you pump up another Mishra's Factory that has become a 2/2, so that ability is now scripted.

A:AB$Pump | Cost$ T | ValidTgts$ Creature.Assembly-Worker | NumAtt$ +1 | NumDef$ +1 | SpellDescription$ Target Assembly-Worker creature gets +1/+1 until end of turn. | TgtPrompt$ Select target Assembly-Worker creature.

“Goldmeadow Lookout, Oran-Rief, Magosi updated to use Ability_Activated.”  Before Goldmeadow Lookout didn’t use the Java object Ability_Activated and now it does.  Many times I would cut and paste code instead of making objects and central points of control.

“Fix for cards still using Input_NoCost_TapAbility.java. This same fix may be needed for other Inputs.”  Activated abilities have a ton of different costs and some activated abilities costs only tap a card.  Input is how Forge processes all mouse input.  Input uses the State Pattern.

“Modular Targeting now should happen as the Modular creature goes to the grave instead of on Resolution. This fixes the Input issue that was occurring due to the Phase changes.”  Some of the fixes in Forge are regular rules issues.  You may think you understand the rules but you have to be a regular rules lawyer or a DCI Judge in order to never make a mistake.

My biggest rules mistake was thinking that there were two battlefield zones (one of your and one for your opponent) and that Elvish Piper was targeted.  Obviously Elvish Piper isn’t targeted but I was used to the player always making a decision before the ability went on the stack, instead of when the ability resolved.

If you have any other questions about changes.txt, just ask on the forum.

Keep on tapping,
mtgrares

Monday, December 6, 2010

New Version

The only time that I use Windows awful calculator (calc.exe) is to figure out how many cards have been added to Forge.  The good news is MANY cards have been added, specifically 1,339 new cards and no that isn't a typo.  Forge now supports an outrageous 5,441 cards which is enough cards to keep (most) people happy for the rest of their life.

The reason for the huge number of new cards is twofold.  One, it has been about a month and a half since I posted a new version of Forge.  And two, Forge went through a major change in the codebase (source code) which is good because Forge can support more cards.  Thanks to everybody that helped with this difficult conversion.  The additional good news is that a large number of bugs have also been stamped out of existence.  (Forge still has a number of bugs but the number is far smaller.)

Chris H (from the forum) mentioned quite a few changes and here are a few of them.  (I'm quoting from Chris so I'm not stealing, its borrowing.  Hey, if he ever starts up a blog, he can "borrow" from me, ha.)  For a complete list of changes, see "changes.txt"

Rob Cashwalker added code that can display different images for cards that are included in multiple sets. There's a Image Base folder, by default {ForgeFolder}/res/pics, but you can change that in the forge.properties file. Under that, the three-letter set code as a folder, then the card_name.jpg. I'm giving some thought to also try the alternate mostly 2-letter code that the HQ archives use, if the other doesn't exist. Now supports pictures using MWS filenames and folders.  (mtgrares - For more details, post a question in the forums.)

Right now, there's no support for promo sets or duel decks. The primary impetus is to enhance the booster pack generation, (for draft and quest) with pictures being a somewhat secondary benefit.

Friar Sol added code that gives you and the computer access to the other phases that were missing in earlier versions. There is a pull down menu named "Phase Stop" that lets you turn off and on the various phase steps. The phase stop menu is available when using the new and the old GUI battlegrounds.  (mtgrares - Sounds good, many people have requested this feature.)

(Alright, back to mtgrares.)
OK, the good stuff, here are some of some of the unusual new cards that you can use.  Silent Arbiter (cost: 4, artifact creature, 1/5) which has "No more than one creature can attack each combat.  No more than one creature can block each combat." Scourglass (cost: 3WW, artifact) "tap, sacrifice Scourglass: Destroy all permanents except for artifacts and lands".  Platinum Emperion (cost: 8, artifact creature, 8/8) "You life total can't change.  You can't gain or lose life.  You can't pay any amount of life except 0".

And lastly, a card that will improve almost any deck, Pithing Needle. You probably own me 5 or 10 dollars since you don't have to buy a set of these yourself but I'll let it slide this time. :-)

On a side note, the decks that are named AI-something, means that the AI should be able to use the deck pretty well, since the AI has trouble using certain types of decks and cards.

Keep on tapping,
mtgrares

Link (11 MB) - Download Forge 11/30 version - The date 11/30 is when it was first released on the forum.

Card Pictures (150 MB) - Unzip these in your /res/pics/ directory.  These are the low quality (LQ) pictures. (This link has been fixed, sorry about the inconvenience.)

p.s. Magiccards.info is the bets place to view high-quality scans of Magic cards.  The card scans are much better than Gatherer.

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

Dennis Bergkamp
Rob Cashwalker
Friar Sol
Slapshot5
Sloth
Snacko
Hellfish
Zerker2000
Jeff Wadsworth
Silly Freak
PhoenixAvenger
Bladescape
Chris H

Thursday, December 2, 2010

Magarena - A Smart Magic AI

I just had to tell everybody about a new Magic program that I found.  It is called Magarena.  It has 900 cards and a very good AI.  The computer can (and will) play instants and abilities during combat and at end of turn.  I "researched" the program very thoroughly and I had a good time playing against such a smart opponent.  Some of the games lasted 20 or 25 turns because the game AI was so good.  In those close games I had no idea if I would win or lose.

Magarena has a very nice user interface and looks likes a real videogame.  The user interface is much more graphical than Forge and has an elegant wood background.  Magarena also has "undo" which lets you fix a mistake or try to sneak something else past the intelligent AI.  Undo is a great feature because it is universally used and understood.

Magarena uses min-max for the AI and is written in Java.  Feel free to post your comments about Magarena to the forum thread here.

Download - Magarena's Google Project page, runs on Windows, Mac, Linux

Requires Java