What's the most cross-platform friendly coding

2019-03-29 11:23发布

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.

11条回答
forever°为你锁心
2楼-- · 2019-03-29 11:33

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.

查看更多
欢心
3楼-- · 2019-03-29 11:40

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++.

查看更多
一纸荒年 Trace。
4楼-- · 2019-03-29 11:43

C is a good language, but generally you want an object oriented language for programming game. If your looking for speed, go with C++, but if you don't have much programming experience, go with python. look into the sfml and pygame libraries.

查看更多
孤傲高冷的网名
5楼-- · 2019-03-29 11:48

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.

查看更多
闹够了就滚
6楼-- · 2019-03-29 11:49

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

查看更多
【Aperson】
7楼-- · 2019-03-29 11:50

As most have noted here, you are almost certainly going to need C/C++ for your graphics in the end particularly for your high performance (graphics) requirements.

However there might be an opportunity to develop the "core" as you call it, in a scripting language which in turn is easy to embed within a C/C++ application. In which case, the top 2 scripting languages to look into would be Lua and Tcl.

Lua in particular is used in WoW among others I'm sure. Tcl on the other hand has more "batteries included" (libraries).

查看更多
登录 后发表回答