Monday, March 28, 2011

Still Working on Forge User Interface

I did spend a couple of hours last week and worked on a new user interface for Forge.  (User interfaces are usually abbreviated gui, pronounce gooey, for graphic user interface.)  It is amazing how complicated a “simple” gui can be.  Forge doesn’t even have any animation or movement but coding a gui is still painfully slow.

GUIs look simple, they take 2 minutes to evaluate and 2 weeks (or more) to write.  GUIs have a ton of details like “what is the icon size for your graveyard?”  Do you want it to be 8 x 8 or 16 x 16 or 32 x 32 or something else?  Additionally it is hard to make a gui look symmetrical and “clean”.  Creating a messy gui is very easy but a “nice”, easy-to-use one takes many hours.

The good news is that I found a gui that I want to copy so I don’t have to juggle as many details.  Magarena has a very nice gui, see below.  I find it very aesthetically pleasing.  Magarena also supports themes so you can customize the gui yourself and since Magarena already has a nice assorted of themes, Forge’s new gui will be able to use Magarena’s themes.  (Everybody says code reuse is good right?!)

Hopefully the  right panel in Forge, which I call the “card detail” panel, will slide in and out of view so you will have more space to see which cards are in play.  I may be able to get rid of it completely by allowing the card picture to popup when your mouse is hovering over a card.  The popup card picture would have to regular top of the card and the lower part could be Forge’s text view of the card, like keywords (flying, fear) and abilities.

In conclusion, writing a gui is a lot like writing a novel.  Having one great idea isn’t enough, you need to fill in millions of details.  And “millions of details” is the very definition of computer programming.

Thanks for reading,

--Random computer quote, “Computers are useless. They can only give you answers”  by Pablo Picasso.

--You really need to play Magarena.  It has a great AI.

Monday, March 21, 2011

User Interfaces – Forge and Pirates of the Spanish Main

Graphic user interfaces (GUI, pronounced "goo-ey") make or break computer programs.  A good gui is worth its weight in gold while a bad one will make you throw your computer out of the window. 

Recently I read the quote, "To users the gui is the program".  Programmers tend to view things much differently than users.  To programmers the gui is the "front-end" that has sparkling colors and other unnecessary eye candy while the "back-end" does the actual number crunching.  To programmers the "heart" of the program is the back-end while users see the "heart" as the front-end.

I've worked a little bit on Pirates of the Spanish Main's back-end and I was thinking about the front-end.  The difficulty is that I was going to use only 2D graphics, which is great for games like Pacman but not so good for good for other things.  Limiting myself to 2D graphics means that Pirates would have an "overhead" gui, where you saw everything from directly above.  While this might sound ok, in reality your ships would be only outlines of the hull. 

Viewing a ship directly from above is very unexciting and the gui could show your ships in one color and the computer's ships in a different color but the overall game experience would be very abstract compared with the nice 3/4 view that the (now deceased) online game had which used 3D models.  The 3/4 view is similar to Zaxxon.  (Boy, I'm dating myself with the Zaxxon reference.) You can see videos of the online Pirates game here. 

I'm still interested in trying to write a Pirates of the Spanish Main game but I'm not sure how to do it using only 2D graphics.  Maybe I could simulate a 3/4 perspective by taking numerous pictures of a ship at different angles?  Theoretically, I could use a 3D game engine but I think I would be in over by head.  (JMonkey looks like a good 3D Java videogame library.)

Last night I played a few games with Magarena, a great Magic program that features a very good AI.  I just marveled at how "nice" everything felt.  Magarena feels like a real, commercial program because the gui is so nice and refined.  It even supports creating your own themes so users can customize the icons representing your hand, graveyard, library as well as the wallpaper where the game is played. 

I am going to try to create a gui for Forge that is similar to Magarena.  I always figured that someone else would update Forge's gui but since that hasn't happened, I thought I would offer my meager skills.  I know absolutely nothing about videogame programming but I did find a small, simple videogame library called fly that I plan to use.  Magarena supports themes and I want Forge's new gui to support themes also.  I actually plan to "borrow" Magarena's themes because they look so nice.  "Good artists borrow, greats artists steal."

Keep on forging,

Link - Magarena's download site - It is a great program and the AI is very challenging.

Link - Fly is a small, simple Java videogame library.

The pirates videogame could be done from an isometric viewpoint.  It wouldn't be fancy looking or anything but it would be better than nothing.  (For a good definition of isometric read this Wikipedia article.)

Wednesday, March 16, 2011

Big Change, Not Open Source

The other big change is that this will not be an open-source project.  My goal is to get the first expansion working (156 cards) and get authorization from NECA, the company that bought Wizkids.  It would be cool to sell it for $10 or $20 because there aren't any other videogames like it on the market.  (The market really needs more trading card videogames and not lame, yuppie games that only cater to 12 or 14 year olds.)

To summarize, my new goal for this blog is to write a Pirates of the Spanish Main videogame and try to sell it for cold, hard cash.  The first version would only let you play against the computer but later versions might change that. 

I'm very hesitant about this project because it will require a very sophisticated user interface compared to Forge.  The physical area for a pirates game is very large, at least 3 feet long and 3 feet wide.  To make the user interface as good as possible I plan to use a 2D Java videogame library to handle the low-level grunt work rather than write my own. 
Both the user interface and the artificial intelligence (AI) are both big unknowns that could sink this project.  Forge has a decent user interface and AI but both will have to be improved if I want to make a commercial game.  I don't take many risks in life but I'm willing to gamble on this one.

As always, thanks for reading,

Maybe I should start a new blog instead of changing this one, who knows?  If I keep this blog I need to come up with a different blog title, something like "Java Videogame Programming" which sounds extremely lame and boring.  Maybe "Pirate Programming" is better?

Monday, March 14, 2011

New Beginnings

I'm not sure how to say this but I'm tired of writing about Magic: the Gathering.  Yes it is the world's greatest game but after 4 years and more than 100,000 words I felt like I've said everything that I wanted to say.  In fact, I've written about every topic twice and even three times.

My real passion is programming and I haven't programmed in awhile.  For more than 2 years Forge has progressed without my help and I'm the type of guy the likes being a "code monkey".  Staring at code is actually fun for me so I've decided to work on a new videogame, the Pirates of the Spanish Main.  I bought my first pack two weeks ago and I fell in love with the cute, little ships. 

Pirates of the Spanish Main was created by the company Wizkids and the game was sold in stores from 2004 to 2008.  Pirates of the Spanish Main had 13 expansions and a total of almost 2,000 cards.  An online version was created by Sony but it was shutdown two months ago.  (Probably needed more users but who really knows.  It's hard to attract new users without new expansions.)

Let me briefly outline how the game is played.  For a two player game, each player creates a fleet of ships, crew, and treasure and tries to win by collecting more than half the treasure or destroying all of your opponent's ships.  This is a miniatures game where distance is important.  A ship's movement and cannon range is specified using the short and long side of the card.  S + L means that a ship can move "short" then "long" and  3L means that a cannon can fire "long" and you must roll higher than a 3 in order to get a hit.  (I presume using the card for measurements was easier than requiring players to use rulers.) 

I plan to "computerize" Pirates of the Spanish Main and allow you to play against the computer.  (Maybe you could play against other players at a later time.  Networking programming is very hard although I've read good things about Groovy, which compiles into Java bytecode, and actors.)

--Here is a link to the Wikipedia article on Pirates of the Spanish Main, also called "Pirates Constructible Strategy Game"

--Forge isn't going away, I will still post new versions each month.

--Come back Wednesday for more news about the changes, matey.

As always, thanks for reading,

And Forge 2 doesn't exist so you are not missing out on anything.  Fixing some of Forge's problems is a great idea but a complete rewrite is utterly insane because of the amount of time it would take.

Monday, March 7, 2011

Composed of Simple Parts

In a way Forge is very simple.  Each part does only one thing.  The deck editor reads and writes decks.  The card factory creates new cards and Magic zones are only arrays (more specifically Java ArrayLists).  The three main classes that do the most work are: Card, SpellAbility, and GameAction.

The card class is fairly easy to explain even though the implementation itself keeps growing.  The card class is used wherever a physical card is used in Magic, which includes: in your hand, graveyard, library, exiled, or battlefield.  The card class has become complicated because it is hard to keep track of everything that can happen like various counters, equipment, auras, damage that the card has received this turn, mana abilities so they can be copied, along with obscure data like "did this creature attack this turn?" or "did this creature deal damage to an opponent this turn?". 

The SpellAbility class is used to represent all spells and abilities and a Card object holds one or more SpellAbility objects.  This class hasn't changed much and hasn't grown like the card class.  SpellAbility has an abstract method called resolve() which is where the effect of the card takes place, like actually destroying all creatures for Wrath of God.

GameAction does "game actions" like drawing a card or dealing damage.  This class does not hold all of the game information, like zones and life points, but it does things like move creatures to the graveyard when they have enough damage or implementing state effects for Glorious Anthem.  I created this class out of convenience because I didn't want to copy and paste code for every card that does damage or draws a card.  All of Forge's game information like zones and life points are global, public variables which any part of the code can access or change.  This was done in order to get things working quickly without a long design period.  Generally cards should not access the global, public data and should use GameAction instead.

Even though I designed Forge on-the-fly, the overall design has withstood the test of time as well as the additional complexity of several thousand cards.  Forge's design was "good enough" and got things working quickly.

And as always I want to thank the current design team.  They have done a great job updating Forge and understanding my wonky, undocumented code.

Keep on forging,