Java for game development?

Started by
43 comments, last by Lazy Foo 18 years, 1 month ago
If you know Java and don't know any other languages then I'd say why not, try game programming in Java. Its been my experience that its the math and algorithms that trip me up more than the language.

Though Its also been my experience that most of the game related tutorials I find are written with C/C++ in mind so knowing C/C++ may be something you'll have to tackle eventually.

I don't know if Java is slower than C++( I've never seen any good come out of debating that:)), but if I'm hiring I'd take the guy who has programmed a game rather than the guy who is good at C++ but hasn't produced anything game related.

Summary: IMHO Languages are easier to learn than game development in my opinion:) Start learning Game development fist, languages second:)

Cheers
Chris
CheersChris
Advertisement
Ha I just echoed the previous post by TheOther. Maybe its a Calgary sentiment. Go Flames Go!!

Cheers
Chris
CheersChris
Hi,
Java is a great language for game development. It may not be quite as fast as C++ - but is it really a major issue if Java is 2% - 5% slower than C++? If you know Java better than C++, you should definitely stay with Java. 3D Cards, and cpus are getting faster every day. One of the benefits of developing in a Java (and OpenGL) engine is that your product can run on multiple platforms without too much additional effort. I highly recommend going to www.jmonkeyengine.com to download and learn about an awesome Java 3d scene graph engine. The engine is built around Java, and OpenGL. The engine is fast and very easy to pick up and develop for. NCSoft (the company that produced Guild Wars) recently hired the creators of the Java Monkey Engine to create something that is based on this engine (I'm assuming it is a game). I prefer to develop in Java. It's easy and fast to develop robust object oriented programs, yet it is much more mature (as a language) than something like Blitz Max. C++ is great for an experienced C++ developer, but a Java developer should probably stay with Java.
Does anyone have any good references for a java+openGL solution that can produce stand-alone/native executibles for PC/Mac/Linux?

The biggest problem with Java is that it doesn't seem to be as nicely self-contained as something written in c/c++.

However this is something I'm still looking into, I'd love to be proven wrong ;)
First, Let me apologise if I gave the impression I wanted to start a Java flame war. That was not my intention. I'm a big fan of Java and use it often for Servlet applications. My goal was simply to answer the questions asked by the OP. Here's a refresher:
Quote:
Initially I'd planned on learning how to do things with Java (since I have some background in Java), but I'm not entirely convinced Java is the best choice for this.

Now my question is, how does java compare to languages like C# and C++ with regards to game development and how widely is it used?


With that being said...here's the facts, and the OP can decide which language is right for him.

JUST THE FACTS:

  • C++ is the standard programming language of all major platforms - PC, Macintosh( technically 'Objective C'), PS2, XBox, XBox360, and likely PS3.

  • There are more game development sites which cater to C++ game development than Java development. This doesnt mean better, just more.

  • There are more lines of code written for games in C++ then Java - giving a wider pool from which to draw libraries and examples.

  • C++ and C# both have bindings for both DirectX and OpenGL, giving you more choices for hardware acceleration. Java only supports OpenGL to my knowledge, though someone said Java3D might have DirectX bindings - need to research that a bit more.

  • C# IS being used by industry professionals in the arena of Tools development and will likely expand into game development itself due to its reflection capabilties.

  • C# is easier to work with than Java for tools development because it uses the same IDE as Visual C++ - important for dev studios which already use C++ for development.

  • C# and Managed C++ are both .NET compatible languages which allow the assemblies to be used with ANY other .NET language, including Visual Basic or each other.

  • The .NET Framework now has native CLR's running on both Linux and Macintosh - allowing portability to other platforms.

  • After searching through Gamasutra's job posting I found that all but 2 positions specifically stated they wanted C++ programmers. The 2 positions that wanted Java also wanted C++ and were advertising either a Cellular game programming position - or web programming - as I indicated in my first post.

  • On Gamasutra's job postings the following companies are currently advertising that they are looking for programmers with C# programming experience. I stopped looking about half way down, but I know there were a few more.
    Heavy Iron Studios
    Blizzard Entertainment

      With ALL of this being said, Java is still a perfectly valid language for developing games, especially games for webpages or cellular devices...however, ASP.NET (C#) also allows development of web-based games.

      In the end, pick which language you are most comfortable with. But keep in mind, if you ever want to be considered seriously for a professional game programming position, you'll need to have mastered C++. As it seems you're just starting with Java programming as well, you might as well make the switch to C# or C++ now. If you're attached to Java and want to continue using it, more power to you. Its a fine language.
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Quote:Original post by Anonymous Poster
Does anyone have any good references for a java+openGL solution that can produce stand-alone/native executibles for PC/Mac/Linux?

The biggest problem with Java is that it doesn't seem to be as nicely self-contained as something written in c/c++.

However this is something I'm still looking into, I'd love to be proven wrong ;)


i personally use lwjgl...great library. it just so happens i was just poking around aldacron's blog and saw this:

http://www.cokeandcode.com/node/422

a blog entry about using GCC/GCJ 4.0 (via mingw i believe) to compile it into a windows executable.

*that said* personally i like the launch4j option...open source tool to wrap your jar up into an executable along with a jvm if you want it. the dynamic libs have to be in a separate folder, but thats par for the course for any release game.

this tends to be a good idea, btw. one of cas's posts recently on the lwjgl or java gaming forums was about he was getting much more purchases from downloadable exe demos than webstart ones.
Try to use PhysFS in Java. Go on, try.

Done writing your JNI wrapper DLL yet? What's that? The JNI homepage's tutorial link is broken? Happy googling.

Now, try to use PhysFS in C#. Assuming you didn't find the Tao.PhysFS wrapper (which is a single CS file you include into your project), you'll find that you can write your file loading code (in my case, a threaded asynchronous loader) right in C++/CLI and export to C# no problem.

Now try to get PhysX (Novodex) into Java. Looks like you have to rewrite every single class in JNI...if JNI can even handle classes. Alternatively, you need to pull some kind of voodoo to implement a java interface for a scene graph node in C++. Enjoy yourself.

In C#? Just write your physics scene graph node in C++/CLI, and use it from C# as if the entire thing was managed.


This story repeats pretty much verbatim for most libraries on the market.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Quote:Original post by Promit
This story repeats pretty much verbatim for most libraries on the market.


Boy... you would almost think that writing games in Java is some kind of nightmare after reading that. It isn't.

Also, isn't the PhysX stuff like a $50,000 license? I don't think that's applicable for this conversation. It looks like you took the most ridiculous example you could think of and tried to pass it off as an everyday run-of-the-mill Java development problem.


Quote:Original post by jwalsh
smitty1276: Where do you get that it is 3 years old?

According to the website the benchmarks were done with:

Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_03-b02)
Microsoft (R) Visual C# .NET Compiler version 7.00.9466

Unless I'm mistaken those are both 1-2 years old...


Well, Java 1.4.2 was out in 2003, and the versions of everything else were at least 3 years old (cygwin from Feb '03, Windows 2000, etc). My whole point was simply that it is a crappy benchmark, and that's assuming you can even make heads or tails of the results. If you are going to judge based on those numbers, we should all be using ada.

I'm not commenting on the validity of your assertion. C++ is certainly faster, but there is no reason why C# would be faster than JIT Java. The difference is absolutely negligible for the vast majority of hobbyist game developers.



I do believe their Physics engine is now free if you include support for their hardware:
http://physx.ageia.com/developers.html

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety." --Benjamin Franklin

This topic is closed to new replies.

Advertisement