
First, let me define the terms compile and runtime. Transforming a programming language, like Java, into an executable file is called “compiling.” Runtime is when the program is actually running on your machine. For further details see the Wikipedia for
compile time and
runtime.
For programmers there is a constant battle going on. The battle is this: should the logic of a program be specified at runtime or compile time? Specifying compile time is easy. Below a tax variable is created, this is an example of compile time.
float tax = 6.5;
Runtime code would read the tax variable from a file. Runtime code is more flexible but harder to write. The runtime code would also require additional error checking to see if the file exists, see if the number is valid, etc...
Most programs use both compile and runtime code. At runtime MTG Forge reads a list of card names, mana costs, and text from the file “cards.txt”. Recently someone e-mailed me and said that Sprout Swarm should be an instant. All I had to do was to change it in the card.txt file, nothing else had to be done.
While it would be easy for a non-programmer to say that all variables and logic should be specified at runtime, it is not feasible. Some parts of a program, like the tax variable, might change in the future so it should be created at runtime. It is a
design decision whether to make the code runtime or compile time.
I use the file “cards.txt” for convenience because it allows me to easily add simple creatures. Simple creatures are creatures that have a keyword like flying, haste, or landwalk. MTG Forge uses card.txt to make creatures at runtime. All activated abilities and sorceries/instants are created at compile time.
Keywords that cards.txt recognizes. All the keywords have to have this exact spelling, with Haste being capitilized and "tap: G" having only 1 space after the colon.
Mountainwalk
Forestwalk
Islandwalk
Plainswalk
Swampwalk
Indestructible
Defender
Fear
Flying
Haste
tap: add 1
tap: add B
tap: add G
tap: add R
tap: add U
tap: add W
This creature can block as though it had flying.
This creature cannot block
Trample
Unblockable
Vigilance