Why Do So Many PC Games Still Use DirectX 9?
A Brief History
Microsoft released DirectX 9 to the world at the end of 2002 (source - Wikipedia). It had many enhancements over previous versions (most notably fully programmable vertex and pixel shader pipelines), and has proved to be a very popular graphics API with PC game developers.
Over the years, DirectX 9 has recieved several minor updates, culminating in DirectX 9.0c in 2004. This eventually became the graphics API for the Xbox 360 with a few enhancements specifically for that hardware, further extending its reach.
Since then, DirectX 10 was released with the launch of Windows Vista in 2006, and DirectX 11 with Windows 7 in 2009.
PC Games Today
Most PC games released today still use DirectX 9. For example; Portal 2, Fable III and Crysis 2 were all released in 2011 and all use DirectX 9 as their graphics API (though in Crysis 2's case there is a DirectX 11 patch available, offering graphical enhancements as seen in this pretty video). The only major game I can think of that does not support DirectX 9 at all is Battlefield 3 (source - Battlefield 3 Blog), though that game has not been released yet. A lot of games from the past few years do support Directx 10 or 11, but almost all of these also support DirectX 9 as well.
This pattern is contrary to the behaviour of game developers for previous versions of DirectX, whereby most would jump onto the new version as soon as practical. So why is this?
In my opinion, there are several reasons for this. In no particular order...
- Windows XP - DirectX 10 was the first version of the API to completely break backwards compatibility. It will only run on Windows Vista and Windows 7. This was necessary due to a fundamental change in the driver model for DirectX, but as a result of this, adoption of the new technology was slow. For a game to support only DirectX 10 in 2006 when Vista was launched would have meant losing almost all of the game's sales as the vast majority of gamers at the time were still using Windows XP. However, this is changing fast as Valve Software's monthly Steam Hardware Survey (probably the best publicly available source of information of this type) shows that less than 20% of gamers were still using Windows XP in June 2011 and the figure is dropping. Personally, I think now is the time for games to be written using DirectX 11.
- Xbox 360 - A lot of games are released on multiple platforms. For games that are on both Xbox 360 and PC, it makes sense to use DirectX 9 on both versions to minimise the work required rather than maintain two separate graphics engines. On the other hand, it is tricky to do some things with DirectX 9 on PC that are simple on Xbox 360. For example, on Xbox 360 it is simple to read a depth buffer from a shader, but on PC with DirectX 9, you have to resort to either writing depth to a second R32 format texture (which is slow) or using driver hacks such as the INTZ texture format and then deal with different graphics cards separately. This issue is (of course), solved in DirectX 10/11.
- New driver model - Due to the change in driver model for DirectX 10, all the graphics card manufacturers had to write new drivers to support the new system. This resulted in bugs and performance issues in DirectX 10 games at the time. This is entirely understandable as any new complicated piece of technology is bound to have teething issues (and the issues have since been solved), but it feels as though DirectX 10 gained a (perhaps undeserved?) poor reputation along with Windows Vista. When Windows 7 was released, the new version of DirectX was numbered 11, rather than 10.2 which perhaps shows that Microsoft was aware of the perception and wanted to make a clean break.
- DirectX 9 was revolutionary, Direct X 10/11 are not - What I mean by this is that DirextX 9 opened up a wealth of new graphical possibilities. The ability to write long HLSL shaders meant that games suddenly had the ability to use more sophisticated lighting models, more varied materials and post-processing - all with some quite straightforward programming (and a good understanding of maths). There are many DirectX 9 games that simply would not have been visually possible beforehand (ignoring OpenGL for the purposes of this post!). For this reason, DirectX 9 is still visually good enough for modern games. DirectX 10 and 11 have added new features - geometry shaders, DirectCompute, tessellation, etc, which are all good, but not the technical leap that DirectX 9 allowed. For me, most of the new features of DirectX 10/11 are designed to make things easier for developers or enable performance increases, rather than adding entirely new graphical possibilities. I think the improved graphical features of the recent DirectX 11 patch for Crysis 2 are probably mostly possible in DirectX 9, though would either have been a nightmare to implement, or would have been very slow at runtime.
- Perception that a new DirectX means buying a new graphics card - This is only partially true - it was true for DirectX 10 which mandated a minimum feature set, but DirectX 11 has added a new feature to allow older graphics cards to be used. To take advantage of the latest features of DirectX 11 (e.g. hardware tessellation), you need a graphics card that implements those features, but it is entirely possible to run DirectX 11 games on older hardware so long as the developer allows it using the correct feature level. For example, the developer can test for the supported feature level and replace tessellated geometry with normal mapped geometry on hardware where tessellation is not supported. I am developing my own game engine with DirectX 11 using a GeForce 8800 GTX (a DirectX 10 graphics card), and I can even support older DirectX 9 level hardware if I want to (Steam Hardware Survey says YES). The feature level system in DirectX 11 allows me to simulate older hardware and the debug layer will warn me if I try to use a feature that is not available on that level. However, I have not yet tried a real DirectX 9 graphics card with my engine, so I'm using this feature on faith for now. I'll find out for sure when beta testing begins.
Like the Battlefield 3 team at DICE, I'm writing my game engine using DirectX 11, and have no plans to write a DirectX 9 version. I'm doing this mostly for the ease of use and flexibility of the newer API as I can literally build the game quicker without worrying about different driver hacks for different graphics cards. Also, over 80% of PC gamers can theoretically play my game (according to the Steam Hardware Survey) - certainly an even greater proportion by the time my game is released. The reasons I've listed above for the extended life of DirectX 9 are mostly historical and I don't think they apply for a game engine written today. I read a quote (I forget by who I'm afraid) from one of the presentations at GDC this year from developers saying that they write their new graphical features in DirectX 11 first, then port across to the Xbox 360 and PS3 as it it easier that way and allows their PC versions to shine (rather than just be a port of the Xbox 360 version).
Let's give DirectX 9 a nice retirement and let it live the rest of its time in peace and quiet - undisturbed by us pesky game developers!