Jump to content
  • Advertisement
Sign in to follow this  
Sereath

How to cross-platform ?

This topic is 2572 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

Hi,

I am what I'd like to call a "wanna be developer" creating games and applications during my free time (using opengl, qt, irrlicht, ogre and good old c++).

About 2 months ago I decided to roll up my sleeves and start doing cross platform software/games. I go trough the trouble of having a triple boot computer (W7, Ubuntu, Mac 10.6)

...but then I'm lost. I am really swimming since a month trying to figure out how should I go about creating a project that is cross platform.
I enjoyed using codeblock on windows but it is unstable on mac. I tried xcode but I feel deeply uncomfortable using it (I know you all like it, I don't, I will do my best to like it if it is necessary though).
As for Linux I go a little more success compiling a basic ogre app on linux but am still a little bit lost in this see of dependencies)
So here are a few questions :

- Is there a application or something that facilitate the process of creating a cross platform project.
- Should I build a cross-platform makefile with my bare hands ?
- What is the process of creating a cross-platform (if you have time to write your 2 cent I would really appreciate it)


Thanks ahead for your time.

Share this post


Link to post
Share on other sites
Advertisement

Hi,

I am what I'd like to call a "wanna be developer" creating games and applications during my free time (using opengl, qt, irrlicht, ogre and good old c++).

About 2 months ago I decided to roll up my sleeves and start doing cross platform software/games. I go trough the trouble of having a triple boot computer (W7, Ubuntu, Mac 10.6)

...but then I'm lost. I am really swimming since a month trying to figure out how should I go about creating a project that is cross platform.
I enjoyed using codeblock on windows but it is unstable on mac. I tried xcode but I feel deeply uncomfortable using it (I know you all like it, I don't, I will do my best to like it if it is necessary though).
As for Linux I go a little more success compiling a basic ogre app on linux but am still a little bit lost in this see of dependencies)
So here are a few questions :

- Is there a application or something that facilitate the process of creating a cross platform project.
- Should I build a cross-platform makefile with my bare hands ?
- What is the process of creating a cross-platform (if you have time to write your 2 cent I would really appreciate it)


Thanks ahead for your time.


The easy way:
Use C# with opentk or Java with LWJGL. (This lets you do all developing on one platform and all you really need to do is test the application on the others)

The slightly harder way:
Use a good cross platform IDE (Mac can be tricky though)

Or in worst case, use something like qmake to generate makefiles for all your platforms.

Share this post


Link to post
Share on other sites
If you're using Qt anyways, why not use QtCreator as an IDE/buildsystem? It works the same on all platforms. It works well.

Other than that, you're pretty much limited to either using the GNU autotools for everything but Microsoft Windows and using Microsoft Visual Studio on Microsoft Windows (unless you go the cygwin/mingw route, which opens a can of pain you might wish had been left back on the conveyor at the supermarket) or cmake to generate "projects" for some subset of IDEs on various platforms, then run around adjusting each one one at a time in an endless loop.

Oh, and the 1990s ended over a decade ago, no need to triple boot any more. All the cool kids (read: productive people) use multiple VMs for development instead, reserving native boots for a subset of final testing.

PS. don't go the C# route unless by "cross-platform" you mean "Microsft Windows Vista, Microsoft Windows 7, and the Microsoft X-Box".

Share this post


Link to post
Share on other sites
First off, many of us hate XCode 4, even among the rabidly fanboyish Apple dev culture there are those that really hate Xcode 4.x.

Second, frankly when learning, take out as many variables as possible. Writing portable code is a good thing, often a very good thing, but it is generally a misguided feature for a new developer.


If you really want to write portable code, write it in an environment that abstracts the underlying hardware. Flash, Unity, Corona, et al. Otherwise, learn a language that is capable of targeting multiple platforms, such as Java or C#, learn the language *then* learn about portability. Scripting languages such as Python or Lua sit in the middle between abstracted languages and general purpose languages and are generally easier to write portable code in.

Share this post


Link to post
Share on other sites

PS. don't go the C# route unless by "cross-platform" you mean "Microsft Windows Vista, Microsoft Windows 7, and the Microsoft X-Box".


and linux, and mac, and ios and android and, maybe soon, ps vita...rolleyes.gif




Share this post


Link to post
Share on other sites

[quote name='Bregma' timestamp='1322840694' post='4889799']
PS. don't go the C# route unless by "cross-platform" you mean "Microsft Windows Vista, Microsoft Windows 7, and the Microsoft X-Box".


and linux, and mac, and ios and android and, maybe soon, ps vita...rolleyes.gif





[/quote]

Don't forget FreeBSD! Oh, or Solaris ( http://www.mono-project.com/Mono:Solaris ).

Share this post


Link to post
Share on other sites
CMake. It is a 'meta-makefile' in a certain sense. Also the answer to all your woes.

Cmake generates native project files on every platform (XCode for Mac, Visual Studio for Windows, Makefiles for linux, etc.), is braindead simple to use, and handles locating dependencies automatically.

Share this post


Link to post
Share on other sites
Sorry for this newbish question but giving your code for a specific platform to a "cross-platformer" does or does not affect performance of the final product?

Share this post


Link to post
Share on other sites

Sorry for this newbish question but giving your code for a specific platform to a "cross-platformer" does or does not affect performance of the final product?


Not on a level that you need to worry about initially. It is possible that some code needs to be implemented in a platform specific manner to perform adequately, but there are ways to handle platform specific code in a cross platform specific manner. Ultimately it's a bridge you cross if and when you get to it, which could be a substantial way down the road.


If you are using a cross platform library, like SFML, SDL or Ogre, they generally take care of the platform specific performance areas.

Share this post


Link to post
Share on other sites
Thanks you all for your time & valuable replies.

Il try do do a little summary of what are my options from your apreciated advices :


1) Platform abstraction

Using a language that let you code once and run everywhere
(Such as Java, C#, or even just in time compiled codes written in Python, Lua an such)


2) Compiler abstraction (maybe not the best title I guess)

Using a cross platform IDE that once setup properly let you build a project for the current OS with the press of a button.
(Qt Creator, Codeblock)

I did a quick research on the web and also found these ones that might be relevant and seems still alive :
(Eclipse, Code Lite, NetBeans, XPower++)


3) Writing makefiles
I've heard there are still some helpers programs for that (beside the IDE who do all the job for you) but frankly I just don't know how it works or where to start or how it works over all, basically I'm in the dark (I will mention here that I code in my free times and never really had classes about it).
I guess I've heard a few programs in this topic such as : cmake and qmake.


Thanks for telling me about C# cross platform capabilities, il dig into that hoping it isn't at the cost of performance.
Thanks a lot Bregma for telling me about Qt Creator. I've started using Qt and enjoyed it (especially once I finally got it to compile my slots and signals) but never used it's tools thus never knew it has it's own IDE. Hopefully using Qt Creator will make it a lot easier to compile for Qt anyway.



Oh, and the 1990s ended over a decade ago, no need to triple boot any more. All the cool kids (read: productive people) use multiple VMs for development instead, reserving native boots for a subset of final testing.
I hear you there, I went trough all this trouble a few weeks ago just to find out yesterday (coincidence I guess) about a tutorial on lifehacker about having 3 virtual machines that let you just switch OS without even having to re-boot. All it takes is a tons of rams. I just hope 4Gb is enough...




First off, many of us hate XCode 4, even among the rabidly fanboyish Apple dev culture there are those that really hate Xcode 4.x.

Second, frankly when learning, take out as many variables as possible. Writing portable code is a good thing, often a very good thing, but it is generally a misguided feature for a new developer.
Haha, good to know I'm not alone having problems to enjoy using xcode.

Going cross platform shall not slow my learning process since it is the very thing I want to learn ATM. Thanks for telling me about it's misguidance though it is a relief to me as I was constantly afraid of missing something obvious thus this topic I started.

I am well aware that creating a cross-platform application isn't a piece of cake, actually I see this as a nearly impossible task yet I am committed and I deeply want to create a cross platform application. And I want it to behave properly on all platforms (yes I'm just that crazy). If in the end I realize I just don't have what it takes, fine il accept it. For now I am just getting warmed up : bring it on cross-platform :ph34r:!





If you are using a cross platform library, like SFML, SDL or Ogre, they generally take care of the platform specific performance areas.
I've heard about softwares that given a complex problem (thermal analisys, lot of calculs) and yet given the exact same parametters, the same software would give different results depending on the platform you run it on. Is this true/possible and if so does using libraries specific variables avoid this problem (such as using ogre's integers rather than normal c++ integer)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!