Sign in to follow this  

Cross Platform Development - Without Linux

This topic is 4277 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am in the process of starting the re-planning and re-design of a cross platform engine, using both DirectX and OpenGL. Unfortunatly, my Linux install is busted. I have spent the entire day trying to fix it, patch it etc. but it needs a full-rebuild. I have no intention of doing this until I upgrade my PC, so for the time being, I will be developing 100% on windows. What I am looking for are good pointers or advice as to what traps not to fall into so when I do finally slip it onto Linux, I don't have re-structure everything and re-write hugh amounts of code. I am not a novice coder, so I do have a good understanding of making a cross platform engine, but my linux expereince if very limited. It goes without saying I need an OpenGL renderer for linux, but I have a the urge to do both DX and GL for now. The engine will use a wide range of dynamic link libraries, which I know are handled differently in linux, but I am not sure how. I intend to use Code::Blocks on Linux, as it seems to be the only environment that uses Workspaces (as I am far to comfortable to MS VS), and that also seems to handle complex folder structures - whereas Anjuta always complains that the source file is not in the correct folder! So what kinds of things should I avoid and what kind of things should I do to make my life easier in about 5/6 months! Any advice or pointers to good information would be appreciated. Thanks Spree

Share this post


Link to post
Share on other sites
I would suggest you use cygwin or mingw for development so you can use the autotools. I say this for two reasons.

(1) Your development environment will appear the same for Windows, Mac, and Linux, and

(2) The ltdl wrapper that comes with libtool (a part of the autotools) will hide all the really nasty bits required to support shared libraries.

If you think shared libraries in a Windows vs. Linux sparring match is hairy, just wait 'til you try to grok dylibs and bundles on Mac OS.

Unfortunately, there is no good IDE that works well with the autotools.

On the upside, it's possible to use the ltdl wrapper library independently from the autotools.

You might also want to consider using Eclipse as your IDE. It does support C++.

Share this post


Link to post
Share on other sites
Our engine is multiplatform and here are a few things I did:

1) #ifdef WIN32/etc, #endif is your friend.
2) Write a low level file loader, again wrapped in #ifdef/#endif's so your loading works on any system with no changes needed in the actual game.
3) Abstract out windows handling stuff just like above.

Making the engine cross platform ready took all of 3 days. I didn't handle the linux side at all, but with a good base system it was done in literally hours. At this point I think we're done most of the major work, will be tweaks all over the place I know but it's actually not that bad. Make a good solid base structure and you'll be fine.

Best of luck.

Share this post


Link to post
Share on other sites
Thanks for the advice guys.

Regarding IDE's. I am not too worried about using different IDE's on different platforms, I think getting a flavour for different app's can only help you understand the nuances of a given platform.

I am concerned about the differences between dynamic libs on Linux and Windows (though the actual dynamic loading code is similar), so thanks for making me worry about Mac too ;) Unfortunately, the plug-in architecture is paramount to my engine so I can’t avoid it!

I am going to attempt very limited testing on Linux for the time being, though it might be difficult.

I fully expect to have _some_ #ifdef's around, especially at the lowest level, but hopefully, with a fully class orientated plug-in architecture this will be avoided in most places (expect maybe the shared GL code).

Thanks again
Spree

Share this post


Link to post
Share on other sites
since linux doesnt have DX you're buggered if u try that (youll have to rewrite heaps)
perhaps use a crossplatform library eg i use sdl my game compiles flawlessly on bioth win/linux and for 100k LOC project theres only a couple #ifdef's

Share this post


Link to post
Share on other sites
Hi, I would recommend using SCons as a cross-platform building tool. It is a lot easier to maintain than the GNU autotools, and it keeps you focussed on development, not configuration.
I don't know if it is possible to integrate SCons in your favourite IDEs though.

And make sure all the libraries you use are cross platform, and tested on you target platform.

Share this post


Link to post
Share on other sites

This topic is 4277 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this