Wednesday, December 27, 2006

Christmas Software Shenannigans

Is that how you spell "shenannigans?" Oh well.

Received a nifty lil iPod nano this Christmas. An obvious conundrum hit right away... my entire music library is formatted & encoded using Ogg Vorbis. iPods use AAC or MP3's.

Amarok - KDE's killer app - has great iPod support. Of course, the gold standard for iPod support on Linux remains gtkpod - an app that allows your little fingers to get into every facet of your iPod's filesystem layout. But Amarok makes me so tingly inside it's hard to express.

For example, Amarok can transcode your files on-the-fly. Are all your files in Speex but need them in MP3 format for your digital player? Just queue your files in Amarok's media device browser and it will automagically convert your files. Everything in Vorbis but you need AAC? TransKode will take care of it for you.

Not to mention Amarok now has an in-browser music store: Magnatune. I freakin' love Magnatune. The fact that it's now tightly integrated with Amarok makes me giddy.

But there are a few problems. I was up until 1:30 AM this morning trying to get transKode and Amarok to play nicely... there were so many uninstalled dependencies it wasn't even funny. And were there error messages? Nooooooooooooooooo.... I had to go and track down faac, vorbis-tools, gdkpixbuf, blah blah blah. After I made sure every possible package was installed, I was finally able to get Amarok to convert files automagically. I can't blame SuSE for not installing those dependencies... transKode is a plug-in to Amarok after all, and installing every possible dependency for Amarok would suddenly make it heftier than GnuCash.

Even with these limitations, Amarok is suiting my needs much, much better than iTunes. I don't think I'd be able to do jack nor squat with iTunes, considering it can't transcode my library. Next stop is trying to get contacts, calendar, to-do lists and notes to sync. But I've only filled up 10% of my 4GB so far. w00t!

Speaking of software, I'll stop my openSUSE 10.2 after this post. Several may have noticed Hubert Mantel is coming back to SuSE, which I hope is a good omen of things to come. The distribution has slipped since he left, so I'm hoping he can bring things back on course. I must say however - the bug reports I've filed so far have been resolved promptly. They're triaging bugs well. There are some pretty stale ones, like Evolution not running correctly in KDE. But by comparison Ubuntu has had an outstanding bug for what seems like an eternity that's stopping me from switching over: not mounting encrypted partitions at boot time.

openSUSE is going well now... dual-monitor support is working flawlessly now, SCPM is helping me effortlessly switch between home and office, and Amarok is allowing my expansive music collection to survive on my iPod. Hard to complain at this moment.

Monday, December 18, 2006

Sloppy SuSE

Have you seen Novell's "improvement" on the KDE menu? Have you seen the quotes around the word "improvement"? I have no idea what they were thinking. Reading the openSUSE site they claim the menu was the brainchild of hundreds of hours of usability study and research, examining every minute detail of user interaction. And yet they came up with a menu that takes 50 clicks to launch an application. Riiiiiight.

I just spent the past three days trying to get dual monitors working with the very insipid ATI card in my Latitude D600. Bear in mind, this isn't the first time I've tried to get a Xinerama-like "bigdesktop" setup working with this machine. Nope. I've had one since I've owned this machine, which is going on two and a half years. And yet, with every OS install on this machine, I've had to wrestle with getting the ATI drivers to obey. It's absolutely ridiculous.

The crazy thing is that we're not even talking about different driver versions. From XFree86 to XOrg, things have behaved weird or wacky in different ways. The only version of the driver I can run is 8.28.8, and even that would be unavailable if it wasn't for K's cluttered loft. 8.29.6 causes the LCD on my laptop to slowly - and I'm not kidding here - burn and bleed pixels. 8.32.5 won't even detect a screen. It's a pretty sorry state of affairs, especially considering 8.28.8 won't even work with XOrg 7.2, which is what SuSE 10.2 ships with. I have to backport to XOrg 7.1, install the 8.28.8 driver, then hack the config file.

Don't even get me started about the xorg.conf file. Even though my version of the driver stays the same, with each SuSE release the file has to change. Release before last I had to tell it my "DesktopSetup" was "0x00000000". Last release I had to ForceMonitors to be "auto,auto" for some unexplained reason (actually specifying the monitors wouldn't work). And in this release I had to specify ForceMonitors to be "lvds,tdms" and explicity specify the HSync2 and VRefresh2 of the monitor in the "Device" section. If I didn't, it would either never turn the monitor on, choose an incorrect frequency or choose a lower resolution.

If the above sounds like absolute rubbish, you're absolutely correct. And SuSE isn't the cause of the problem... it's ATI. Ubuntu, Fedora... they'd have the same problem. It's just that ATI doesn't feel like they need to adhere to "standards" of configuration at all, and their driver is simply unstable and, at times, unusable. The lesson: never, in your life, buy ATI hardware.

Friday, December 15, 2006

Send SuSE Back...

I upgraded my desktop and laptop to openSUSE 10.2 this week. Wow. Bad wow.

First off, ATI's support of Linux drivers is still abysmal. Not only are their configuration files whack, but they can't be composited, don't support Xinerama (on my laptop at least) and are a pain to install. SuSE ships with a release candidate XOrg 7.2 (because they are really into Xgl and composite extensions), and ATI wasn't ready to support it yet... probably since it hasn't been released. And yet, ATI quickly updated their driver. Still, with my laptop, neither the newer driver nor XOrg 7.2 run. I had to down-port to 7.1, then find an elder driver and use that. Hacked, ugly and it wasted a day and a half of hacking.

NVidia support still isn't much better. When the computer first starts post-install, you get nothing but a blank XWindow. Nice. You actually have to install the NVidia proprietary drivers first, then you can run your window manager. WTF?

As for sound, that was also borked. My laptop did fine with the install, but with my AMD64 desktop sound didn't work at all unless I was root. For some crazy-go-nuts reason, my users weren't in the "sound" group and didn't have permission to access /dev/dsp. So that was fun chasing down.

The Gnome people love messing with my head. Now they've created a keyring manager not unlike KWallet except, just like everything else for Gnome, it's far too convoluted. Evolution uses it to obtain passwords, however OpenSUSE doesn't open the keyring properly prior to launching Evolution. So I have to resort to an ugly, dirty hack for it to work.

So let's sum up here before I rant too long. My desktop wouldn't work immediately after install. Evolution didn't work. My laptop could run on the open-source drivers, but no luck on dual-monitor configs with the proprietary driver. Sound took hacking to work on the desktop. I think we need to let the original SuSE have their distro back - they always polished things to a nice sheen.

On the upside ODE 0.7 is automagically included it seems. So at least I have a standard ODE to develop on / release with. Also Novell has admitted to ZEN sucking - and they've offered alternatives. Although their really horrid ZEN update is still the default. Encrypted partitions work exactly as they should, and NetworkManager works as well.

Hopefully even though openSUSE 10.2 was off to a really rocky start, it will be smooth sailing from here.

Tuesday, December 12, 2006

Trapped In The (Triganometry) Matrix

When everyone in intermediate school asked the math teacher "why the hell should we spend four months on matrix math," he should have looked directly at me and said "because, chuck, you'll need to know how to rotate sprites in both 2D and 3D space, otherwise your code in the future will suck." I would have listened then.

I was finally able to get Qt to properly apply a bitmask to my QWidget, so I can now have a window open that tilts at a 45 degree angle. I've got to start thinking Π/2... ODE works in radians, Qt in degrees.

There's a number of differences between Qt and ODE that can be a real pain in the butt. ODE's screen coordinate origin is at the bottom-left of the screen (or world)... which I guess kinda makes sense for physics coordinates that want to model themselves after the real world. But Qt uses what everyone else in computer-land uses: an origin at the top-left of the screen. It's whack. That means counter-clockwise rotations in ODE land are clockwise rotations in Qt land. Increasing your values of y send you up in ODE, down in Qt. Normals face one way with ODE, the other way with Qt. Blech.

A big tip o' the hat to Stefan Waner and Steven R. Costenoble for their Finite Mathematics page. Also big thanks to Columbia College of Missouri for reminding me how to reduce a matrix in my head. Without them I wouldn't have been able to remember how to invert the rotation matrix and easily convert ODE rotation matrixes to Qt rotation matrixes.

Friday, December 08, 2006

Computer Science Isn't Science

...it's math.

The inside joke in universities is that if a subject has the word "science" concatenated onto it, it's not really a science. "Social Science" isn't a science. "Computer Science" isn't a science. Physics is. Chemistry is.

I think it's true. What's now "Computer Science" (or in other completely nonsense realms, "Informatics") is really mathematics. I think a lot of modern colleges and universities are getting it completely wrong... don't put CS in with engineering, vocation or *gasp* business. Put it where it belongs.

The knowledge and understanding of algorithms is what separates decent coders from great ones. Nowhere is this demonstrated better than on Beyond3D's Origin of Quake3's Fast InvSqrt(). Here we try to trace back a very elegant, fast and extremely effective five lines of code to its original author. The understanding and anthropology of this Newton-Raphson inverse square codification acts as a veritable who's-who in 3D real-time rendering, from Carmack to Gary Tarolli.

Take a look at "Exceptional lC++", reviewed by the good ol' Register. This is not just a trove of complex but simple C++ snippits - it can be a litmus test for those rare C++ hackers that can change the physical properties of the world with a mere wave of their hand.

For those of us who are still on the intermediate side of the scale, S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani have been releasing drafts of their textbook, "Algorithms," to the general laudations of the programming populous. It really is a fantastic resource, if for no other reason than to have such a nice reference on-hand on-line.

Friday, December 01, 2006

So You Want To Be An Indie (Console) Developer?

I love Andre' LaMothe. How could you not? I remember how completely... dork-filled I felt when his copy Black Art of 3D Game Programming arrived at my office. Well, not really an office. At the time I was a consultant working for a local home builder, and they had shoved me into a 12x12 room with another consultant doing crapwork with MS Access. I was so incredibly psyched when the book came in, but received odd stares from my fellow outsourced monkey when he saw the uber-dorkcover that emblazoned the tome. It looked more like someone's AD&D ruleset guide than a programming book. I immediately put it back in the box and reserved it for reading in the bathroom and attics.

But since then Andre' has not only cleaned up his book covers but released some interesting products. Not software, as some would expect. No... Andre has gone decidedly hardware, by selling do-it-yourself consoles that hackers and hobbyists alike love dearly. He started with the XGameStation, a kit made for the hardware-centric folk who wanted to know how their console ticked. They could build, from the ground up, their very own console with whatever hardware they liked. His latest release, the Hydra Game Development Kit, is more about how you create software that stays as close to the hardware as humanly possible. The Hydra looks like a fantastic lil' learning tool - it keeps would-be programmers close to the metal.

In a world of fifth-generation languages and programming high-level meta-languages, having to be mindful of registers and opcodes is definitely needed. Java protects you from worrying about memory allocation, but you still need to remember memory allocation. But people forget. This is a nice return-to-your-roots tool that keeps your code-fu sharp. Gamasutra's Q&A with Andre' has a great quote:
You can’t imagine the amount of ownership and excitement someone gets from building a small computer and writing every single line of code that controls EVERYTHING on the system including the raster and TV signal. There is nothing like it.

True dat.

Stop It With The Extra Cores Already!

Game programming is a very monolithic and event driven. I should restate that... it has been very monolithic and event driven. And now with machines like the PS3, there are five bazillion (slower) cores on a CPU die instead of a single, long-pipeline overclocked processor. So if you're going to see any speed bumps in your code, you need to find a way to separate your engine logic out into multiple threads.

This is hard, mainly due to resource contention and scheduling synchronization. Gamasutra has a very down-to-earth and easy to read article of the different multithreading architectures developers are evaluating, along with the pros and cons of each.

To see how someone has actually implemented these architectures, or hybrid versions of them at least, one can look at how Valve has threaded their system. Not only did they have to make their events more atomic, they had to re-order and redesign their entire render pipeline. I still don't quite get how one can do animation in a separate thread (you'd think it would need to be synchronized with shading/rendering/drawing/blah), but the results do seem impressive.

The crazy thing was that they said threads spent 95% of the time reading memory, 5% writing. That's insane. But again, the results speak for themselves.