what is DirectX in game programming?.
DirectX is an API or Application Programming Interface. It acts as an intermediary between the video games’ programming code and the hardware used to play them. Without DirectX, playing video games wouldn’t be as painless as it is today, but what is DirectX and why is it so important?
DirectX Is an API, but What Is That?
We said that an API is a software that allows games to interact with hardware, but that’s a big oversimplification. After all, hardware drivers that interact with the operating system can also be described in the same way.
What the API does is standardize a catalog of commands and functions that game developers can request from the computer hardware. It is the software layer between the game and the hardware that translates the two “languages” spoken by the game and the hardware device.
To be more precise, the API refers to the hardware drivers on behalf of the game, and since both the game and the hardware drivers were written to be DirectX compatible and not directly with each other, this means communication is seamless.
If you want to take a deeper look at the API, HDG explains: What is an API? great place to start.
The Bad Old Days Before DirectX
So we’ve established that DirectX is the API that sits between the game and the hardware it needs to run, but why can’t a video game communicate directly with a video card, sound card, etc.?
That is exactly what happened. In the days of MS-DOS and the early days of Windows, video games interacted directly with hardware drivers.
The problem with this approach is that the game developer had to write code for each individual product or product family. If you’re playing a classic MS-DOS game today, you’ll see entries on sound cards for brands like Creative SoundBlaster or AdLib.
These were the most popular sound card brands, so game developers could reach most customers by supporting them, but not all. Eventually, lesser-known hardware manufacturers will create products that are compatible with the same drivers as well-known manufacturers. This is why we had so many Sound Blaster compatible cards at the time.
As a result, even if you had the most widely supported hardware, there was no guarantee that the game would work with your computer. DirectX solved this problem.
DirectX Makes Things Easier for Developers and Hardware Makers
Each version of DirectX (and we up to DirectX 12) installs a set of hardware and software features that compatible hardware should have. In other words, if you want your graphics card to be certified to work with the latest version of DirectX, it must have a minimum set of built-in capabilities.
Then developers write their games not for compatibility with a specific graphics card, but for compatibility with DirectX itself. In other words, both hardware manufacturers and game developers are standardizing their products for DirectX, so any games and hardware components designed to run on a specific version of DirectX are guaranteed to work well with each other.
DirectX Is The “X” in Xbox
Everyone knows that the two biggest names in the game console space are PlayStation and Xbox, but you may not know that the latter was originally called “DirectX Box”.
It’s probably for the best that Microsoft decided to shorten the name, but it’s also a very accurate description of the console. The first Xbox was built with PC hardware running a stripped-down version of Windows and DirectX. This is true today for the newest Xbox Series X and S consoles.
One of the big benefits of this is that transferring games between Xbox and Windows PC is very easy. Because they are actually one platform. However, the PlayStation and Nintendo Switch use their own APIs, which brings us to the next important fact about DirectX.
DirectX is Not the Only Game in Town
While DirectX has become one of the most important and widespread APIs, it is far from the only one. Many organizations have recognized the need for standardization. While DirectX is an API covering everything from graphics to game controllers, there are also APIs that focus on just one aspect, such as graphics.
When the first 3D graphics card became popular in the mid-90s, the need for graphics APIs became acute. 3dFX Voodoo cards used the proprietary Glide API. OpenGL (Open Graphics Library) is an open standard that remains popular today and exists in its modern form as Vulkan. In addition, Apple has its own Metal API for its own devices, and there are many others in other categories of devices such as mobile phones and tablets.
While DirectX does not have complete market dominance, other APIs depend on what Microsoft has chosen to anchor in each version of DirectX. At the same time, they do not dictate to anyone. Each version of DirectX is created in consultation with all stakeholders, so the relationship seems more reciprocal than one might think.
DirectX isn’t Something You Need to Worry About
The big question is how much you, the user, need to worry about DirectX. Previously, with earlier versions of DirectX on older Windows systems, you had to install DirectX manually. In most cases, this game includes the minimum version of DirectX it needs. If this installer found a newer version of this generation of DirectX on the system, it simply wouldn’t install anything.
Each version of DirectX (for example, 9c, 11, and 12) is a separate thing, but Windows 10 comes with pre-installed copies of them. Your old games will run great on your shiny new Windows 10 computer.
Your choice of equipment is much more important. You can always update the software or download the right software to keep the retro games working. But the hardware you have cannot be changed without an upgrade or a new computer.
Hardware Compliance With DirectX
Any hardware related to video games or any other application using similar technology is usually compatible with the latest version of DirectX at the time of its release.
However, if a new version of DirectX is released, it is possible that your existing hardware may not meet the requirements if it lacks the hardware functionality required for the new version of DirectX to work. However, this is not a reason to change the equipment immediately!
There is always a transition period when games support multiple versions of DirectX. For example, games currently generally support both DirectX 11 and DirectX 12. However, if you are looking to purchase new hardware (especially GPUs). It’s a good idea to buy something that is compatible with the latest mainstream models. DirectX version. Because you want your new purchase to stay relevant for at least a few years.
While you are doing this. You can also check if your new hardware is compatible. With the latest versions of other major competing APIs such as Vulcan.
what is DirectX in game programming?
what is DirectX in-game programming?.