开发者

Make the move to c++ from java?

Ive been learning java for maybe 5 months, and for that whole time, i mostly tried making games. I made a halfway decent game with java2D, but I want to move on to bigger and bet开发者_运维技巧ter things... 3D. I began to learn LWJGL(which is basicly OpenGL). Before I get too deep into learning java, and going 3d with it, should I move to c++? Are pointers really that essential for large programs? Can I still make anything cross platform with c++? or am I stuck with windows. If I am stuck with windows, should I just go for c#?

Thanks.

When I said halfway decent, I meant that it was good, IMO. If you want to see it, to judge where i am in 2D experience, here you go: http://www.thenewboston.com/forum/viewtopic.php?f=119&t=13249

So Java is okay for game devolepment, on large scales?


Before I get too deep into learning java, and going 3d with it, should I move to c++?

Its worth considering knowing more than one language.

Are pointers really that essential for large programs?

This question is nonsensical, so "no".

However, C++ has some key advantages when it comes to games:

  1. Less memory overhead.
  2. Deterministic memory usage and timing.
  3. Deterministic runtime performance (with potentially better speed)

The first two of these are side-effects of Java's garbage collector and can be a problem with Java games (or any application). Whether or not they matter is completely up to you.

The third is a side-effect of the JIT. Java may not JIT all methods immediately (leading to a rough start), or at all (on a client VM). In addition, for true high end hardware usage, it may not make the best use (if at all) of extra hardware, such as vector instructions (SSE2,3,4,4.1,etc).

Can I still make anything cross platform with c++? or am I stuck with windows. If I am stuck with windows, should I just go for c#?

Yes, with effort. C++ is its self cross platform, but that is just a language. The rest is in libraries.


You can use Java as long as it meets your needs. If you find something specific you want to do that can't be done with Java, that's the point I would investigate other options, unless your game development is an exercise in learning programming languages. If that's the case, then by all means, try out C++.

The main reason I can think of that people move away from Java to non-bytecode compiled languages is performance and memory usage. So you should consider if this is an issue for you.

Regarding the cross-platform capabilities of C++: You can definitely write portable C++ code that can be compiled for multiple platforms. There are game libraries that work on multiple platforms like SDL or GLUT. You can write your game once with these and compile for multiple platforms.


This type of question is better suited for something like the Game development stack exchange site, but here's my answer:

With respect to what language you should use: Anything works. Yes, C++ is faster. But it's also harder to write "good" C++ code if this is your first time working on it. It's very easy to make a lot of mistakes in C++ if you're used to languages like C# or Java. It's much easier to start writing a game in C#, Java, Python, or any number of other languages than it is in C++ if you've never used C++ before.

If you do Java, you can make it cross platform. C# I'm not 100% on, as Mono does exist but I'm not sure of the state of cross platform functionality with games written in C#. C++ is cross platform as well.

Overall, if you've never done cross platform programming before you may run into some hurdles as you try to develop your software. The more comfortable you are with the particular language, the easier it may be for you.


With that said, I would caution you away from jumping right into 3D games, since you've stated you haven't finished a 2D game at all.

3D games are MUCH harder than 2D games, and you shouldn't be worrying about programming when you're making games. You should focus on writing the game itself. You'll learn how to program the games as you actually design and create the various features of the games. You shouldn't do things the other way around.


Ok, keep in mind that c/c++ are compiled languages that are portable, but 3D libraries such as DirectX are not. I think a good place to start 3D programming for games is with c/c++ and OpenGL. But, programming is only a part of game development and there are a lot of options. If you want to make games, you can look into low-cost engines such as torque3d or Unity 3D that use easy-to-learn scripting languages and have everything you need built in such as physics, audio, and networking support. If you really want to know how to program 3D graphics, which is different than game development, then the low level languages like c/c++ paired with OpenGL is a good place to start.


Learning 3D programming and C++ at the same time is a tall order.
And sure, it's possible to write cross-platform games in C++, but you really don't want to go there. Seriously.
There are cross-platform frameworks you can use if you really want to, but adding yet another thing to learn is a certain path to despair, and before you know it you'll want to become something more exciting, like a chartered accountant.

My advice: Stick with Java while you're learning 3D. You will pick up plenty of general programming skills (and maths) along the way, but the language won't get in the way. You can always move to C++ (or some other language) later if you need it or just want to learn.

And there's no such thing as "too deep". Are you afraid that you might learn too much? That won't happen.


If you want to get a bunch of reasons from partisans in the Java camp, consider checking out http://www.java-gaming.org. Among other things you will see some forum threads on the very subject (c++ vs java), as well as listings for resources and examples.

Some "big" games that use Java: Minecraft, RuneScape, there's lots more.

Java allows concurrency, which is a big plus as there continue to be more multicore processors out there. JIT is fast, and can do optimization on the fly that precompiling cannot.


I recommend you learn C++, for one big reason. Perspective.

If you don't try C++, you'll never realize just how good C# is when you finally learn it. :)

I spent 20 years with C++. I spent years holding on, not letting go. Finally realized other software companies are eating my lunch coding in more productive languages with better SDKs. It felt good to finally let go. (Though I'm still holding out for fully compiled C# and deterministic memory management one of these days).

(I'm only half serious. C++ really should be in your toolbelt as a game or system developer).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜