Advertisement

Java vs. C++ for my game?

Started by June 02, 2017 04:26 PM
14 comments, last by redshock 7 years, 8 months ago

I would focus on the game first and not worry about things like security, especially since you are not only learning a new language one way or another, but also since this'll be your first game.

If you feel that Java is more useful to you professionally, then go ahead and use Java. Either language can be used to code a game. There can sometimes be reasons to choose one language over another, but in your case, I don't think those reasons matter much. At this stage, it's more about comfort than anything else.

No one expects the Spanish Inquisition!

Yes, I felt that this is the way forward but with all the excitement in my head, I had my doubts.
It was so amazing to read such cleverly thought out answers to such a personal matter, that you've been asked 100 times this week.

Thank you very much!

2006-2007: Game Designer, Ubisoft (King Kong, Brothers in Arms, Rayman Raving Rabbits and a few more shipped titles)

Advertisement

I would suggest C++. If you're wanting a job later, there's some things to consider. The below quote is from a job recruiter, and based on my professional experience I found this true and helpful in my career, i.e. dropping into unmanaged (native) code for writing performance enhancers where it'd be slow if written in Java/C#, and just being better aware of performance issues (C# and Java's runtimes were built using C++). Those who specialize in C#/Java tend to be limited as sandbox users, though that's fine depending on the project. While reading, keep in mind that C# is similar to Java. If you're just doing this for a hobby and don't plan to do game development or software development, like many here enjoy indie/hobby work, Java is a good choice, and C# is closely related and better coupled with the Windows operating system and has a better JIT compiler for performance. While C#/Java hobbyists might not like the quote, it's not meant to offend, but it's what at least one recruiter looks for. Good luck with your games!

As a recruiter I look for C++ for several reasons:

0: Employers ask for C++ more than C#, and a lot more than Java.

1: It is evidence that you're smart. C++ is harder than C#

2: It is evidence that you've had a better education, people who do weaker courses do weaker languages, on average.

3: It shows you are a member of the set of people who do things to computers, more than someone who computers do things to. As Daniel rightly says, C++ allows you to hurt yourself badly which is good if you aren't broken by it.

4: C++ is the code they have most of their important work in.

5: C++ is a richer framework in which to express your ideas in code. Fully understand C++ and you understand very nearly everything in Java, C# , VBA et al.

Some employers will accept C# rather than C++, in fact some C# employers ask for C++ when they actually want C#, because on average C++ programmers are so much better clued up. I've even had that for Python developers.

As a recruiter I look for C++ for several reasons:

0: Employers ask for C++ more than C#, and a lot more than Java.

1: It is evidence that you're smart. C++ is harder than C#

2: It is evidence that you've had a better education, people who do weaker courses do weaker languages, on average.

3: It shows you are a member of the set of people who do things to computers, more than someone who computers do things to. As Daniel rightly says, C++ allows you to hurt yourself badly which is good if you aren't broken by it.

4: C++ is the code they have most of their important work in.

5: C++ is a richer framework in which to express your ideas in code. Fully understand C++ and you understand very nearly everything in Java, C# , VBA et al.

Some employers will accept C# rather than C++, in fact some C# employers ask for C++ when they actually want C#, because on average C++ programmers are so much better clued up. I've even had that for Python developers.

Sounds like that recruiter may have been a recruiter for a bit too long, and has become out of touch with the industry. It's true that knowing C++ is a good thing, it's true that knowing the basics of memory management will carry you even still into the realms of writing better managed code. But just because some knows C++, doesn't mean they know how to code well with it.

1: It is evidence that you're smart. C++ is harder than C#

It sounds like he's never been on our Code Horrors forum.

2: It is evidence that you've had a better education, people who do weaker courses do weaker languages, on average.

I respectively disagree. Once again it sounds as though this recruiter has never been put on a two day deadline to create an app that performs extensive AD automation. C++ compared to something like PowerShell/Python is a nightmare for these tasks. I'm sorry, it is. Different tools for different jobs. Just because your stuck on hammering a nail into the wall with a screwdriver doesn't make the screwdriver inherently a bad tool, it just makes you look like an idiot for using it for that purpose.

C++ is the code they have most of their important work in.

This is highly subjective. True C++ is a go to language for low-level tasks, but the recruiter makes the foolish assumption that this automagically equals delegation of an "important" workload. This is not always the case.

5: C++ is a richer framework in which to express your ideas in code. Fully understand C++ and you understand very nearly everything in Java, C# , VBA et al.

It also sounds like he's never used anything but C++

In summation, the last people you wanna quote are recruiters. Especially this one. C++ has it's purposes, as does Java, as does C#, and as does many other languages. It's legitimately sad to see a recruiter who is supposed to be bringing new blood into the industry has this attitude.

Redshock's got some fair points but I think they could be framed a little better...

I would suggest C++. If you're wanting a job later

... in the AAA games industry.
Yes that's true, the games industry is fueled on C++ by and large.

Having said that, the OP did highlight that he already is employed in QA and is looking to do this as a hobby not as a job. So these are maybe not things the OP need worry about right now.

dropping into unmanaged (native) code for writing performance enhancers where it'd be slow if written in Java/C#, and just being better aware of performance issues (C# and Java's runtimes were built using C++).

Absolutely, there's no question that knowing C++ is beneficial to a developer for these (and other!) reasons.

At the same time to be a well-rounded and knowledgeable developer it is of the utmost importance to know other languages too such as Java/C#/Python/Scala/F#/javascript/etc. And it doesn't really matter which order these are tackled in.

Those who specialize in C#/Java tend to be limited as sandbox users, though that's fine depending on the project.

That is somewhat true depending on how you define 'sandbox' but it's not very limiting in practice unless you're writing something low-level like a driver or operating system.

Even C++ has a logical VM 'sandbox', defined by the standard, and this does not map directly to the underlying physical machine architecture either.

If you're just doing this for a hobby and don't plan to do game development or software development, like many here enjoy indie/hobby work, Java is a good choice, and C# is closely related and better coupled with the Windows operating system

I think this is the real take-away point that is on-topic for this thread.
I would just temper it by pointing out that there are many software development opportunities out there for languages other than C++. I myself currently work as a back-end Java developer by day.

C# [snip] has a better JIT compiler for performance.

Actually Java's Hotspot JIT uses a lot of advanced techniques to decide what/when/how to JIT. The JIT compiler in .Net is actually comparatively basic. This is an area where Sun/Oracle have invested a lot more time than Microsoft. Microsoft have spent that time building the language itself and the tooling around it. So it's horses for courses really.

While C#/Java hobbyists might not like the quote, it's not meant to offend, but it's what at least one recruiter looks for.

Of course! No offence taken. It's just a viewpoint. It's one I happen to disagree with but no reason to take offence all the same.

What I see is actually a very good demonstration that recruiters don't know what they're talking about when it comes to programming. I would not what that guy doing my company's recruitment.

Redshock's got some fair points but I think they could be framed a little better...

I would suggest C++. If you're wanting a job later

... in the AAA games industry.
Yes that's true, the games industry is fueled on C++ by and large.

Having said that, the OP did highlight that he already is employed in QA and is looking to do this as a hobby not as a job. So these are maybe not things the OP need worry about right now.

dropping into unmanaged (native) code for writing performance enhancers where it'd be slow if written in Java/C#, and just being better aware of performance issues (C# and Java's runtimes were built using C++).

Absolutely, there's no question that knowing C++ is beneficial to a developer for these (and other!) reasons.

At the same time to be a well-rounded and knowledgeable developer it is of the utmost importance to know other languages too such as Java/C#/Python/Scala/F#/javascript/etc. And it doesn't really matter which order these are tackled in.

Those who specialize in C#/Java tend to be limited as sandbox users, though that's fine depending on the project.

That is somewhat true depending on how you define 'sandbox' but it's not very limiting in practice unless you're writing something low-level like a driver or operating system.

Even C++ has a logical VM 'sandbox', defined by the standard, and this does not map directly to the underlying physical machine architecture either.

If you're just doing this for a hobby and don't plan to do game development or software development, like many here enjoy indie/hobby work, Java is a good choice, and C# is closely related and better coupled with the Windows operating system

I think this is the real take-away point that is on-topic for this thread.
I would just temper it by pointing out that there are many software development opportunities out there for languages other than C++. I myself currently work as a back-end Java developer by day.

C# [snip] has a better JIT compiler for performance.

Actually Java's Hotspot JIT uses a lot of advanced techniques to decide what/when/how to JIT. The JIT compiler in .Net is actually comparatively basic. This is an area where Sun/Oracle have invested a lot more time than Microsoft. Microsoft have spent that time building the language itself and the tooling around it. So it's horses for courses really.

While C#/Java hobbyists might not like the quote, it's not meant to offend, but it's what at least one recruiter looks for.

Of course! No offence taken. It's just a viewpoint. It's one I happen to disagree with but no reason to take offence all the same.

What I see is actually a very good demonstration that recruiters don't know what they're talking about when it comes to programming. I would not what that guy doing my company's recruitment.

Good points. C#'s new RyuJIT compiler for 64-bit is quite impressive, but I'm sure Java's has matured over its longer lifetime.

This topic is closed to new replies.

Advertisement