Live data from Hacker News

For creating a game, is Java or C++ better?

news.ycombinator.com

1–10 of 17 posts

For creating a game, is Java or C++ better?

#1
Me and a friend what to team up and program together.

The problem is I primarily know Java, he C++. Note we're both still newbies - better than somebody who's just taken a programming course - but still far away from being experienced programmers.

Our current plan is to first program a 2d game together, and then we'll see what we feel like doing next (I personally think it would be cool to take a loot at some open source engines).

So the question is, what are the pros and cons of each language considering the circumstances I just described?

Re: For creating a game, is Java or C++ better?

#5
You can build a 2d game in just about any language.

For Java, http://libgdx.badlogicgames.com/ is really popular these days. For C++, you have unreal engine, but you can just roll your own with SDL or SFML.

The /r/GameDev community on reddit has a wealth of information if you are just starting out, I'd start with http://www.reddit.com/r/gamedev/wiki/getting_started and http://www.reddit.com/r/gamedev/wiki/engine_faq

Re: For creating a game, is Java or C++ better?

#7
post #4

C++ It's what most game engines are done in. You get more control over performance. You can go all the way down to the metal if you want/need to.

It's a bit of a cliche for newbie game developers to get instantly sucked into engine-development/performance-concerns and then never actually birth their _game_ idea.

Use anything. Finish a game. Worry about the best technology next time.

Re: For creating a game, is Java or C++ better?

#8
Neither. Learn something else. There are 1000 better languages for video games than what you mentioned. You won't get far with either because you'll delve into the unneccessary complexity of how those languages are organized, and you'll never recover to the real world to make a concrete game. You'll have a load of abstraction that does nothing.

Re: For creating a game, is Java or C++ better?

#9
My personal and entirely subjective preference would be C++ and SDL2, or Unity with C#. I'm not that great at Java so I can only say I like what I know, which isn't very useful.

Although, if you care more about education than shipping, why not try building the same game in both? You would each learn how it's done in both languages and you could test which seems better.

Re: For creating a game, is Java or C++ better?

#10
post #7
post #4

C++ It's what most game engines are done in. You get more control over performance. You can go all the way down to the metal if you want/need to.

It's a bit of a cliche for newbie game developers to get instantly sucked into engine-development/performance-concerns and then never actually birth their _game_ idea. Use anything. Finish a game. Worry about the best technology next time.

This is much better advice than it might seem at first glance. The temptation to get sidetracked by pointless bikeshedding and unnecessary optimization can be huge, when you're trying to find out the 'right' way to do something.

I know because i've done tutorials and started projects far too complicated to finish in Unity, Gamemaker and C++. I wasn't even aware of how counterproductive it was to actually finishing a project because in the moment it feels like you're making progress, but you're usually not, at least as far as finishing the game is concerned.

Post reply on HN