PDA

View Full Version : why wont games for other OS work by default in ubuntu



tooatw
March 31st, 2010, 07:53 AM
i am not expecting a "because it is made for another one"
i am expecting an answer from a programmer's point of view
i mean if i do something in c or c++ or java or whatever when i compile it in windows i get something that will run in windows and if i compile it in linux it will work for linux
so why wont they work in different os'?

dabby_yo
March 31st, 2010, 07:54 AM
DirectX vs OpenGL?

Crunchy the Headcrab
March 31st, 2010, 07:56 AM
That's not entirely true. Those game require tools that only work on certain platforms. For example most Windows games use DirectX, some Microsoft API's that are not licensed to run on anything other than Windows (surprise surprise). The reason why people have allowed this to happen is largely in part to the amount of market share that Windows has. If you're going to make games for the most lucrative OS, then you're going to use the best tools available for you to do that on that OS, which in this case aren't available on the other OS's.

k33bz
March 31st, 2010, 07:56 AM
what dabby_yo said as well as the file structure and different languages. DOS vs Unix

tooatw
March 31st, 2010, 07:58 AM
of course!
they use 3rd party software
i always thought they were independent

dabby_yo
March 31st, 2010, 08:05 AM
of course!
they use 3rd party software
i always thought they were independent

If you're a PC gamer, how could you not know the difference between DirectX and OpenGL?

Chronon
March 31st, 2010, 08:13 AM
Java can work on any platform for which a Java Virtual Machine has been implemented. Thus the whole "code once run anywhere" mantra.

Compiled languages get converted directly to machine language for a given architecture. I suspect that the main reason that a compiled binary for x86 only runs on a certain OS is because it contains functions that are specific to the OS it is meant to run on. I believe that a binary for x86 will run on any such chip, it just won't properly interact with an arbitrary kernel. However, it's possible (at least in principle) to simply use a bootloader to execute individual binaries rather than use a complete operating system.

I am not an expert in this, so I welcome corrections.

fatality_uk
March 31st, 2010, 08:13 AM
It's down to the way the game creates & accesses the GUI. If you create a text based C application, it will run on virtually all OS's. But as said, DirectX is Microsoft's default 3D API set. Now changing the 3D-API isn't massively difficult, but as Linux, OS X's market share is combined less than 10%, it's not very cost effective to port the code as it would take a good few months to port to OpenGL from DirectX. As the vast majority of the market is for Windows gaming.

cguy
March 31st, 2010, 09:26 AM
When you compile some code, the resulting program is not understandable by the processor, but by the operating system. It's the OS who then talks with the CPU telling it what to do.
It's not the libraries which are used which make the difference.

Chronon
March 31st, 2010, 09:57 AM
When you compile some code, the resulting program is not understandable by the processor, but by the operating system. It's the OS who then talks with the CPU telling it what to do.
It's not the libraries which are used which make the difference.
It is possible to compile a binary that is understandable by the processor (this is basically a firmware). Your comment does seem to crack the whole nut of this whole question, though. Software doesn't talk to the hardware directly. It makes calls to the kernel. A binary that talks directly to the hardware is really a firmware and not software.

lisati
March 31st, 2010, 10:01 AM
When you compile some code, the resulting program is not understandable by the processor, but by the operating system. It's the OS who then talks with the CPU telling it what to do.
It's not the libraries which are used which make the difference.

It's not so much that the processor can't understand the compiled program, but that the "behinds the scenes" stuff (system calls etc.) is usually different. Assuming, of course, that it's compiled for an OS that runs on the same kind of processor.

tooatw
March 31st, 2010, 12:18 PM
If you're a PC gamer, how could you not know the difference between DirectX and OpenGL?

i'm not much of a gamer, just out of curiosity

iRiUX
March 31st, 2010, 12:36 PM
There are layers of communication. The Application/Game communicates with the operating system and the operating system communicates with the hardware. The problem is, the Windows (e.g.) App/Game will talk to the Linux OS as if its a Windows OS and the Linux OS will be like: wtf dude, are you stoned or something?! The following is based on a real event:

The windows Game is like: hey man... I want you to let me to use recipes.exe (program he needs to make pancakes)...
and the Linux OS will like: wtf is this recipes.exe ****?... U smoking crack?... ******* moron.
Windows Game: wtf dude, im waiting, gimme access to recipes.exe
Linux OS: No crackers allowed, get the **** out of here.
Windows Game: ERROR

pirlo89
March 31st, 2010, 01:22 PM
the following is based on a real event:

The windows game is like: Hey man... I want you to let me to use recipes.exe (program he needs to make pancakes)...
And the linux os will like: Wtf is this recipes.exe ****?... U smoking crack?... ******* moron.
Windows game: Wtf dude, im waiting, gimme access to recipes.exe
linux os: No crackers allowed, get the **** out of here.
Windows game: Error

lol :p

forrestcupp
March 31st, 2010, 01:28 PM
i mean if i do something in c or c++ or java or whatever when i compile it in windows i get something that will run in windows and if i compile it in linux it will work for linux


In C and C++, what you just said isn't even close to being true. It's true for very simple command line-based programs, but that's about all. Most Windows programs are going to be programmed in C using either WinAPI or DirectX. Try taking that code and compiling it in Linux; you won't get very far.

There are toolkits and engines, like wxWidgets and Ogre3D, where you can program GUIs and 3D games, and it will be compilable on Windows and Linux with the same code. So it is possible. But the truth is like other people said; Linux is a very, very small market share, and most programmers just don't care.

But it's definitely not true that you can just take any random code and it will compile on any OS.

sandyd
March 31st, 2010, 04:02 PM
perhaps direct2d, which was recently added to ati's drivers will make games on linux more popular. but then again, I would prefer to have direct3d instead... which we will likely get in the future... hopefully in my lifetime.

madjr
March 31st, 2010, 07:43 PM
@tooatw

well i believe a simpler example would be to take um something like firefox

take the linux version and take the windows version (in wine)

there will be differences that will make 1 virtually unusable in the other even if you get to compile the code

some games can be a lot more complex, api and driver dependent, etc

wine is prove that 2 OSs can live side by side, but reverse engineering is H.A.R.D, it's awesome what they accomplished so far

in the meantime we can only BATTLE IT OUT (like apple and Android are doing), they will soon be just as big as the PC as a gaming platform. a win for *Nix

devs have embraced OpenGL and other open standards, in many fronts, like never before

Mobile and desktop will eventually fuse (check nvidia tegra presentation (http://www.youtube.com/watch?v=mlOTcs-effU)), making Android a Big dominant OS and open lots of doors for all linux and kernel, even merge normal linux projects with android compatibility

a Big SWIFT Kick to MSFT's dominance, that they didnt see coming

whiskeylover
March 31st, 2010, 08:34 PM
If you wrote code that is strictly ANSI ISO C/C++ compliant, then it should compile on all platforms. Sadly, if you want your game to be even a least bit enjoyable, you'd have to link to libraries that are platform dependant (graphics/audio/filesystem/whatever) or write everything from scratch.

Warpnow
March 31st, 2010, 09:11 PM
The short answer is that the pre-requisites cannot be satisfied due to a closed source, windows only component somewhere in the hierarchy.