Sunday, July 18, 2010

The Sharpening (or YAMTGREE)

So yeah, I'm programming a MTG rule enforcement engine.Again. Last time was a mess, and alot of that was because A) I didn't actually *know* about the comprehensive rules document and B) the magic I had played the most was in the form of Shandalar. That's what? Fourth or fifth edition? Now I feel like that is less of an issue with a lot of Forge,MagicWars,Botarena and even cardboard time logged and a kneejerk reaction to open up comprules.doc every time the AI does something suspicious.

So what's this program all about?
Glad you asked.It was born from a coding spurt combining with some random floating thoughts about implementing text-changing effects in Forge. It takes the shape of a C# class library and not a full program, because I will probably end up making a basic UI with WinForms, which will probably not be portable. This way, any .NET UI can be made and hooked into the library.
The card format that will be used is a little odd. It's sort of halfway between scripted and hardcoded in that the cards aren't compiled until the decks used by each player is loaded, but they are written as full-on C# classes in source files. With the help of some reflection and run-time compilation shenanigans, card classes (inheriting from a CardBase) will have access to all of the various facilities of the engine, such as the Input State Machine(inspired by Forge's), the Activatables (Which basically define everything that a player can do with a card, from hardcasting to activating abilities), the Scheduler (For effects with durations) and a hopefully correct Continuous Effects Layering System(Oh, the important horror!).

Open source?
Eventually. Like any new project of mine, it's ugly. Hideous, in fact. Until I clean it up and document it, it will remain closed source. The cards, however, are fine to read and use as example/base of another card once it get's to that point.

What's done/missing?
Done:
A lot of things are partially done, but that's how it is. Certain things require parts of other things that in turn do the same.That said, I don' think the Scheduler,Priority or Phase mechanics needs more work.
Missing:
The Input State Machine needs tinkering with in order to correctly pass data between the user and the library. Something important is also missing: Spell facilities.No stack,no nothing.
It is very possible that I've gone about this project in an awkward/wrong way, as I do, because while I already have facilities for Text-changing effects already in place, spells are not supported as I mentioned.

Release?
I have 5 criteria for when I will make a first alpha release of Sharpening: A basic UI, of course, Basic Lands implemented and working fine, a creature working fine, a continuous effect working fine and an instant working fine. If you follow this blog, you'll know when any of this happens. ;)

Next?
More Input State Machine tinkering, and beginning the Spell framework.I hope this'll keep your attention (and mine xD ) for a while longer!

Oh god, when I finished writing this I reflexively reached for the "Build Solution" shortcut key.. I've been programming too much already.

4 comments:

  1. Hi! Good luck for this great adventure (quite a ride!) Maybe we can learn from each other - I'm also developing a c# MTG engine.

    Minor comment: The blog being in another language (danish?) made it slightly harder to find how to comment on the post.

    ReplyDelete
  2. Oops obviously, the previous link doesn't work and I can't find how to edit the comment :) The link is on my nickname anyway. Cya!

    ReplyDelete
  3. Good catch. Swedish actually. ;) And don't worry about the link, I already follow you :P

    ReplyDelete
  4. hi! it's definitely interesting how others approach their projects! about the first thing i've done for my project was the layer system. It's working, and very good so I'd say, but I'm nowhere near static abilities or such^^

    but just keep up with how you do it; at the time I'm writing this, I would be ready for an alpha release for your standards, if not for the continuous effects...

    good luck!

    ReplyDelete