Wednesday, October 1, 2008

Random Thoughts About Version 2

I don’t have anything specific to write about today. I’ve done a lot of work on MTG Forge version 2, mostly “background code” that handles mouse clicks and stuff that is taken for granted. Thankfully the background code doesn’t usually have to be updated, so once it is written, it works.

The user interface for version 2 is working. It looks exactly like the current user interface but it uses abstract interfaces for the visual components (see the previous article). Some of the basic components like how I handle the mouse are the same as version 1, I still use the Input class.

I have all of the dialog boxes working. Dialog boxes are the popup boxes that ask you “Do you want to pay 2 life?” Yes or No. I have dialog boxes that show one card, many cards, just to show a message and one that shows a message with the yes/no button. The dialog boxes are a good example of background code.

I first started on working on MTG Forge version 2 over a year ago but I’ve only worked on it off and on. Over the last few days I’ve worked on it like a madman at 2am, 4am, and 6am. Currently version 2 is 131 KB of code, while version 1 weighs in at a hefty 1,000 KB. You have to keep in mind that version 1 probably should be 50% smaller if all of the redundant code was removed. (I would tell you the number of lines that version 2 has but I would have to write a small program and I’ve kind of burned out at the moment.)

Right now version 2 has working life points, mana pool, and board (the zones your hand and in play). Also the mouse click event works when you click on the life points, mana pool, or a card on the board. The “card detail” window on the right also works.

The next step is to get the user interface to cycle through all of the phases and to allow the user to select which phases to stop. Hopefully after I do that, I can actually program a card or two. I really want to just program cards, all of the background code is just laying the foundation. I’m going to lay a solid foundation so I don’t have to ever touch it again.

p.s. Version 2 will have ALL of Magic’s phases, so you can stop whenever you want to.

p.s. You can check out a visual spoiler of Shard of Alara here. We can all drool over the mega rares, lols.


Nanocore said...

Excellent update, thanks for sharing!

Gando the Wandering Fool said...

Keep up the good work! :)

Belin said...

Like I've said in another comment, I'm a big fan of your program and the project as a whole. Thanks for sharing them with us, and congratulations on your work so far, it's excellent!

Anonymous said...

Good to hear you are making progress.
I am also happy to hear all phases are in and we can opt at what phase to stop so we can cast instants or use activated abilities.
That is one of the major drawbacks of V1, the lack of control over phases.
Oh, and a BIG welcome to our friend, the mana pool!

So, me = happy chappy.
And yes, me drools over the rares and new mythic cards of the new set. ;-)

Anonymous said...

cat * | wc -l
will do the trick to count the number of lines in your code !
No need to code what already exists ;)

And congrats on the progress !

Forge said...

4am today I got the phase stops working for version 2.0 where the user selects which ones will stop. Thankfully I didn't have any real trouble with them, but one line of wrong code somewhere and I would have had MAJOR debugging headaches. Programming phase stops is very tricky, hopefully I won't have to do it again until version 3, lol.

cat * | wc -l

I know, I love some of the things that Linux (unix) can do. I'm a Windows guy and although Windows isn't perfect it is good enough. I still have to use the command prompt now and then. If I need to rename a bunch of files, I have to use the command prompt.

battal said...

A tip from another windows guy:
Try cygwin!

It has lots of niceties of *x environments and you can still have a platform that has good driver support. cygwin+bash+java is a good combination I use for my research. Performance of shell programs are not as good as native ones but they do the trick for simple use-cases.