Archived

This topic is now archived and is closed to further replies.

BradDaBug

Porting games to Linux

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 )

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites