Random Thoughts

Tech, words and musings from an Englishman in Seattle

Open Source Theory - GDB Sucks

I have a theory that Open Source software is so good and stable compared to Windows software because Open Source debuggers suck.

This means that Open Source developers have to program defensively whereas Windows developers will rely on catching and easily debugging the bugs in the debugger.

Thoughts?

Memeflow Is Still Up And Running

My server was unreachable today for about six hours due to some hassle at the colo, but I was reminded that Memflow, a service I put together in 2005 as an experiment, is still being happily used by quite a number of people.

I was reminded because I got a bunch of email from quite a number of people wondering why their favourite “start” page was down!

Sweet!

If you're looking for a fast, image-free (ok, there's an RSS icon) start page, may I suggest you give Memeflow a try?

Here are some posts about the site from a while ago.

Testing On The Toilet

Since I joined Google, I've been incredibly impressed by the focus on testing. You've probably heard that you can't escape even when you're in the bathroom - the test team post flyers in the stalls and in front of the urinals with useful testing hints.

Testing on the Toilet

Well now you get to see them too! The Engineering Test Team have opened them up on their new public blog.

We're unveiling the public release of “Testing on the Toilet”: one of Google's little secrets that has helped us to inspire our developers to write well-tested code. We write flyers about everything from dependency injection to code coverage, and then regularly plaster the bathrooms all over Google with each episode, almost 500 stalls worldwide. We've received a lot of feedback about it. Some favorable (“This is great because I'm always forgetting to bring my copy of Linux Nerd 2000 to the bathroom!”) and some not (“I'm trying to use the bathroom, can you folks please just LEAVE ME ALONE?”). Even the Washington Post noticed.

Subscribed.

Murky Direct3D History

I really need to sit down and write a history of Direct3D from day one, i.e. pre-Microsoft acquisition of RenderMorphics, through to around DirectX 6.

The anti-Microsoft venom that still surrounds the whole OpenGL v Direct3D wars still hurts - we honestly we're trying to (and did do) the right thing. Even the Wikipedia article I just linked to has unpleasant bias…

I still posit that the state of consumer 3D would not be what it is today without Direct3D appearing on the scene.

And OpenGL would still be in the same stagnant state that it was in 1995.

Anyhow, this little outburst was due to a comment on a blog I happened to stumble on.

Not quite a happy ending. OpenGL was totally shot down by Microsoft, who used its monopoly in the desktop OS market to push DirectX instead, a propriety Microsoft graphics library. Had they embraced openGL, we would be seeing good games on all platforms, not just Windows.

Lots of high-profile game developers signed an open letter to Microsoft, including John Carmack (who may have even authored the letter if I memory serves), to ask Microsoft to embrace OpenGL for the good of the industry, the developers, the games, and most of all, the consumers.

Of course, Microsoft wouldn't listen, and used their power to push out OpenGL and gain market control, as per their traditional modus operandi.

Sorry to be Debbie Downer, just wanted to point out that the ending isn't so happy after all.

To which I responded:

Regarding Zach's comment - Not to totally thrash a dead horse or anything, but I was the PM and oddly enough one of the developers on Direct3D and it's predecessor, Reality Lab.

We did not set out to “kill” OpenGL. OpenGL was stagnant, did not run on commodity hardware and had laughable realtime software rendering support. I posit that if it were not for Direct3D giving the 3D graphics hardware industry a kick in the arse, we would not have the games we have today and OpenGL would still be stagnant.

At the original PDK outing of Direct3D, all the 3D hw guys really had no idea what was going on - they were all aimed at arcade and military applications. No one was focussed on the consumer.

I wish people would look at that time objectively and not with “MS hate” in their eyes. Hmm, maybe it's time I wrote it up.

btw - it was Chris Hecker that authored the letter.

Time to sit down and write that history post…

A Little Impact

So while I've been working on the other big thing. I've been getting my hands dirty on the frontend. Most of what I've been up to in this realm has been basically learning how stuff works. In my estimation the best way to figure out how something works is to actually roll up your sleeves, write some code and ship it.

So I present to you the “Play again…” button. Not much, I know. But it was educational. Go and watch a video through to the end and you'll see it…

Hey, at least somebody picked up on it :-)

Tags: , .

Google Video

A number of people have been asking what I'm working on, so here's a pseudo-answer…

I can't say exactly what I'm working on, because it's incredibly cool :-) But I what I can say is that I'm working on Google Video, in the team that develops what we call the Video Frontend. That's what you see when you go video.google.com. Well, that's my 80% project - I've got ideas about the 20% one…

The majority of work on the frontend happens here in Kirkland, and it's a great team of very talented engineers.

I.e. it's a cool group of developers that I happen to find myself in.

It's a very interesting environment - with development encompassing the gamut of what it means to “deliver video”. Plus the fact that I've only been here a few weeks and some of my “getting my hands dirty” code is already live :-) Actually, the first little bit was live within a few days of me joining the group…

“Shipping software” really has a new meaning at this company. I love it!

Tags: , .

Who Knew?

Today I discovered that C++ standard defines support for using 'and' in place of '&&', 'or' instead of '||', 'bitand' for '&' and a few others. Who knew?

I must say that I'm not particularly sold on the idea - it makes code kinda unreadable. Consider the following code snippets which are equivalent:

if ((num_things and (num_other_things > 0)) or is_one_more_thing)
{
    DoBlah();
}
if ((num_things && (num_other_things > 0)) || is_one_more_thing)
{
    DoBlah();
}

Personally, I think the second is more readable as the logical operators break up the alphanumeric expressions - the problem could get really bad with complex expressions and highly readable variable names.

But maybe it's just me…

Make Your Own Xbox Game?

I've been holding off on commenting about the XNA Game Studio Express announcement because I didn't want to sound like a wet towel, but enough is enough :-)

Let me preface this with the fact that This Is A Good ThingTM, but lets take it for what it is.

Microsoft have enabled anyone to write code for the Xbox 360, and deploy it locally to your own console. Yes you can share the fruits of your efforts with others who have also subscribed to the service, and only in source form. I'm sure this will change in the future, but AFAIK, you can't share the compiled final product with your mate who isn't a developer.

Ok, so with that out of the way, here's the other thing.

It isn't going to come with Will Wright in the box. That's right folks, pesky things like game design, art creation, and coding mojo are still issues.

There won't be a “Make Triple-A Title” button.

I'm sure that XNA Studio will provide a ton of graphics clip art, sample models, and sample code, but there aren't going to be sample game designs, sample cool new ideas or sample innovative game mechanics.

Oh, and one more thing. Anyone can make a game with their PC right now. Just download Visual Studio Express - it's free, or maybe pick up a copy of Torque Game Builder from Garage Games - it's only $100.

What Microsoft have done is provided a cheap way for hobbyist (or cash strapped indie) game developer to target the Xbox 360. This is a good thing - it was very expensive beforehand. I'm sure that a few of these titles will be picked up by mainstream publishers, or Microsoft itself.

Just don't expect thousands of high-class titles to start rolling out of basements anytime soon. It's just another platform. Albeit a cool one.

Now, where do I sign up? :-)

Programming Language Fun

Greg Costik recently posted about some fun programming languages including one who's syntax is entirely expressed in whitespace

Being a bit of a language geek, my favourite, and the one I always point people toward is SPL, the Shakespeare Programming Language. A good overview is here.

For example, here's a program to add two numbers (taken from the overview):

pre..

Romeo, A character to store the sum.

Juliet, An admirer who helps to calculate the sum.

Act I: A simple play.

Scene I: Juliet's conversation with Romeo.

[Enter Romeo and Juliet]

Juliet: Listen to your heart!

Romeo: You are as beautiful as a sweet red rose.

Listen to your heart.

Juliet: You are as brave as the sum of me and thyself.

Open your heart!

[Exeunt]

Wonderful.

Audio Acceleration on the GPU?

This post, ATI eyes audio acceleration on the GPU, had me remenicing about the early days of Direct3D again.

What most people don't realize is that in the early days on Direct3D many of the 3D accelerators (or sometimes “decelerators”1) where in fact very general purpose DSPs. At that point in time (mid-1995) many of the hardware guys were very surprised at the rapid mindshare growth of consumer 3D hardware. We're talking people like Evans and Sutherland, SGI, etc…

Brief interlude.

Regarding Direct3D and the following OpenGL v. Direct3D wars, one point I feel is worth making is that if it were not for Direct3D, we would not have the gaming platforms that we have today.

In 1995, 3D was stalled, noone was innovating and OpenGL was stagnant. It was only after the release of Direct3D that OpenGL started to make any headway.

In fact, at lunch during the hardware guys' day at Aftermath event, we put a pre-release PS1 on the main video screen running Tekken in demo mode. You could see the palpable fear in most of the hardware guys' faces. “What is that?” “That's not realtime.” These guys, with very few exceptions, were missing the boat.

End of interlude, now where was I?

Many hardware startups in the Valley at that time were putting together DSP based ISA (or even the new PCI) boards to offload modem, audio and other functionality from the overwhelmed CPU.

These guys recognized a good thing when they saw it and decided that they could add 3D graphics too. It's all just vector math isn't it?

The Chromatic Mpact part was a case in point. It was a modem, an audio card and a 3D accelerator all rolled into one! Step right up! Well, until you tried to run a few thousand triangles per second through it. Mind you, they had some very cool booths at the shows.

None of the parts of this generation performed triangle setup (apart from the 3DFX Voodoo 1) and they all sucked to one degree or another.

But a special place in my heart is taken by the Rendition Veritee 1000.

Rendition was a true entrepreneureal company built by engineers. Those guys were great. They were the only guys to have hardware ready for Comdex 1995 where we (or rather Ty Graham, our hardware evangelist) showed hardware-accelerated Direct3D for the first time.

Servan (one of the founders of RenderMorphics) and I had locked ourselves away in an office on campus after the Aftermath event and we had a week until Comdex. We finished the driver model, an API that could drive it and had the famous2 “tunnel” sample running on it.

But for a driver model we needed a driver and some hardware. Here was where Rendition really stepped up. One of the guys from Rendition came up to Redmond and basically lived with us. He was writing driver code while we were writing the driver model. Talk about bleeding edge.

The prototype, hot off the chip foundry, V1000 was mounted on a red prototype board with a fan glued to it. Unfortunately, when plugged into the bus on the machines we had, the board was upside down and every hour or so the glue would melt and the fan would fall off. Much hilarity ensued. Much pizza was eaten.

At four in the morning on the first day of Comdex, Ty walked into the office, already late for his flight to Vegas, and witnessed tunnel running at lightning frame rates. We packed up the dev machine in a flight case and off he went - by all accounts everyone was awed by this cheap piece of consumer 3D hardware.

I still have that board.

But that's not the point of this narrative.

The point is that the V1000 was a DSP based part that stored it's microcode in it's onboard memory in an address space just below VGA memory.

Which meant that any bug in the driver, especially the clipping code, caused Direct3D to render triangle fragments all over the microcode. It didn't just blue screen. Can you say hard lockup, push the big red reset button?

And here's my other point. Man, was that fun.

[Thanks to Ars Technica for the link.]

1 This term was originally applied to one the first parts out of S3 and I think, ahem, that I coined it… 

An OSX Unicode Challenge

Say you have a unicode string that contains a full path filename.

Now, open that file.

That's it. That's the challenge. The filename must not be converted into a non-unicode form and you must use the Carbon APIs. No dipping into Posix and non-unicode land.

Bonus points for the fewest API calls and shortest code.

Of course on Windows it's just one call - CreateFileW(), but for the life of me I can't figure out how to do it succinctly on OSX.

Unicode On OSX

I admit that the last time I did any active *nix development was over ten years ago, when Unicode was just a dream, but can anyone explain to me why Unicode development on OSX is such a cluster?

Joe and I were discussing strings today and the fact that as engineers we go to extreme lengths to avoid having anything to do with them.

Windows Unicode support just works and the APIs are very orthogonol, but in OSX it just seems to be all over the map Char256, UnicodeChar, blah di blah.

Oh and wchar_t is 4 bytes. What's up with that?

Basically we're looking for XML parsing support that is API compatible across all platforms and Unicode aware. Expat is our current foundation of choice, but it just doesn't work compiled for Unicode on OSX, buts runs perfectly on Windows.

Note that I'm not ragging on expat - it's a fine library and Joe has been talking to it's author, but apparently no one has tried to use it that way before.

Looks like we'll be making our first contribution to an Open Source project.

Anyhow, anyone got any rationale or pointers?

OS X Developer Tools

Am I missing something?

Now that CodeWarrior appears to be dead as far as Mac development goes, the only option appears to be Xcode - the free development toolsuite shipped by Apple.

Now, leaving aside the fact that Xcode's UI and workflow appears to have been written by a monkey on acid, it does appear to work fine, with one exception.

The debugger.

Now, gdb is a fine debugger, but it is basically a console based debugger and works fine when used in the environment for which it was designed. I cut my debugging teeth using gdb back in the '80s. In fact, I had to build the remote end of gdb for the Amiga so that I could do some cross-complilation game development.

But that's another story.

Xcode uses gdb as it's debugger, thinly veiling it with some shoddy UI that is constantly getting itself out of sync and generally not working well. Especially when you're working on multi-threaded code.

Now, I'm also a big user of cdb/ntsd on Windows - again, console debuggers. But their usage has a time and a place. Productivity is vastly increased by great visual debugging tools.

This is where Microsoft completely shines. Visual Studio is a great debugger - say what you will about the build tools, language support, etc… but VC is a great debugger for user-mode applications.

This is why Windows is the platform that it is. Microsoft gets it. To get massive developer support, you need great developer tools1. If Apple wants massive platform support from the developers, they've got to improve the Xcode debugger. Like, actually provide one.

As a developer, I don't want to be beating my head up against the wall because of the tools, and unfortunately Xcode is giving me a nice, shiny, bruise on my forehead.

And don't get me started on the Carbon SDK, but I think that's a post for another time…

1 Coincidentally, this is why the Xbox 360 is a far easier platform to develop for than the PS3. 

© 2001 to present, Steve Lacey.