Like just about everyone else, I have more things I'd like to do than time in which to do it. But for some reason, this seems to have been getting worse lately. I'm not sure where it came from, but long about November I actually started working weekends, writing an article for Chris Sells. Now, if you know me, you know that I'm not generally a guy to like working over six hours a day, let alone weekends. But I enjoyed it!
A lot of that is probably because I was working with Managed DirectX. Working with 3D graphics is so different from writing scalable systems (my usual speciality) that I had to more or less start over. It's good to be in unfamiliar territory - everything is new, and therefore cool. I mean, even the main application loop is different! I thought maybe I'd share some of my findings here.
You've probably heard of DirectX, Microsoft's COM-based game API. It's got a bunch of pieces to it: Direct3D for doing 3D graphics, DirectDraw for doing 2D graphics, DirectPlay for hooking players together in network games, DirectSound for doing cool sound effects, etc. etc. Well, Managed DirectX brings most of those things to the CLR programmer. What they've done is provided a set of Managed C++ classes that wrap up the API so those of us that like writing managed code can make use of all the nifty hardware-accelerated goodness that DirectX gives us.
I can't say that I'm sure what I think of MDX at this point. I've only just started, and while I have a pretty good grasp on the basics of Direct3D, the other areas are still a mystery to me. I'll be poking at DirectDraw next, to see if I can make sense of it, in pursuit of writing my presentation for WinDev East 2003. DirectSound is probably after that.
What's interesting about Managed DirectX - and Ted Neward heard me say this at a recent DevelopMentor retreat - is that Managed DirectX is sort of an oxymoron. I mean, think about it: DirectX, because it's letting you get at the graphics and sound hardware directly, for performance. But managed execution is all about isolating you from the details of what lies beneath.
So it's not entirely clear to me whether Managed DirectX will see widespread adoption or not. Will the added overhead of the CLR mean that people won't be able to write games in C#? Probably. But there are lots of other potential applications that don't necessarily require massive amounts of real-time performance, but which could benefit from the productivity enhancements. Things like architectural walkthoughs come to mind, since you might be able to prerender everything.
All I know is, it's fun territory to explore, since you can create some cool 3D stuff without all the mind-numbing bookkeeping required in COM and C++.
Next time: Direct3D: the basic game loop.