Not sure if this is the correct place to ask this question. However, when a game is ported over to Linux, and was written using DirectX(such as Unreal Tournament 2003), do they rewrite it in OpenGL, or what kind of graphics library do they use? Is there a typical way something like this works, or does it vary from project to project? Thanks for any information.
using directx doesn’t neccessarily mean that it uses direct3d, which is the point that is interesting for us . There are several games that have both a d3d and an OpenGL engine, like half life 1 and Unreal, I’m not sure about UT 2003, I guess the newer windows games are mostly d3d-only. But anyway, porting a 3d enginge from d3d to OpenGL is probably not really very hard unless it’s not VERY sophisticated, as the basic stuff is always the same, drawing textured triangles . of course it’s work, even a lot of work, but compared to the whole development process of such a game, it’s rather neglectable. But to answer your question, no, there’s not the one way to do so.
Porting a game to a different platform/graphics API is a serious decision and for almost all games that are ported today this decision is made before they’re being developed.
One thing you always ALWAYS have to do is strong encapsulation of platform dependant modules. Your physics code for example will probably not have to be changed to run on Linux or OS-X but networking for example can be dependant on the platform you’re working on. So you have to make sure that all your networking code is in one place and has clean interfaces to the rest of your systems.
For graphics APIs OpenGL is the system of choice on non-windows platforms. How exactly a port is done can vary but all are variations of the general exchange-the-modules-that-don’t-work-on-the-new-platform theme. Sometimes the whole engine is re-written, sometimes only specific systems are replaced and sometimes (though this is an unusual thing to do) a completely different engine (possible licensed from a middleware provider) is used for a ported version of the game.
On the question of the amount of work needed for a port I have to disagree with JanHH. Moving to Linux might only require you to exchange a part of the engine code but if you’re moving to a console you might find yourself facing the decision to rework considerable amounts of your artwork because the TV-display makes it look like crap.
TV images are different from modern monitor displays as they are often drawn interlaced as two half-images, first the odd lines, then the even ones. The time difference can make single-pixel horizontal lines disappear. The resolutions are generally lower and the color display in parts of the spectrum vastly different.
One quite hideous danger hidden in the whole porting business for consoles is the difference in input systems. A gamepad is vastly different from a mouse/keyboard combination. The developers of Jedi Knight for example hat to change whole levels for the XBOX port because overhead enemies could not be spotted and targeted fast enough using the gamepad controls.