This is one of my favourite tracks from Gareth. I can almost see the rolling wheat fields and farmers standing by a mill, wondering who could help them with their insane quests.
PS. We've got the way the music works pretty much figured out, I'll write about that a bit later.
In case any DirectX programmers happen to spot this, I wanted to share a warning about using the D3DX library. It's evil, and I'm going to stay away from it!
D3DX is a helper library for DirectX, it's got math helper functions, functions to start up Direct3D, text rendering functions, and perhaps the most widely used is the method to load textures from a file.
Several years ago Microsoft made the D3DX library a DLL that's distributed with the DirectX. Here's something you may not be aware of, they make several versions of DirectX each year. Each comes with it's own version of the D3DX library, and doesn't work with the previous versions. Say, I download the June 2010 DirectX SDK. Then Driftmoon will require at least the June 2010 version on each computer to play the game. Pretty nasty, isn't it?
What Microsoft wants us developers to do is make our game installers also install the new DirectX. It's easy to cram it onto a DVD, but not so in a downloadable game. For downloadable games you can even try installing just the bits your game needs, but I've never got it working reliably on all computers. And what if I don't want to include an installer?
Since I want Driftmoon to run as reliably as possible, I decided to ditch the D3DX library completely. In a week I remade the text rendering functions using regular Windows GDI text rendering, and I remade the texture loading function using the LibPNG and IJG libraries to uncompress png and jpg files. It was a pretty simple matter - and now I've got the code where I can see it.
I've finally finished work with the new starting level! It's been a lot of work, you can tell by the amount of chocolate wrapping in my recycle bin.
(Minimap for the crypt level)
To celebrate this I wanted to highlight some important features we've finished recently:It's been bugging me for the last couple of weeks. On my computer the game runs fine, on some other computers it crashes in some seemingly unimportant code. After scratching my head for way too long (I hope I'm not going bald because of this!), I got to the root of the error (Thanks for the help Gareth!).
Firstly it was crashing in some DirectX matrix code, namely the D3DX helper library. Why would it crash on every other computer, and work on every other - even with the same input? Because I have an AMD and the crashing computers had Intel. Internally the D3DX library does things differently depending on the platform it runs on. Apparently the Intel version did something different with floating points, and crashed nicely whereas the AMD version didn't mind.
Quite possibly it's my fault, some bug in my code most likely. It's nearly impossible to test it though, I don't have any Intels at home to debug with. Oh well, doing simple matrix mathematics in a completely separate DLL is a bad idea anyway. Even Microsoft admits this, since they're encouraging users to switch over to their new XNAMath library which uses inline code instead of DLL calls. Moving over to XNAMath should fix the problem, since it doesn't have separate code paths for different processors. But honestly, Microsoft could have told me about XNAMath in March, and saved me a couple of weeks.
Update: The problem has been solved, and now the game will happily work on Intel platforms as well.