What's the most cross-platform friendly coding language?

10,132

Solution 1

C (and now for some padding to reach 15 chars)

Solution 2

Have you ever seen the Blues Brothers? In the movie, Jake and Elwood go into a hick bar to do a gig and ask what sort of music they like, to which the woman behind the bar answers:

We have both kinds: country AND western.

What has this got to do with this question? Well, you want to create high performance 3D graphics and you're asking what language to use?

We have both kinds: C and C++.

Solution 3

You probably want C for your lower level graphics performance, either the variant of C89 that Visual C++ supports, or use MinGW and gcc C99 ( VC++ 2008 doesn't support declarations in for loops in C99 code, which is very annoying, but then they didn't do that right in C++ for years ).

Admittedly, if you're taking GNU with you and running full-screen with your own GUI then it's not really cross platform any more.

You also probably want either Lua or Python or another scripting language which plays well with calling C to give a sensible higher level way of controlling the game.

Solution 4

C++. You can avoid millions of "if #define"'s for platform dependent things and instead use inheritance (derived classes for each platform and client using/knowing the abstract base class). A few exceptions to this can be made for the performance critical parts.

There are also lots of libraries for cross-platform development.

Solution 5

Java is probably one of the easiest to learn, personally. Java though doesn't have have that great of a graphical system, it needs more code to support the graphical display if you are coding "GAMES," if you're going to code a website though choose JavaScript, CSS, and HTML/5. Or use only one of these languages normally best to choose two that best fit your comforts... =) For an FPS, I would recommend for beginners to use Java, if you have a good sense in what you want to create and it is a more complex game then use C# or C++, just because it uses less hardware if you want to make more complex games to run on multi platform.

Share:
10,132
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years

    Let's say I want to create FPS game, let's say clone Crysis so everybody understand what type of graphics & performance I'm after. What's the best code to write this game with so it's as easy as possible to port it to all the common platforms? Of course I want the application to feel and be native to the platform. This also means that it should be easy to take advantage of Snow Leopard's new features like OpenCL and Windows 7's new features. I realize that GUI has the written separately for different platforms and that's not a problem.

    So my question is that what's the best language for the job. I'm not looking for one-for-all solution but more like language for the core. I guess one way to put it is to say that what's the best language if you need to port the same program to Windows, OS X & Linux? Java is out of the question.

  • Admin
    Admin over 14 years
    Thanks a ton for the answer and wxWidgets link.
  • Roman Plášil
    Roman Plášil over 14 years
    Well, yeah, C is maybe more portable than C++ or other languages, but he probably also wants to finish the game sooner than in 10 years, so I wouldn't recommend it. The half a year you save in porting work by using C is nothing compared to the time you could save by using a more friendly language than C.
  • Admin
    Admin over 14 years
    Roman, you actually hit a spot because I'm experienced PHP coder but I only know the very basics of C so it's a learning process also. Can you recommend any other language that would be easily "portable" in the future?
  • Roman Plášil
    Roman Plášil over 14 years
    I would recommend knowing C++ well and using the things it offers to make development easier. Java wouldn't be out of question for me although it has its problems.
  • Traveling Tech Guy
    Traveling Tech Guy over 14 years
    C is not that bad - I wrote C code for years that was running both on Win16 and Mainframe :). But I agree with other commenters: C++ is a better way to get reusable code to work across platforms. Also check out Qt (qt.nokia.com/products) as a cross platform UI solution - the latest SDK is even supposed to have a cross-platform IDE.
  • Roman Plášil
    Roman Plášil over 14 years
    How much is a UI from a game like crysis? Maybe 2 % - in the level editor.
  • aman.gupta
    aman.gupta over 14 years
    Yeah, as much as I prefer more dynamic languages such as Python or Javascript, you're simply not going to write the core of a modern FPS game in anything less than C/C++, doubly so if the OP needs to learn as they go along (which means using existing libraries and examples, the majority of which will be in C++).