Why do most games require windows to work properly

Harfeg

Distinguished
Jul 16, 2010
12
0
18,510
Hi All,
This is something that I have wondered about for some time.

Why is it that most games need Windows to operate?

It might be they need directx or something else windows specific. If so then why is it that some game discs can install a mac and windows version, Warcraft 3 and the Sims 3 being the two examples I can think of.
While I am not familiar with the intricacies of programming I would have thought that everything the game would need would be in its directory, and all that would be required to make it compatible with other OSs would be their ".exe" equivalent to get the game started, after that the game would have all its own resources and run them within the "game os". Is that how games work? Could they work that way?
Does anyone know anything about those four questions?
Thanks
Harfeg
 
Because the DVD has both Windows and Mac version burnt onto the disc.

That saves a lot of time and money. You are basically selling the same disc for both operating systems. No need for a separate production line for a Windows version and a Mac version.
 

ksampanna

Distinguished
Apr 11, 2010
1,284
0
19,360
I'll try to answer in layman terms.
Windows is an Operating System, & the most widely used in the world. Obviously, the game developers would want their games to reach out to the widest possible audience. That's why Windows has so many games developed for it. That & plus the fact that Microsoft has always encouraged game development by developing standards such as DirectX, .Net Framework, etc.
I don't know how games are developed, I'm not a programmer. What I know is that the type of games developed for an OS are determined by the developer's tools used by the game's creators.
 

purplerat

Distinguished
Jul 18, 2006
1,519
0
19,810
It's both the API (DirectX) and Windows itself. Essentially what every computer program does is to tell the hardware how to behave in order to get certain results. The problem is that with so many different possible hardware configurations and the ever changing nature of computer hardware it would be a massive undertaking to make even the most basic of programs work directly with every piece of hardware it might need to run on. So you need things like operating systems and APIs to act as a middle man and take the high level instructions from the program and determine how to pass them on to the hardware of that particular machine. Windows and DirectX are by far the most common OS/API used so it just makes sense that game companies focus on those systems. That some games are also available for other systems just means that additional work was done for those games to make them compatible with Mac or whatnot. It's essentially the same as having to make the game for multiple hardware formats except rather than thousands of possibilities it's only a few. Games like WC3 and the Sims install on both simply because there are two sets of files to work on one system or the other.
 

Harfeg

Distinguished
Jul 16, 2010
12
0
18,510
Thanks for the replies,

Just to see if I've got the right end of the stick

Assume the following:

1) All OSs are capable of allocating the correct amount of hardware resources (HR) to any program that asks for them
2) DirectX demands HR from Windows on behalf of the games
3) Well made games would need nothing outside of their directories to run if they are given the necessary HR

In this (almost certainly false) world so long as an OS understood DX any game using DX would be able run on that OS.
Therefore if there was version of DirectX for every OS out there then it would require NO effort on the part of developers to make games cross-platform. They would simply need write the game in DX format and it would be instantly usuable by all the different versions of DX.

This obviously isn't the case in the real world. Is that because nobody has written a universal DirectX/OpenGLL or are my assumptions completely wrong?