Wednesday, April 29, 2009

Room for Improvement

Even though I consider MTG Forge to be an outstanding success, there are many areas that could be improved. For example, when an error occurs it is not displayed to the user. This wasn't done on purpose and is more of an accident. The error is displayed on the "command prompt" which is very visible when I am programming but is usually hidden when the user runs the program. Ideally the error message should be written to a file and displayed to the user. If MTG Forge had an Internet connection, the error message could be automatically forwarded to the developer (me).

Furthermore, MTG Forge stores all of the card information in one method. Yes, the guts of all 1,500 cards is stuffed into one very long method, I use nested brackets to give each card its own namespace. This was done as a quick-and-dirty way to create new card objects. A better solution would have been to put each card in a separate file. If these card files were read at runtime, adding new cards would be easy versus compiling the whole project.

Currently MTG Forge stores all of the deck files in one master file. While this scheme simplifies some of the programming, it makes life more difficult for the user. Typically users make new decks and tweak preexisting ones and every time the user upgrades to a newer version, they have to save their "master deck file". I think it would be better if the decks were stored in separate files.

The deck files should also be plaintext in order to allow the user to easily cut-and-paste the deck contents when posting the deck to a forum. While MTG Forge doesn't support separate deck files, individual decks can be imported and exported, a binary file and a text file of the deck's contents is created. (You can view decks that people have posted here.)

The user interface could also be improved and although MTG Forge version 2.0 is still being built, it uses an abstract user interface. This will easily let allow another "front-end" to be written. MTG Forge's "rules engine" handles all of the mouse input and menus, so the user interface is only responsible for displaying life points and cards.

p.s.
Best Island ever, the Japanese get all the good card art, lol.

p.s.s.
The simplest videogame libraries I have found for Java are Fly, Ucigame, and GTGE (the link is currently down but it used to work). LWJGL seems popular but I don't understand it. LWJGL seems to require a working knowledge of OpenGL.

//example of nested brackets from CardFactory
getCard(String cardName)
{

{
//create Wrath of God
}

{
//create Giant Growth
}

{
//create Eager Cadet
}

}//getCard()

8 comments:

  1. Do you remember long time ago I sent you some ideas how to load cards from separate files? So they can be loaded dynamically at runtime. The only thing I don't like is that this card files still should be compiled (into .class objects), so you can't modify them on a fly.

    May be the other good option will be to compile code from text files. Or make some tool that will validate all .java files and compile them into .class object, which later will be used by application. In this case any user will get the opportunity to add a card.

    p.s. I've downloaded your latest version. It became much better %)

    p.s.s. but one thing I've noticed is that sometime it is very very slow. I get delays even when tapping lands for mana ;(
    If I'm not the one who faces such problems, may be one day you'll need to use java profiler to find out what happens

    ReplyDelete
  2. In any non-trivial program, there are always areas you could improve!

    ReplyDelete
  3. Hopefully for version 2.0 the card code will be just text files which will be read at runtime.

    ReplyDelete
  4. "p.s.s. but one thing I've noticed is that sometime it is very very slow. I get delays even when tapping lands for mana ;("

    I use observers everywhere for better or worse, so when you tap a land the observer code is called. Sometimes it is a little slow on my home computer but is it very slow, 800 mhz I think.

    ReplyDelete
  5. Gando was experiencing slowdowns as well...
    I don't know, I just bought a new laptop and Forge runs very very smooth for me (unless I have like 100+ tokens in play).

    But even on my previous laptop which is a modest 1.66 dual core with 1GB of RAM, I hardly ever noticed slowdowns.

    I know the incarnations (Wonder, Anger, Brawn, Valor, ... I guess we never coded the black one?) slow the game down as well, even in subsequent games...

    ReplyDelete
  6. Hi !.
    You re, I guess , probably very interested to know how one can manage to receive high yields .
    There is no initial capital needed You may start to receive yields with as small sum of money as 20-100 dollars.

    AimTrust is what you thought of all the time
    The firm incorporates an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.

    Its head office is in Panama with structures everywhere: In USA, Canada, Cyprus.
    Do you want to become really rich in short time?
    That`s your choice That`s what you wish in the long run!

    I feel good, I started to get real money with the help of this company,
    and I invite you to do the same. If it gets down to select a proper companion who uses your funds in a right way - that`s AimTrust!.
    I earn US$2,000 per day, and my first deposit was 1 grand only!
    It`s easy to get involved , just click this link http://azufakuz.greatnow.com/yderul.html
    and go! Let`s take our chance together to feel the smell of real money

    ReplyDelete
  7. Good day, sun shines!
    There have were times of hardship when I didn't know about opportunities of getting high yields on investments. I was a dump and downright stupid person.
    I have never imagined that there weren't any need in large initial investment.
    Nowadays, I'm happy and lucky , I started take up real income.
    It gets down to choose a correct companion who uses your funds in a right way - that is incorporate it in real business, parts and divides the income with me.

    You can ask, if there are such firms? I'm obliged to answer the truth, YES, there are. Please get to know about one of them:
    http://theblogmoney.com

    ReplyDelete
  8. Good day, sun shines!
    There have were times of hardship when I felt unhappy missing knowledge about opportunities of getting high yields on investments. I was a dump and downright pessimistic person.
    I have never thought that there weren't any need in big initial investment.
    Now, I feel good, I begin take up real income.
    It's all about how to select a correct partner who utilizes your money in a right way - that is incorporate it in real deals, parts and divides the profit with me.

    You can ask, if there are such firms? I'm obliged to answer the truth, YES, there are. Please get to know about one of them:
    [url=http://theblogmoney.com] Online investment blog[/url]

    ReplyDelete

Note: Only a member of this blog may post a comment.