Jump to content

  • Log In with Google      Sign In   
  • Create Account

Java for game development?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
44 replies to this topic

#1 killingdjef   Members   -  Reputation: 122

Like
0Likes
Like

Posted 02 May 2006 - 11:32 AM

Hi, Recently I've dived into the wonderfull world of game development on indie level and was wondering some things. 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? Generally im trying to find out if it's wise to stick with Java when it comes to game development. A quick search in the game engine index returned jME (www.jmonkeyengine.com) as best game engine and I must say that I am impressed. With such capabilities why wouldn't people want to use Java? kind regards, Jef

Sponsor:

#2 Jockel   Members   -  Reputation: 144

Like
0Likes
Like

Posted 02 May 2006 - 12:24 PM

If you have a background in Java just stick to it. Who cares in which language you implement a cool game? The algorithms are the same.
Maybe interesting for you: http://www.bytonic.de/html/jake2.html

For the question why people don't want to use Java: maybe because they already have some source done in another language which they can reuse, maybe because their knowledge is more broaden in another language, maybe because everyone is using another language, maybe there are more examples in other languages, and so on.

But believe me, Java is just fine (as maybe almost any other language).

#3 Fred304   Members   -  Reputation: 382

Like
0Likes
Like

Posted 02 May 2006 - 12:26 PM

Quote:
Original post by killingdjef
With such capabilities why wouldn't people want to use Java?

Because a lot of people judge java's performance based on how it used to be 10 years ago.


#4 JWalsh   Moderators   -  Reputation: 463

Like
0Likes
Like

Posted 02 May 2006 - 12:38 PM

killingdjef,

I would advise against using Java unless you have a particular interest in web games or cell phone games. Why do you ask? Well, because historically that's the only place Java games are used. Additionally, there is a performance difference between Java and C# (C# is 2 to 6 times faster )and especially between Java and C++ (C++ is generally 10 times faster).

If you're interested in a Java-style language you might look at C#. Its a managed language and has all the benefits of Java, in addition to which it has really nice reflection, which can be useful for dynamic coding (a replacement for scripting). C# has DirectX bindings (does java?) so you have access to powerful, hardware accelerated graphics. And finally, C# is already making its way into the game development industry as the primary language for Tool development and to some degree game development.

As an overview...
Java is STILL slower than C++ or C#. You can verify that HERE.
Java isnt used on XBox, Xbox360, or PS2 (though neither is C#)
Java isnt used on (most) commercial PC games unless they're web apps.

Learn either C# or C++...as that is what most industry professionals are using these days.

Cheers and good luck!
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

#5 smitty1276   Members   -  Reputation: 560

Like
0Likes
Like

Posted 02 May 2006 - 12:40 PM

You can target the XB and PS2 with C#?

EDIT: jwalsh, that "Shootout" you linked to is more than 3 years old, at the least. It can hardly be useful as a benchmark. I think you made Fred's point. They didn't even use JIT java.

#6 JWalsh   Moderators   -  Reputation: 463

Like
0Likes
Like

Posted 02 May 2006 - 12:53 PM

smitty1276: Where do you get that it is 3 years old?

According to the website the benchmarks were done with:

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

Unless I'm mistaken those are both 1-2 years old...and even if Java has improved in performance...so has C# and C++ (.NET 2005), unless you're stating that only Java improves in performance over time?

But even if it were 3 years old? Has Java gotten 10 times faster in 3 years? Or are Java games popping up on all consoles? Or perhaps World of Warcraft, GuildWars, Lineage 2, EQ 2, Or ANY other game you find in EB-Games were developed with Java?

Here's a "shootout" for you, perhaps thousands of video games released in the last 3 years...how many of them were Java games....Zero?

The point is the same. The best test of a market trend is to see what the market is doing. Sure, you could argue that "Java is just as good as C#"....but WHY? Would YOU knock on blizzard's door saying "Let me be a game programmer...I know JAVA!" They would politely say "Thanks, but we dont use Java...no one does."

#7 Aldacron   GDNet+   -  Reputation: 3273

Like
0Likes
Like

Posted 02 May 2006 - 02:57 PM

To help with your decision, check out some of these Java games:

Tribal Trouble
Puzzle Pirates
Wurm Online

Another great example is Puppy Games. They have some great shooters developed with Java. And if you spend some time at javagaming.org you'll find several others using Java to develop games.

You'll hear a lot of comments like those from jwalsh. He's right that there aren't any Java VMs on consoles yet. But that only matters to people who are developing games for the console market. Generally, that camp does not include indies and hobbyists. He's just dead wrong about the other two points he made. There are several commercial titles out there using Java. Aside from the games I listed aboce, you can find some in the retail space as well. There were a couple of Law & Order games in Java, Red Storm Entertainment used Java for some of their titles, there was a flight Sim coded in Java, and more. Google will help there. Or the games section at java.com. As for the speed point, this whole "java is slow" mantra is old hat. Just ignore it.

If the games I linked above don't prove that Java is a legitimate option I don't know what will. Maybe sales stats for the first year after Tribal Trouble's release? Maybe the fact that UbiSoft picked up PuzzlePirates for distribution in the retail space? Maybe the fact that NCSoft hired two of the developers of the JMonkeyEngine to work on an as yet unannounced project?

I recently wrote a blog entry about choosing a language for game development. I wrote it because people ask questions like this all of the time on these forums. The problem with asking here is that the forum visitors come from diverse backgrounds. Everyone has their favorite languages and are quick to spread misinformation about those they don't use. Really, if someone has never taken the time to really learn a language, then how can they have an informed opinion of it? Most people just parrot what they have hear others say.

The advice I give in my blog post is to avoid asking for language advice in general forums like this. If you want to ask others about the strengths and weaknesses of a language, the best people to ask are the ones who use it. Don't ask them to compare languages. Comparisons will usually result in biased answers and more parroting. Ask Java programmers what they like or don't like about Java. Ask C# programmers about C#. Ask C++ programmers about C++. The answers you get then will be more informed and you will be better able to use their opinions to help you in your decision.

Of course, it's always good to experiment yourself. The more languages you know, the better. But when just starting out to learn game development, it's best to stick with a language you are already familiar with. Learning game dev is hard enough. You don't need to overload yourself with learning a new language at the same time. Once you have the basics and know how to apply the concepts at a high level (i.e. in a language agnostic way), then is the time to start applying those concepts to new languages. Game development concepts don't change from language to language, only the implementation. When it comes time to go commercial, then the language choice becomes important based upon target platform, target market, available tools, and so on.

#8 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 02 May 2006 - 03:19 PM

jwalsh: what in the world? you think "Let me be a game programmer...I know C#!" would work well?? a)that would be the worst interview pitch ever. b)no one uses c# either...except for production tools! exactly where they use java as well.

overall, you win the prize for attempting to start yet another pointless flamefest. the main problem is, every criticism you have of java fits perfectly on c# as well. if pros still can't bear to use STL cause of not deterministic memory use, guess which languages they are *never going to use* for released products. go on, i'll wait. take a guess.




killingdjef: every advantage he listed for C# java has as well (though you'll have to stick to opengl...no problem, many people prefer it (and it works better if you need mac/linux compatability)). moreover, since it sounds like youre just starting off, either language should be pretty quick to get going. if you have experience in java go ahead and use that, plenty of hobbyists use it, even for major projects (jME is one, check out the lwjgl and java game development forums for some more great communities).

if you think youre going to use a lot of premade gui stuff (buttons, forms, etc) you might consider C#, as its UI system is a lot faster to get going and faster to run. if you're going to be doing straight graphics (either to a provided graphics object or with an API like opengl or directx), either language will do.

overall you had the right instinct. java will most likely not be included in a major game any time in the near future...its mostly used by indie projects and as a scripting language for the big boys). developers tend to have large c and c++ codebases, use other peoples engines, or are just plain resistant to change (see above thread...no offence to dave eberly, he's perfectly welcome to his opinion). it is far more important when you're starting out just to go with what you know and just produce something! nothing is more motivating than when your code starts working and first starts becoming playable.

don't listen to idiots, especially ones that think one language is going to get you hired. game development demands that you learn more and more to satisfy it, and you'll find yourself, if you stick with it, learning many new things far more valuable for job prospects than syntax structure.

#9 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 02 May 2006 - 03:24 PM

oops, that STL thread was here
http://www.gamedev.net/community/forums/viewreply.asp?ID=2315762

and what are System.out calls doing in benchmark tests?? but guess what, hes fine, cause he included this disclaimer (note: not to be taken seriously by language fanboys)

Quote:
Please note that all the disclaimers, warnings, and notes by Doug apply to this shootout as well. This is ncluding, but not limited to:

* ...some solutions as currently presented are unoptimized...
* ...please take the current results with a grain of salt...
* ...you might even find that I have horrible bugs in my testing method...
* I'm doing it so that I can learn about new languages, compare them in various (possibly meaningless) ways, and most importantly, have some fun.

And, above all:

* "There are lies, damn lies, and benchmarks".

and notes with every language that the benchmarks could be improved.

heres a hint: if your language performs that poorly in the "hello world" test (48th), maybe you shouldnt include a print string call in the other benchmarks!

#10 TheOther   Members   -  Reputation: 150

Like
0Likes
Like

Posted 02 May 2006 - 03:26 PM

A finished game in C++/C#/Java/VB/.NET/Python/Perl/Ruby/Torque/Blitz/OpenGL/Direct3D/Assembly/Win32/MFC /logo/Allegro/SDL/BASIC/Dos/XBox/PS2

beats any unfinished
C++/C#/Java/VB/.NET/Python/Perl/Ruby/Torque/Blitz/OpenGL/Direct3D/Assembly/Win32/MFC /logo/Allegro/SDL/BASIC/Dos/XBox/PS2

game.

Don't worry so much about what's "right" or "wrong" for games. Just finish 'em and the rest will fall into place.

#11 chollida1   Members   -  Reputation: 532

Like
0Likes
Like

Posted 02 May 2006 - 03:26 PM

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

#12 chollida1   Members   -  Reputation: 532

Like
0Likes
Like

Posted 02 May 2006 - 03:29 PM

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

Cheers
Chris

#13 dtaylorjr   Members   -  Reputation: 180

Like
0Likes
Like

Posted 02 May 2006 - 03:39 PM

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.

#14 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 02 May 2006 - 04:08 PM

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 ;)

#15 JWalsh   Moderators   -  Reputation: 463

Like
0Likes
Like

Posted 02 May 2006 - 04:51 PM

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.

#16 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 02 May 2006 - 05:25 PM

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.

#17 Promit   Moderators   -  Reputation: 7608

Like
0Likes
Like

Posted 02 May 2006 - 05:35 PM

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.

#18 smitty1276   Members   -  Reputation: 560

Like
0Likes
Like

Posted 02 May 2006 - 06:14 PM

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.




#19 smitty1276   Members   -  Reputation: 560

Like
0Likes
Like

Posted 02 May 2006 - 06:24 PM

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™ 2 Runtime Environment, Standard Edition (build 1.4.1_03-b02)
Microsoft ® 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.





#20 Mike2343   Members   -  Reputation: 468

Like
0Likes
Like

Posted 02 May 2006 - 06:32 PM

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






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS