Friday, February 16, 2007

Windows Presentation Planets?

Way back when I was a kid we used to go visit my grandparents and cousins in Arizona each Christmas. My mom’s older brother, Uncle Jay, was one of those old-school computer engineers. You know, the kind that went to school before anyone had even thought of putting a bunch of vacuum tubes and telephone switchboards together to play pong.

Anyway, Uncle Jay always had the latest computer gadgets. And it was sooo cool. My two brothers and I lived for that one week a year. Not only did they have the Atari consoles, but you could also play their sweet TI 99 (it had a speech synthesizer module!), and hack away and play games on their custom-built PCs (anyone remember DR-DOS?). Donkey Kong was awe-inspiring on their huge projector screen lit up by the "color cannons" in back.

One of the games I remember playing at Uncle Jay's involved several ships in a star field. You could rotate your ship and choose how much power to give your shot. The idea was to hit the other guys before they hit you. The only trouble was, the screen was full of planets. Planets with gravity. Each time you shot, your missile left a colored trail so you could make lots of psychedelic designs on the screen. (The trails may also have been useful for calculating your next shot, but I don’t remember.) If you want to get a feel for how this works, check out my clone.

Ok, so fast forward a few years. Word on the street is there’s a new game in town; the “mother of all games”. Well, who wouldn’t want to play the mother of all games? So I got me a copy of Scorched Earth. This game is the stuff legends are made of. If you haven’t tried it out (which is pretty unimaginable, but stranger things happen), Tanks is one of my favorite clones. There are exactly 21,642 Scorched Earth clones.

By now you might have guessed what I am leading up to. That’s right. We are going to take these two totally rad games, sprinkle in some modern graphical and networking madness(courtesy of WPF and WCF), and take over the world. WPF ├╝ber alles!

The Big Idea

Big weapons. Big explosions. Pretty psychedelic patterns on your screen. This is what we are after.

You and up to 3 other buddies slug it out, turn-by-turn at the keyboard or over the LAN. You get to choose one of several ship designs to fly into the heat of battle. The idea is pretty simple: bump off everyone else before they do the same to you. But there is stuff in the way. Mind you, we won't have mountains like in Scorched Earth. We’ve got to have planets, and lots of ‘em. And suns. Let’s also include the occasional black hole, a worm hole or two, and a space station. Lot's of stuff we get to shoot around. Or just shoot.

Just wait until you see a sun blow up. Sweet.

Of course, we are going to need money to buy weapons, shields, repair kits, and warp crystals. So the more tricky your shot (i.e., the longer it goes without hitting something) the more dough you’ll earn. Of course, you will also get bonuses depending on what exactly it was you hit (if anything).

And money buys weapons. Really crazy, insane, fun weapons. Here is an initial list to wet your appetite:
  • Torpedos - Your basic weapon

  • Lasers - Only black holes can bend 'em

  • Hammer - Massive, Planet-breaking destruction

  • Firefly - Remote detonation with a big blast radius

  • Trinity - 3 in one

  • Sparkler - Throws off mean little beasties wherever it goes

  • Drill - Punch a hole in just about anything

  • Ferret - Attracted to your opponent's ships

  • Vampire - Sucks out power from a sun or opponent to add to your own

One last thing, We should have theme support, so people can “skin” the game however they want.

All of this should give Windows Presentation Foundation (WPF) a pretty good workout. If it can handle this game, we are golden.

P.S. - I have no idea what to call it. Any ideas?

Tuesday, February 6, 2007

Let's Make a Game

When I was in High School, about a million years ago, I went to a youth camp in the mountains with one of my buddies. We shared a tent and hung out talking about this and that. I told him how I had saved up my allowance and bought a book about BASIC programming (my sister thought I was out of my mind.) Since then I had been learning to program on my sweet IBM XT that Dad had brought home from work. So then my friend says, "hey, we should make a game together."

I had no idea what I was in for.

It didn't take like to figure out that the version of BASIC I had was pretty lame for cool games. So I got a book (can't live without 'em) and started learning C, then C++. We discovered the totally rad Fastgraph library, the amazing Watcom compiler (now open source) that let you run in DOS protected mode, and generally had a great time.

Life has changed and making games seems so daunting anymore when you look at what the big shops are turning out. But heck, some games like Scorched Earth are still more fun than some EA games I've seen. So what's a guy to do? Well, there is still room for smaller games. People call them "casual" or "indie" games now. And they can be super fun. Today's tools let you make nice looking games with about the same effort as the old DOS/Fastgraph-based ones back in the day.

So hey, let's make a game. This time we will use Windows Presentation Foundation because we can. Plus, it's a great excuse to learn the next-generation Windows GUI framework.

Learning Windows Forms wasn't a huge deal. You had the form designer in Visual Studio, and the programming model was similar to most other operating system GUI frameworks around.

Windows Presentation Foundation will get a Visual Studio designer later this year or early next year. In the meantime there is Expression Blend Beta 2 to play with. But how in the world do you program the thing?

From what I've seen so far, the WPF programming model is it's own cat. Windows Presentation Foundation takes a radical departure from the old-school UI programming model. Just imagine throwing Flash, DirectX, XHTML, CSS, and .NET into a big blender and hitting 'puree'. Now sprinkle a little HyperCard on top for that extra something special. Mmm. Tasty shakes.

This past week I started learning WPF. Microsoft has some free eLearning courses, but they are pretty basic and talk about everything from about the 10,000-foot level. Good online docs are hard to find, and looking at the Windows SDK Samples doesn't help much since the code is so wonky compared to anything I've done before (yes, I did just use the word wonky). Sure, you've got MSDN, but that is primarily a reference you use when you already have a pretty good clue of what's going on. Unfortunately, I'm oh-so-clue-less at this point.

At times like these, you've either got to go take a class, buy a book, or suffer through the agony of trying to figure it all out on your own. Well, I'd rather install Gentoo than take that last approach, and classes are just too expensive for a cheapskate like myself.

So I ordered a book, as I did when I was a kid and many times since (programmers love books - they stay up at night devising various devious ways to get more books) . Of course I had to get THE book, according to the reviews. Most of them went something like this: "Wow! You've gotta get this book! It is so awesome I can't believe it! I read it and now I can write cool apps and my girlfriend came back to me and I am going to run for president now and change the world with WPF because it totally ROCKS! Make Apps, not War!"

Right. So, we'll see if it's any good. I'll let you know.

P.S. - Stay tuned for next week when I will talk details about the sweet game we are going to use as our "experiment".

Friday, February 2, 2007

Windows Presentation Foundation and Games

Windows Presentation Foundation (WPF) blew me away the first time I saw a demo of it when I was at Microsoft. This is the biggest thing to happen to Windows UI since 1995. While making a pleasant UI with WinForms is about a gazillion times easier than with MFC, WPF makes WinForms look so boring. You know, like the PC man in the Apple commercials. Oops.

Not long after I learned about WPF, I came across a game by Mitch Walker called Mantis. Aside from a single blog entry and a sweet video, I haven't seen much else about the project since it was announced (and presumably shown at PDC 2005. If anybody has recent news, please do share. My guess is that he moved over to the XNA team at Microsoft and either abandoned the project or is in the process of porting it to the XNA framework.

Speaking of XNA, you might be wondering why this blog is not entitled "XNA Games" or something like that. For a while there was some buzz on the 'net about Windows Presentation Foundation being a potentially great platform for 2D/casual games. XNA sort of eclipsed all that. So why the heck would I want to try making a game using WPF instead?

I'll tell you.

WPF makes a beautiful UI, and blends it seamlessly with multimedia and 3D objects. Heck, you can even do particles. Plus, wherever you have WPF (in the .NET Framework 3.0 for XP, or preinstalled on Vista) you have Windows Communication Foundation (WCF). I'm absolutely drooling. WCF has built in P2P networking. Perfect for making your games reach out to the world.

Now throw in Newtonian for physics (source code here). Wow.

XNA? Well, UI is not it's strong point (font support is terrible, for example). Cool whiz-bang graphics are. And networking? No real-time goodness for you - bad llama! So it really comes down to the kind of game you want to make, and how you want to distribute it.

Join me as we explore the strengths and weaknesses of WPF. As for XNA... maybe next time.