What the future holds

Last week, my first son was born. Everyone’s healthy and happy. But I don’t think I’ll be able to continue any hobby software development, a least for a couple of months. See you out there!

Posted in Uncategorized | 2 Comments

User Interface – In Game

Here’s the latest sketch I have for the in-game screen. I took some ideas from the yet-to-be-released new MTGO client (here’s a blurry picture).

Some notes about this sketch:

  • I want to leave as much space up to the table. To help with that, I will use pop-ups as much as possible. For example, mana pops up to the side of the player’s info when mana in pool). Another example is the information about the current phase, which I plan to represent using small icons at the right of the screen (only the current phase visible unless hovered on).
  • I want the left region to be smaller than what is pictured. Less important zones (graveyard, library) will be represented only by a number on an icon. You can check out the graveyard content by clicking or hovering on its icon.
  • Between the player info boxes will be where objects on the stack are displayed. I think that MTGO had a great idea there: when the stack becomes big, you can press a key to make it either transparent or retract while you check out what’s happening on the table.
  • The chat/console box is a bit controversial for me. For some games (single-player), you probably won’t need it. Sometimes, I guess you want it to be much bigger (hence the “unpin” button to make it a separate floating window). I also thought that it could be cool to “minimize” it as a single line below the hand where you see the last thing that was said? Not sure about this one.
  • There’s one thing that I didn’t picture and that’s the “modal choice” dialog, for when the user has to make some modal decision or when the game informs the player that an action is needed (mulligan? continue? declare attackers? discard X cards now). I don’t want to make another window for that and I don’t want to put it as another tab within the chatbox window because I believe you might want to continue reading while playing? So right now I’m thinking of displaying it on top of the table (when needed), maybe in the bottom right corner.

Am I missing something? Tell me what you think!

Posted in Uncategorized | 1 Comment

User interface – Deck Editor

Hi, I realized that I was very focused on small UI details and that I was never going to have a usable product this way. I thus decided to take a top-down approach, design the general flow of the app I want to make, and then make that happen, allowing me to skip over some details if necessary. Right now, I have:

  • a working, yet basic game interface (though with hardcoded decks and settings)
  • a deck browser/editor
  • a cool main menu

I want to add lobby management (i.e. game setup) and also have a greater unity between all these things. Since I find that prototyping with WPF can be quite long, I decided to try a “wireframing tool”, that allow me to easily try a layout. I started with the deck browser/editor screens:

I had most of this already implemented, but there were some things that I wanted to change and this kind of prototyping allowed me to clear up my ideas. You also have to imagine gatherer-like lists instead of the boring listboxes 🙂

One of the things that always bothered me is that I wanted a dark theme (à la Expression Blend), but the mana symbols that are downloaded automatically from gatherer.wizards.com only look good when used against a white (or very pale) background. I tried having most of the layout in the dark theme and then white list boxes, but it’s not looking so good. Also, it’s hard to give good selection feedback in the listboxes without changing the background color of the item. So, in the end, I might consider a whiter theme.

Also, I rewrote the network backend so that it’s easier to extend in the future. Maybe, I’ll write on that later.

Have a nice weekend (spring is here!)

Posted in Uncategorized | Leave a comment

The MTG minmax AI landscape


It has recently come to my attention that two newcomers (at least new to me!) in the world of MTG minmax AI are making great progress. I find it extremely exciting that this kind of AI is getting more popular and that many projects are taking on this hard challenge. Hopefully, we can take some ideas from each other and make a better world!

Those two are:

I still have this crazy idea that one day we can make our AIs compete each other 🙂 Maybe someone should start working on a protocol for MTG moves…

Also recently, Nvidia has released samples that show a minmax algorithm running on a GPU. They still have some way to go (no backtracking search) but the promise of running an algorithm on thousands of GPU threads is certainly appealing!

As for me, I’m currently making some progress on the deck editor. Next up is the staging area, where you prepare for the game, choose your deck, etc…

Posted in Mox | 2 Comments

Slides from MIGS 2010

Available here. Enjoy!

Posted in Uncategorized | 3 Comments


It seems almost impossible to find some time for Mox (or MTG) these days. Wes Cherry, creator of Windows Solitaire, said:

The thing about time is they are always making more of it. No harm done.

I can’t say I agree! 🙂

In other news, I’ll be presenting a lecture at this year’s Montreal International Game Summit next tuesday. Have a great week.


Posted in Mox | 5 Comments

News from the battlefield

Hi everyone! I’m not dead… yet!

I’ve worked tirelessly during the last month on the UI side of Mox. I’ve been toying with a card browser and now a deck browser/editor. Ultimately, I would have liked to be able to browse/download decks from major online deck databases but that doesn’t look feasible right now because no one is offering an API to access them. Maybe someday…

A new feature in Mox is that it now downloads card/symbol images automatically from the web, which is pretty nice for easier deployment.

I’ve sticked with (and invested in…) WPF for now. Xaml can (and most certainly will) be a great time sink because you can style everything. I’m starting to realize now that I suck at graphics design. If anyone wants to help with that, I’ll be glad to get a hand. There is one feature that I designed that I think is pretty cool. On the main menu screen, I pan/zoom on card images in the background (remember, those are downloaded automatically), much like you can see in some documentaries where the view pans/zooms on some photos. It’s really nice! Here’s a shot:

Each image stays for about 5-10 seconds and the whole thing is kind of hypnotizing. You can also play “guess the card” if you want 🙂

Maybe after I get the card/deck browser running, I can start thinking about a first binary release…

Shameless plug: I’ll be speaking at this year’s Montreal International Games Summit (MIGS). The title of my presentation is Pipeline design: A non-intrusive data driven approach. You can check out the description on the web site. Come see me if you’re attending 🙂


Posted in Mox | Leave a comment

WPF or Silverlight?

I started Mox as a WPF project. I can provide a nice and rich user experience. But lately, I’ve been thinking into switching to Silverlight, another Microsoft-driven technology that is a bit like Flash, in that it runs on the client but through a browser. The main advantage of Silverlight is that it is portable. It works on Mac, Linux and probably even some phones. That is the big selling point for me (WPF is limited to Windows). Silverlight also has the rich user experience that WPF has and has out-of-the-box auto-updating which means clients are always up-to-date.

However, I found out some problems that are making the decision difficult for me. In particular, Silverlight is meant to be a client-only sand-boxed application. For example, it doesn’t allow the opening of TCP ports for listening on the client machine. That means that you cannot have a server-client architecture purely in Silverlight (which is common for multiplayer games). The workaround involves having an actual hosted server to which all Silverlight clients talk to. In addition to adding some latency (especially if both players are far from that server), it would require me to host one/many server(s) that can handle all the players (hopefully a lot!). Of course, in all cases, I need a server for matchmaking, but this is lightweight. I was counting on one of the player to act as the server (or have user-run dedicated servers).

On the upside, as far as I know, normal Silverlight networking involves using the browser’s HTTP stack, which solves NAT traversal problems (going through firewalls). However, I think that .Net 4 introduced this also for lower-level TCP communication so that might not be a real issue.

What do you think?

Posted in Uncategorized | 2 Comments

Back from vacations

I’m back from a 3 weeks vacation in California. San Francisco is warm culturally but very cold and foggy. LA’s sun is hot but the city is kind of gray-ish. Santa Barbara’s marina is very nice and the coast around Monterey is beautiful!

Now let’s go back to Mox… [to be continued]

Posted in Uncategorized | 2 Comments

Continuous Effects


I could start today’s post by telling you that I have 48% of 10th edition cards implemented. But the bulk of my work in the last weeks was concentrated around a very specific mechanic (continuous effects). Those effects have to be one of the most troublesome mechanic to implement (other developers should agree with this). It is a central mechanic in MTG and so I couldn’t wait any longer to dive into it if I wanted to continue implementing interesting cards.

A few months ago, when I did local effects (R: This creature gets +1/+1 until the end of turn), I did put some thoughts into the more difficult “global” effects as well (White creatures get +1/+1). Without really implementing it, I left hooks and missing pieces here and there with the thought that they would suffice for the global effects. I was wrong. Global effects are evil. So, I shook that code a bit, I dug a bit around in other MTG engines to see how they did it and I finally opted for a new solution. After fixing some performance problems (global effects tend to affect a lot of objects – and they must be checked for update very often), I think I’ve got a working mechanic. I had to change my “effects syntax” (the way I declare effects) in order to support this, but I don’t think there’s any simpler way to do this.

Here’s Nightmare, with a tricky local effect (sorry, the narrow theme makes it harder to read):

[Update: Snacko pointed out correctly that Nightmare’s PT setting ability is a characteristic-defining ability and should be active in all zones. I updated the card definition accordingly.]

public class NightmareCardFactory : FlyingCreatureFactory10E
    protected override void Initialize(Card card, InitializationContext context)
        base.Initialize(card, context);

        // Nightmare's power and toughness are each equal to the number of Swamps you control.
        Func<Object, PowerAndToughness> pt = o =>
            int value = ((Card)o).Controller.Battlefield.Where(c => c.Is(SubType.Swamp)).Count();
            return new PowerAndToughness { Power = value, Toughness = value };
        AddEffect.On(card).SetPowerAndToughness(pt, Card.SubTypesProperty).Forever();

And here’s Glorious Anthem (a global effect):

public class GloriousAnthemCardFactory : MTGCardFactory
    // Creatures you control get +1/+1.
    private class BoostAbility : ContinuousAbility
        protected override IEnumerable<IEffectCreator> AddEffects()
            yield return AddEffect.OnCreatures(Manager, Condition.ControlledBySameController(Source)).ModifyPowerAndToughness(+1, +1);

    protected override void Initialize(Card card, InitializationContext context)
        base.Initialize(card, context);

Notice how some effects need to indicate which properties will trigger the effect to “recompute”. This is not so elegant but is necessary if you don’t want every effect to be recomputed at every property change (and there’s a lot in search-based AI).

Have a good week!

Posted in Mox | 3 Comments