Porting games to Linux

Started by
6 comments, last by BradDaBug 22 years, 8 months ago
I''m working on a game right now, and i''m really interested it developing it simultaniously for Windows and Linux. But, i''ve come up with some questions about this. 1. Is it worth it? The reason i''m doing this is probably more idealogical than practical (damn Microsoft!). I WOULD also try for Mac, but i don''t have a Mac, so thats not really possible. 2. Is it possible to create a single .exe that can run on both Linux and Windows, and do something like if its run from Windows then WinMain() is always called at startup where if its Linux its Main(), and then just use the appropriate code for each platform? 3. Are there any good tutorials or anything like that for game programming for Linux? I''m assuming it allows direct hardware access, like DOS, but i pretty much began game programming in Windows with DirectX, so i don''t have any experience working that closly with the hardware. Am I going to have to use 3rd party sound libraries like in the good ole DOS days or come up with drivers for each piece of hardware? I''m not using much Windows API code, except whats necessary to create the initial window. I''m also planning on using pure DirectX 8 for the graphics (in Windows), so i figure it''d translate OK to OpenGL. Answers? Opinions? Suggestions? Comments? Anything?
I like the DARK layout!
Advertisement
1. Although you might get a few different opinions here, I would say yes.

2. No, you can''t create a single .exe which would run in both Linux and Windows. I suppose you could run your Windows .exe with WINE, but that''s not really a viable solution.

3. As far as I know, Linux doesn''t allow direct hardware access.

Just a thought: If you''re going to translate your DX8 code (more specifically, your D3D) code to OpenGL, why not just use OGL in the first place?

~~~~~~~~~~
Martee
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
I thought of coding it in OpenGL to begin, but as little Direct3D as i know, i know absolutly NO OpenGL.
I like the DARK layout!
Hi, lately I''ve been experimenting with cross-platform development myself. I wasn''t able to find any tutorials so Ive just been messing around teaching myself some c/c++ tricks I heard of here and there. For instance you can do things like using preprocessor directives in your source code to only compile certain code for different platforms eg.
#ifdef _WIN32
// windows specific code elses
#else
// linux code here
#endif
Also if you are familiar with object oriented programming techniques you can pull off some really neat tricks using things such as abstract base classes to isolate platform specific implementations. Anyways im just trying to drop a few ideas here for you to investigate I think OpenAL is also an audio equivalent version of OpenGL, you might want to look into that (sorry I dont know much about it )
1. Sure, there is a market for linux games, but it isn''t big-if you have the time, linux could use more games.

2. You could use WineLib, which lets you use the win32 api for linux-but I wouldn''t recommend it. Your data file could be split between both, so it''s not like it would suck up twice as much space.

3. You''ll probably use glut and not the ordinary linux/X functions to make the window, so just do a search on that... And linux absolutely will not let you do direct hardware access unless you call your game part of the os or if you run it as root.

Head over to nehe.gamedev.net to get going on opengl, at the bottom of each tutorial download the linux source to see how different it really is.

If a moderator is reading maybe you should move it to the linux forum.

I would recomend a look at SDL, http://www.libsdl.org/, then all you need is a recompile to make it run on about every OS you can think of.
SDL & OpenGL all the way - you don''t have to touch WinAPI then, or Linux HW issues either. Great stuff.

Brad
Oh, I forgot, if it''s a commercial or shareware be ready for major headaches from hardware problems from gamers. Linux HW and drivers are in their infancy.

This topic is closed to new replies.

Advertisement