I'm interesting in start a game development. I currently did some openGL in C++, but now I'm looking for the options that offers Android, and I have found people who developes his games using Native code (C++) and others that use Java...
So I don't really know which is the main difference. I read that many people has experience using C++ and prefers this one to don't have to learn new things using java... but I don't think this is the main reason.
What are the main differences developing a game using C++ or Java? Perfomance? Scalability? Posibilities?
Also, do you recommend to start the game development using OpenGL?
I would suggest using whichever language you are more comfortable with. A game is never a small project, and since you are new to the process (judging by this question) you will probably not be concerned with any performance differences or anything like that.
To answer your questions:
Performance
see C++ vs Java Performance, Android: Java, C or C++?, etc.
Possibilities
There is nothing inherit that C++ can do and Java can't, or vice versa when it comes to your goal.
Scalability
Not sure what you are asking with this one.
C++ can perform better than Java (don't believe the naysayers, do your own benchmarks), but there is more support for Java on Android. In the end it depends on how intensive your app is going to be and how much battery it is going to drain. If it is extremely intensive, go with C++ because you can do more with less. If it doesn't matter, then go with Java.
at the end it doesn't matter sense if you use c++ you will need to learn all those frameworks used for android development, if you use java you will learn java and openGL is the same in all languages so just go with c++ if you are a c++ developer
Also, do you recommend to start the game development using OpenGL?
you should not start with OpenGL not that you can't but I would sagest something like SFML witch will teach you a lot about graphics programming then you can move to OpenGL
There are some particular API's in Java that make it very good. However I would prefer C++ because of performance and "bleeding" edge support with OpenGL and OpenAL among the many libraries.
Which API's are there that are similar to Java2D (I know I can use OpenGL however I lack the matrix math understanding to fully use OpenGL in this way)? Also which GUI framework (non-native; platform independent) is the most used in C++?
FLTK, Fast Light Tool Kit has some 2d functionality. It's somewhat like swing and 2d mixed together. It does focus more on the UI aspect but it may help you out.
http://www.fltk.org/
If you want platform independent GUI framework for C++ check Qt.
I can't speak much for Java2D equivalents but as far as GUI frameworks go, I've heard of two:
wxWidgets: http://www.wxwidgets.org/
Qt: http://qt.nokia.com/products/
Both of these are cross-platform and I believe widely used.
Try GTK--. It has some features that make it a bit nicer an API than either wx or Qt.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
Presently, i am learning Java from the book The Art and Science of Java and following Standford's Programming Methodology Course.
I would like to do game programming, but only as a hobby.
I was thinking, would Java be a good choice or is C++ the defacto in game programming.
Since you are learning Java i would recommend that you stick to it.
If you are only developing games for fun, it won't really matter what language you use.
That depends, do you want to learn more about C++? Do you need to know? There's still OpenGL libraries in Java that are available, and the concepts would essentially be the same regardless of what language you work in. If it's just for a hobby then I can't see anything wrong with working in Java. In terms of speed however, lower-level languages are prefered.
Either would be fine. For a hobby, they both have pretty good low-level support for graphics etc, and both also have pretty good higher-level libraries for games (jMonkey engine, SDL, SFML, Ogre and many more).
You could also consider other languages too. Python has SDL bindings called PyGame. C# has the XNA framework which has several books published for it now to help learning the framework. SFML has bindings for C++, C, D, Ruby and I think Python. All of these are then suitable for creating games in. Just pick a language and off you go.
If you ask me, neither Java or C++ are fun languages. Both of them have a number of advantages but if you're doing it for fun and don't have deadlines, I would seek out a language that's more fun. Like Python, or something similar.
If you want to make games you really need a game platform as well as a language, otherwise you will spend all your time solving basic problems like how to draw a sprite to the screen, rather than concentrating on building a fun game.
Great choices for hobby games development are:
Microft's XNA platform with C# language
Adobe's Flash with ActionScript language
Sun's JavaFX platform with JavaFX script language
Unity3D with C# language
Ogre with C++ language
You can write games using both languages but I think you should really try C++. There are far more high-level libraries and game engines written in C++ than Java so it would be easier to find one that suits your needs. Not to mention that a lot of older games have been open sourced and you can freely download them and study the code. You can guess what language they're using ;)
Also you'll find a lot more tutorials and books that teach game programming using C/C++.
No matter what you choose in the end, have fun writing your games :)
If you go with Java, I recommend Computer Graphics for Java Programmers, by Leen Ammeraal.
If you were developing commercial games you would be using libraries rather than implementing these algorithms yourself, but it's easier once you know the fundamentals, which you can learn from a book like this one.
I once wrote a software renderer for a DOOM clone in Java, and having this book for reference helped a lot.
C++ is THE defacto language not only for game development but for pretty much everything else, including the browser you are using along with the OS it runs on.
So if you are considering ever getting serious with programming C/C++ should be top at your list.
As for speed C++ IS generally fast than Java.
Why generally?Well, the truth is that C++ is faster than Java, is faster than pretty much everything else actually, but sometimes C++ code can be poorly written and Java may prevent beginners to make some mistakes resulting in many of the claims that Java is as fast as C++, there are even claims that Python/Psyco are as fast as C++ and faster than Java.
Keep in mind that no program written for a framework (Java, .NET, VB, etc) will ever run faster than a program that runs on a lower level (direct on the OS or even the hardware) like C/C++, ASM, Pascal and so on.
Take a look at this:
Poorly written C++ half the speed of Java, properly written is much faster
At the end of the day you should go with the language that you feel more comfortable with, remember that python is enterprise ready, commercial, stable, great for beginners, awesome to use on "Web 2.0" projects not to mention that is a lot of fun too.
Java - I'd recommend sticking to one and getting good at it. The ideas remain the same, and as you learn more about a single language, you'll begin to learn about the drawbacks and advantages that are prevalent in many of the programming methodologies and languages today.
Even if you never intend to get into professional game development there is one big advantage to C++, which is that you have a lot more resources available. There are more books, more tutorials online, more open source examples to look at and more people who will be able to answer your questions on sites like gamedev.net.
I have developed a couple of small games in both C++ and Java and I would select C++ everytime. It gives you the low level control which you just dont get with java. But games development is a whole different beast. So if you are looking to learn games developement start in something you are comofrtable with
If you think you may one day want to work in the industry, you should learn C++. C++ is used to make pretty much all commercial games that run on PC/xbox/ps3. I assume wii is the same but don't know 100%, I never worked on wii.
The games studio I used to work at (before it got shut down) used C++ for the game (small parts used C and assembler) and was starting to use C# for tools.
If it will only ever be a hobby, then it doesn't really matter what language you use.
I would suggest to try Haaf's Game Engine for C. It is very very simple 2D engine with good documentation, tutorials and examples, runs on Windows 98 and above and it is ABSOLUTELY free even for commercial usage!
If you're completely new to game development, it's right for you IMHO.
Only a hobby? If you're using Java then Java. But first, what are you programming, 2-D or 3-D games? Java does both, and it's my game programing language, but I'm doing only 2-D programs. C++ is the defacto standard for serious game programming, especially commercial games.
Java has a great IDE called Eclipse, which, to me, is worth doing Java all by itself...Eclipse rocks! And it's free.
C# - no. Way too Microsoft dependent.
Btw, Java will work as an applet and as an application if you plan it well, the application runnable on all three platforms...
So, think about it. Low investment, high quality tools, cross-platform. If you decide to get into C++, then that's okay too. At least you will have wet your toes for free...
;-)
Language defines target platform and public. Both Java and C++ have advantages and disadvantages. You will use same architectures and algorithms on any platform. If you know how to write a game in C++ it takes a little to write game in java (2 weeks for me http://madeinsoviets.net/).
Start learning game programming with C++ and some easy game engine (Ogre3D, irrlight) - much more information and tutorials.
Old topic but since people still read this i want to add my 2c since its unique
to this post.
Stick with java, its a great way to make games over c++ if your going to do it as a hobby
and by yourself for these 2 reasons.
10x less coding for the same results (albeit it runs about 5x
slower)
Android games, even mediocre ones will sell (a buck each) on the
marketplace. if you sell even one your going to feel huge pride!
(also java doesnt slow down over C++ on android because its JVM is
unique and runs against the API directly accessing hardware, which
is fantastic!)
If you are just doing it as a hobby, it probably doesn't matter. Just use whatever you are most comfortable so you can get into the swing of game programming. Once you get better, you might like to figure out what is the "best" language.
I would definitely suggest C++ if your intention is general game programming. Of course, if you want to develop for a mobile platform such as Nokia and Ericsson then Java might be a good idea.
But if it is for general desktop gaming then definitely C++. If you want to deploy games over the net then flash might also be a good idea.
If you're planning to enter the industry (or maybe a day start to sell your game yourself), then you have to learn C++.
Java or C# are good choice to get to the point of creating game without worrying much about the machine (memory and speed). That's recommended for beginner, but I would personally start directly with C++.
If you're looking into game programming then C++ is the way to go. Sure Java will be good for certain games, but C++ is so much faster.
I've coded in Java before, and then started coding in C++. The time I've spent coding in C++ made me understand certain things that were heavily simplified in Java.
Depending on how much experience you have programming, I'd suggest to learn the basics of Java and then move on to C++.
If you start with Java, I recommend this book Physics for Game Programmers
In general, C++ is for real games.
Java has always been slow for me, whatever platform or program I use.
C# is better than Java, but not as good as C++.
Yes, there are exceptions, but the fact that they are so notable rather proves that C++ is just the way to go unless you really know what you're doing.
I am ActionScript 3/Flex programmer, it is the first language I learned.
I want to learn either Java or C++.
Would one of these be easier to learn based on my current knowledge?
It really depends what you want to do. C++ is more powerful and fast. But Java has a smaller learning curve.
I'd say learn C++, only because it will require you to gain a better understanding of how computers work under the hood. It will also help position you to learn Java, C#, or any other language down the road.
Java seems more likely to be directly relatable to your work in AS3; C++ is better for giving you a grounding in a different technology (pointer-style OO rather than object-style. C++ may feel eerily similar yet different).
If you are doing C-ish C++, the pointer language learning process can be very informative as to how OS-level calls are written...
The places where you will reach for one tool or the other are very different, and the use you have for the tool may be more important in deciding than their relative merits as languages - employability IS a use for a tool, after all.
Well, AS3 more closely resembles JavaScript - they both follow the ECMAScript specification.
But to answer your question, I would say learning Java will be more beneficial and easier for you. Java supports Interfaces, and single inheritance, like Flex, whereas C++ supports multiple inheritance and lacks a formal notion of Interfaces. Java and Flex both manage memory for you, whereas C++ forces you to manage your own memory. Both Java and Flex have large helper libraries out of the box, and both have native String types, whereas C++ forces you to find a library to use and doesn't support native String types.
This may be my own bias, but it also seems more likely that you'll find a job that is looking for a Flex/Java developer, rather than a Flex/C++ developer. Java and Flex seem to work well together, with Flex as a front end and Java as a middle and back end.
I would say Java is more similar to AS3 than C++. You will find lots of familiar metaphors and mechanisms.
C++ on the other hand, will require more effort to learn. It is closer to the machine and demands an undertanding of lower level mechanisms. For instance, there is no garbage collection so you have to manage your memory resources yourself.
Which is better to know depends on what you plan to do with the language. C++ is good at performance critical applications (games, all kinds of real time simulations etc.). Java makes it easier and safer to build things, but at the cost of performance.
hope this helps
regards
C++ is, generally, harder to learn than Java. You will find this true pretty much no matter what your previous experience. Therefore, if you want to learn the easier, learn Java.
(This is partly a matter of design philosophy. C++ was designed to be mostly upward compatible from C, at least the C at the time C++ was being designed. It was also designed
to be useful and permissive, with ease of learning being secondary. Java was designed partly as a reaction to C++, as a generally safer and easier language. C++ is more expressive than Java, but this comes at a price: it's harder to learn C++, and easier to screw up with it.)
That being said, you never said why you wanted to learn another language. You might well be better off learning C++, even though it is more difficult.
Whatever you'll finally decide to learn, do yourself a favor and read either Thinking in Java or Thinking in C++.
Both books are available - for free! - at Bruce Eckels website. They are very, very good.
C++ is more complex than Java so I'd suggest to take a look at Java, first.
However, this isn't meant as C++ bashing. Both are great language, it just depends on what you'd like to do in the end.
I would go with Java. It will be easier to learn and, given your background, I'm guessing you do more web/internet work in which case you'll probably find more ways to apply the Java knowledge then you would C++.
I think you would find Java more similar.
Learning C++ will likely require you to learn concepts that you could avoid with other high level languages (such Java and AS3) e.g. manual memory management, pointers, non forward looking compiler, multiple inheritance, etc.