By Alec Meer on August 3rd, 2011 at 2:29 pm.
“Oh God, not again – can’t I just play the damned thing? WHY? [Stomp, stomp, stomp."] This is a sound surely as familiar to the residents of the Brunswick area of Brighton as are the constant squawks of seagulls fighting over the contents of their recycling boxes. This is a sound I make, or at least variations upon it, every single time I first run a game I have downloaded via Steam. This time, I always think. This time it won’t ask me to install DirectX again first. Surely the 1023rd time’s the charm. That dream will likely never come to pass. However, at least we now know why – Valve have explained this particularly modern annoyance.
It’s to do, apparently, with the design of DirectX itself. Says John McCaskey, a software engineer on Steam, in response a forum post lamenting the need to apparently install DX every time:
“This is not a matter of making sure your overall DirectX install being up-to-date. Microsoft has a helper library with D3D called D3DX. There are over 40 different versions of the D3DX library for D3D9 alone, and many more for D3D10 and 11 as well. Each game that uses the D3DX helper library is linked to a specific version. As such the game must run the correct D3D installer version that it was specifically compiled with to ensure the binaries exist. Even if a later version of the binary is already installed, that version cannot be used, and even if your DirectX install is up-to-date because you’ve run a more recent version of the installer that is not guaranteed to have installed all previous versions. Even worse, if a version is installed for x86 it doesn’t guarantee the same version is installed for x64, so 64 bit and 32 bit games may need to run the same exact installer version but targeting different platforms when run.”
This is ultimately to our benefit: “The code to check correctly and repair broken installs all exists in the installer and running it is a guarantee that the correct binaries will exist when you run the game and prevents lots of bad cases where a game would fail to launch with an obscure error if a windows install was either missing the correct version or somehow corrupted in the past.”
Dependencies may also change every time a new version of DirectX is released. On top of this, Microsoft prevents anyone else from distributing standalone DX files themselves, so “the only way to distribute them is to run the installer, that’s also the only supported method from Microsoft to check that the correct version installed.”
Some games, such as Valve’s own Source titles, require only the core DirectX to be installed, and thus don’t require the install process the first time you run them. There are apparently theoretical ways to have Steam check if the precise DX files are installed by any other game and share them with whatever new one is demanding them, but this creates a lot of hassle for developers and might result in tons of duplicate DirectX installs.