Forge 2.0 - The Best Program Never Written

Forge 2 is vaporware. I've probably started it 5 times using Python and Java. I know what to do better (like fixing CardFactory) but it is just a lot of code to write.

CardFactory is the biggest thing I would change. Cutting and pasting code is a horrible practice and the card code could be much easier to read. Cards should be created from plain text like below. Shock and Prodigal Pyromancer could use the same target and resolve code.

Using the same code for instants/sorceries and activated abilities would be a huge leap forward. (Maybe the same code could be used for static abilities, who knows. It depends on the specific implementation.) In retrospect I think I could have used
Object.clone() to create new card objects.

Rules are the biggest challenge (of course). I would use a "big object" to implement all of Magic's rules in one place. While big objects should usually be avoided, in Magic anything can change anything else, so it is best to put everything into one large object.

The advantages I think would be huge. At first the Rules object could be simple. As more cards are added Rules could become more complicated. In order for Rules to work it has to be given all of the information about the game (which card produced which mana, did you play a red spell this turn, etc..) which would be challenging.

Putting all of the rules into one big object sounds bad until you consider the alternative: sticking the rules in a bunch of different, scattered objects which Forge currently does.

Even if Forge 2 only had these code improvements and the AI played the same, I think it could implement 95% of all Magic cards in existence. Also I think that Forge 2 should implement whole sets and not random cards. Implementing random cards is ok but whole sets would be more fun to use.

Theoretically if I got Forge 2 working with just a few cards, like the white cards from M11, I could release it and let other people do the rest. I just need to build Forge 2's skeleton which is easier said than done.

I'm not sure why working on Forge 2 feels so wrong. Maybe I'm happy with version 1 (and letting other people do all of the hard work). Maybe I'm afraid that I'll fail. Maybe I'm afraid that Forge 2 would not live up to my hype because at first, Forge 2 would only have 20 cards and it would not be very fun.

Like any questionable endeavor, I'm not sure that the work that I would put into Forge 2 would pay off.

--mtgares

p.s.

If Forge 2 used plaintext for the cards, people could easily add their own custom cards and even construct whole new sets. Below are just a few sample cards. I'm sure everybody would implement their version of "plaintext Magic cards" differently.

When I showed this before many people commented that the "Text:" field seemed unnecessary and could be generated from the other information. Maybe it could but since Magic is so complicated with more than 15,000 cards, I would rather not guess and just include an extra field. Personally I try to make the parsing code as simple as possible in order to reduce the possibility of bugs.

Shock
R
Instant

Spell
Text: Shock deals 2 damage to target creature or player.
Target: creature or player
Resolve: damage target creature or player: 2


Prodigal Pyromancer
2R
Creature Human Wizard
1/1

Activated Ability
Text: tap: Prodigal Pyromancer deals 1 damage to target creature or player.
Target: creature or player
Cost: tap
Resolve: damage target creature or player: 1


Venerable Monk
2W
Creature Monk
2/2

Triggered Ability
Text: When Venerable Monk comes into play, you gain 2 life.
Trigger: comes into play
Resolve: gain life � you: 2


Holy Strength
W
Enchant Creature
Static Ability
Text: Enchanted creature gets +1/+2.
Effect: enchanted creature gets: +1/+2


Glorious Anthem
1WW
Enchantment

Static Ability
Text: Creatures you control get +1/+1.
Effect: your creatures get: +1/+1

No comments:

Post a Comment