Jump to content

c++ or java for game programming?

snorthd

I've learned a little of both but before I get more in-depth in wanna find out which would be best for 3D game programming. So please tell me what your thoughts are.

Link to comment
Share on other sites

Link to post
Share on other sites

For 3D game programming C++, for simple 2d games I would go for java, but I'm biased. I'm personally not a fan of Java having learnt C++ first But its all preference, My suggestion though is niether. I suggest C# with something like XNA 4.0 which does most of the engine construction for you, works easy for windows games and gives the option to port to 360. Certian sections require a bit more indepth knowledge of programming such as custom content pipelines (for things like model animatoin) but thre are packages out there that deal with that and you would most likely need the same if not more indepth knowledge for java or C++. I'm in my last year of my computer games programming degree so i've done quite a bit of everything when it comes to programming the different sections of games.

Link to comment
Share on other sites

Link to post
Share on other sites

Personally, I would say C++, the memory management is better, not relying on a GC, After pursuing minecraft modding, then moving to work with c++ c++ just feels much more suited to a gaming platform, I feel java should be left for server apps and android programming. Not fully fledged games.

Arch Linux on Samsung 840 EVO 120GB: Startup finished in 1.334s (kernel) + 224ms (userspace) = 1.559s | U mad windoze..?

Link to comment
Share on other sites

Link to post
Share on other sites

I agree with lutzee there with regrds to the memory management but it can be a pain to get your head around at first. one more benefit of using C# for XNA is this, http://monogame.codeplex.com/

An open source version of xna which has compatibility for near enough everything, from ios to linux and metro apps. Must check this link out if you are interested. There are thousands of XNA tutorials out there and http://gamedev.stackexchange.com/ is a pretty good site for help when getting started.

Link to comment
Share on other sites

Link to post
Share on other sites

I agree with Andrew123108, it really depends on the platform and the type of game you want to make. For any 3D game I really recommend C++ but if you are making a 2D game, you should be fine with JAVA from a performance point of view. Also, if you want to port it to android you should really consider JAVA.

Good luck

Link to comment
Share on other sites

Link to post
Share on other sites

Learn Java quickly and then learn C++ and C#... you can't really rely on just one programming language; in most 3D games these days they use a combination of C++ and C# along with multiple other languages, depending on what they're doing. Java is pretty much a must as well, though.

Link to comment
Share on other sites

Link to post
Share on other sites

C++ all the way baby :) if your talking 3d gaming. Java is more for game apps on our smartphones, there simple to script and easy to encode

My Sig Rig: "X79 (3970X) -Midas"http://pcpartpicker.com/p/wsjGt6"  "Midas" Build Log - https://linustechtips.com/main/topic/59768-build-log-in-progress-code-name-midas/


"The Riddler" Custom Watercooled H440 Build Log ( in collaboration with my wife @ _TechPuppet_ ) - http://linustechtips.com/main/topic/149652-green-h440-special-edition-the-riddler-almost-there/


*Riptide Customs* " We sleeve PSU cables "

Link to comment
Share on other sites

Link to post
Share on other sites

C++ it's faster and precompiled, java recompiles some parts of the code, to make it runable on any kind of machine you're using. Would be a mess with 50.000 lines +. But I would strongly recommend using a already exsisting engine to get started.

Here is a video tutorial to that topic: (total beginners only)

Link to comment
Share on other sites

Link to post
Share on other sites

To be honest, you should not be worrying about 'which language to use for game programming'.

This is a sign that you're currently not on the right track, in my personal opinion.

I suggest to start with C++, then when you are familiar with classes, functions, variables, pointers, references, polymorphism etc etc, then download a library like SDL or SFML which handles input for you, and eventually graphics if you don't want to start with OpenGL or DirectX immediately.

It might be hard for you to visualise your games or programs in pure text at first, but try. Experiement.

I'd also like to say that you certainly do not need to go TOO deep in console programming. Just get familiar with the language, and find yourself a library for input/graphics.

http://www.cplusplus.com/doc/tutorial/

I don't want to sound negative or anything, but... I have to say that:

How threads like this one usually end, is that you get some links and suggestions on how to start. BUT, you will just delay and delay. I believe the reason you posted this thread is that you wanted some sort of shortcut. However, there is not. You have to Google for tutorials and program in your free time. You can't just read, you have to write code, write more code and guess what - you have to write even more code.

Again, I'm not trying to sound negative - I'm just saying what I personally think.

Good luck with your programming. :)

Link to comment
Share on other sites

Link to post
Share on other sites

C++.. if you do in in Java... you'll get Minecraft. Where it eats your computer resources for nothing. If MineCraft was made in C++, it would have ran on anything.

Link to comment
Share on other sites

Link to post
Share on other sites

In my school's curriculum the first game you write is in java so you might wanna get some java experience before you move onto c++.

Link to comment
Share on other sites

Link to post
Share on other sites

I really like to use c and c++ but I do use java when I just want to bang out a GUI fast.

Link to comment
Share on other sites

Link to post
Share on other sites

I'm assuming you're talking about serious desktop PC games (think BF3 rather than minecraft):

C++ is the ONLY option for serious game titles. There is no discussion about this. okay...C counts technically too, but you should expect most of your work to be done in C++. I have never heard of a quality 3D game made in Java (I actually haven't heard of any quality of game made in Java)

if you're talking about 2D games, XNA is a great option for Windows games.

if you're talking about android games, then you NEED to make your games in C++ with the NDK. trying to use the Java codepath will not be pretty.

if you're talking about windows phone games, then you're looking at XNA again.

iphone games....not quite sure how they work honestly.

Link to comment
Share on other sites

Link to post
Share on other sites

For anything graphics related you're going to want to use C++.

Java is kind of a useless language, desktop applications: C#, Games: C++, Internet: PHP, HTML, CSS

Oh and mobile market: Android: C++, iOS: Objective-C

Link to comment
Share on other sites

Link to post
Share on other sites

C++.. if you do in in Java... you'll get Minecraft. Where it eats your computer resources for nothing. If MineCraft was made in C++' date=' it would have ran on anything.[/quote']

Eats your resources for nothing?

Elaborate. It would probably run better in C++, but hah - run on anything if made in C++?

You shouldn't talk about the things you don't know.

Also; I bet Minecraft could run much faster in Java if it was rewritten.

I'm assuming you're talking about serious desktop PC games (think BF3 rather than minecraft): C++ is the ONLY option for serious game titles. There is no discussion about this. okay...C counts technically too' date=' but you should expect most of your work to be done in C++. I have never heard of a quality 3D game made in Java (I actually haven't heard of any quality of game made in Java) if you're talking about 2D games, XNA is a great option for Windows games. if you're talking about android games, then you NEED to make your games in C++ with the NDK. trying to use the Java codepath will not be pretty. if you're talking about windows phone games, then you're looking at XNA again. iphone games....not quite sure how they work honestly.[/quote']

I'd say RuneScape is a pretty technically complex game. The people who says otherwise obviously don't know what they're talking about. I don't know if you've heard about it though.

Java is perfectly capable of creating a professional game. Jagex have used a big amount of time on their technology though, so I guess it's arguable. But you can't say that you NEED C++ for professional/serious games.

Link to comment
Share on other sites

Link to post
Share on other sites

C++ is much harder to get started in making games than C#, the comments about memory management being better with C++ are true but are generally not an issue unless your programming for a console or mobile device. As long as you do a little research on the do's and don'ts of whatever language you end up going with C++ Java and C# can all get very similar performance. Specifically if I were to recommend one I would recommend C# and XNA if your new to programming, there are a ton of tutorials for it.

Link to comment
Share on other sites

Link to post
Share on other sites

  • 2 weeks later...

As many of the other one says, I would recomend C++ for the task of game programing, since many of the tools and librarys are written for C++ and C++ is compiled and Java being interpreted. compiled programs, almost always run faster then interpreted programs, and in games, speed is very importent.

Link to comment
Share on other sites

Link to post
Share on other sites

For anything graphics related you're going to want to use C++. Java is kind of a useless language' date=' desktop applications: C#, Games: C++, Internet: PHP, HTML, CSS Oh and mobile market: Android: C++, iOS: Objective-C[/quote']

your're not entirely correct, java is program once run many places, INCLUDING android and Mac which can be very handy for certain applications. C++ is a deep language and learning it MAY not be worth the time for what he is trying to achieve. On the internet JavaScript is king of client side right now, you can achieve probably %40 of things with JavaScript.

Link to comment
Share on other sites

Link to post
Share on other sites

I've always been told by my CS buddies, that are creating their own game, that C# was the best language to use to code a game.

Link to comment
Share on other sites

Link to post
Share on other sites

C++ allows for much more "complex" video games but doesn't allow you to run 1 single game on all platforms. You will have to adjust the game for the various platforms out there if you use C++.

And like many of the people above me have said (and i quote):

"anything graphics related you're going to want to use C++."

"C++ is the ONLY option for serious game titles"

"if you do in in Java... you'll get Minecraft."

They're completely true. If you want to create a minecraft style indie-game then Java all the way. If you're looking more to a several man project... C++ is your best friend :)

"The box said 'Requires Windows XP or better'. So I installed LINUX..."

Link to comment
Share on other sites

Link to post
Share on other sites

To say that Java is a useless language is flat out wrong. While it may not always be the best choice for game programming, it is becoming more and more popular and gaining more and more support for game development. Outside of game programming, it cannot be dismissed. Even Bjarne Stroustrup says that java is an essential programming language for every programmer to know and use.

Now, if you are looking to get into the game programming industry, then c++ is the route you would most likely want to take. It is the industry standard and has a massive amount of libraries and game engines built for c++. c++ places focus on efficiency and if compared to lower level languages, ease of use. Java on the other hand places its focus on even more ease of use and compatibility with just about every computer out there. As with any other sectors of the programming industry, the key is to learn as many languages as you can in order to implement your ideas in the best way possible.

Link to comment
Share on other sites

Link to post
Share on other sites

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

×