Wednesday, March 4, 2009

Quest Update - Programming Details

As you may know I’m busily working on a quest mode for MTG Forge where you would start out with a small card pool and you would win more cards. The good news is that I’ve worked on it for about 4 hours today and although I haven’t finished, I’ve made good progress.

The quest mode seems very easy on paper, but when you have to spell out every detail in code, it seems excruciating. Does this method return null or an array of size 0? What if a file cannot be found, what should be done? Is there any way in the universe that this simple method could fail? When you program, you have to answer a million little questions like these.

I programmed a very simple screen that let the user choose from 4 radio buttons to select the difficultly of the quest mode. (The higher the difficulty, the more wins you have to get in order to earn new cards.) Four radio buttons, it seems pretty simple, just see which one is selected and then go on. I forgot to check to see if none of the buttons were selected, so I added a very important “else” clause.

Since I know MTG Forge is a little buggy by design and I never want a player to lose his progress, MTG Forge never erases the old save file. The old save file is renamed something like “questData-10” and a new save file is created. This seems like a pretty good way of providing a safety net.

13 comments:

Gando the Wandering Fool said...

Excellent idea. Making a backup copy is smart indeed.

LSK said...

Having to win even 50 games to get new cards seems unexciting to me...

Rob Cashwalker said...

Forge didn't mention it in the blog post, but on the forums he's said that the number of wins to get a booster pack is more like 2, 4, 6 & 8 for each difficulty level. The numbers on the screen shot here represent the overall length of the quest

DennisBergkamp said...

Another possibility would be to add a "custom" difficulty level also, where the total number of games, number of games until you win more cards, and number of cards won could be set by the user.

Anonymous said...

Regarding the "no radio button selected" case... why don't you set one of the buttons (medium perhaps) activated by default? Then it would not be possible again that no button is selected at any time.

Forge said...

Well maybe instead of the text "The number of games that you have to win" to "Length Quest". It is hard to be completely clear.

Letting the user choose their own options sounds great for the next version of quest.

I could have made one of the radio buttons selected by default, but I didn't want to completely erase the user's data if they clicked one wrong button, they have to click two wrong buttons, and even then their quest can be restarted since all of the previous save files are kept.

Forge said...

Instead of "Length Quest" I meant "Quest Length" and yes I am dyslexic sometimes, for better or worse, ha.

willow said...

Wagic has such a mode (it is actually the only mode of the game) where you earn credits to buy new cards as you win games.
In the long term, it has shown a few drawbacks. First, the more games you win, the easier it gets because you improve your deck while the AI doesn't improve. (I think you won't have this issue with Forge because you will progressively increase the difficulty as the quest goes, right?)

Then, although it is a good motivation because it'll give you more cards whenever you win a game, it lacks "spice" in the long run.
I'm now thinking of adding stuff to "unlock" in the game: difficulty levels (someone suggested to have the AI start with a few cards already in play on the slightlymagic forums, I love this idea) maybe whole expansions that you cannot use otherwise, extra money if you win without taking one single point of damage,...? I'm not sure yet...

Anonymous said...

Very cool idea. The difficulty has to increase as your deck improves somehow, though.
Speaking of card pools, most tournaments I've been to use six boosters in sealed, Five is hard to work with.

Forge said...

Willow - "I think you won't have this issue with Forge because you will progressively increase the difficulty as the quest goes, right?"

Nope, writing any AI is hard enough, so the AI doesn't get any harder. Possibly the AI could use better decks the further you progress. Or the AI could cheat and draw 2 cards a turn or start with a creature in play like in Shandalar.

Mr.Chaos, unofficial betatester said...

Hi-ho, hi-ho, a questing we will go, hi-ho, hi-ho!
In other words: Bring it on!
Sounds like it is coming along nicely.
Backing up the old save is a good idea and I like the option for various lengths of the actual quest.

I call forth my companion, Priest of Titania, ready my Staff of Domination and set off on an epic quest throughout all of Gaea.
I just hope we don't run into a Lhurgoyf.

willow said...

@Forge: yes, better decks for the AI as you make progress in the quest is what I meant,not an AI getting better and better ;)
draw 2 cards a turn: why not, but it might be a weak point against a black vise + millstone + howling mine deck ;)
having a card already in play sounds neat, however you have to be careful that this card does not become a danger for the AI (lord of the pit...) in case it's randomly chosen in the AI's deck.

void said...

Shandalar has used cards in play to increase difficulty of the opponent (by coincidence it was often a Hypnotic Specter).
Or you faced three opponents in a row without your life points reseted.
Or your opponent was starting with more life than you.
Microprose had nice ideas to make the duel more challenging.