Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm curious to know if there is an XNA-like library for Java; that is, a library that

  1. Handles the game loop - i.e. you just implement an existing method, and it will get called every frame.
  2. Handles the rendering - i.e. you just tell it what to render, it will take care of displaying it to the monitor, hiding implementation details such as hardware acceleration.
  3. Contains many useful methods for graphic, sound and user input options.

I'm interested in a library which supports both 2D and 3D options.

share|improve this question

5 Answers 5

up vote 14 down vote accepted

According to your first requirement, you are looking for a framework rather than a library.

jMonkeyEngine is a framework for 3D games (i.e. it provides the main loop as you ask for, similar to XNA) but it wouldn't be a good choice for 2D.

However, a game loop isn't a hard thing to write, and existing Java libraries handle your 2nd and 3rd requirements, so I highly suggest looking into a scene graph 3D library/engine or any 2D library, depending on if you're making a 2D or a 3D game.

Aviatrix3D, Ardor3D, Java3D and jMonkeyEngine are my recommendations for scene graph 3D engines.

For 2D libraries, you have JGame, or you can choose to use OpenGL for max speed and use LWJGL or JOGL. You could also just go with Java's built-in Graphics2D library, which would be an especially good option if you plan to deploy your game as an applet.


For going the built-in Graphics2D route, look at the source code to Metagun (click to play in applet form). It's a small but very well-written 2D Java game, and I think it's an excellent example of a small game; copy its structure and you have your optimal game loop/framework.

share|improve this answer

Slick is a nice 2D Java library based off of LWJGL. It handles the game loop, rendering, and contains useful functionality to implement sprites.

It comes bundled with many different demos and examples.

share|improve this answer
1  
Have to second this recommendation Slick is the best option I've come across. I've written several games with Slick and one with XNA and I would actually favor Slick for 2D projects. –  Alex Schearer Sep 2 '10 at 18:48
    
Slick is amazing for 2D projects. I highly recommend it. –  Bryan Denny Sep 2 '10 at 21:05
    
Slick isn't as well-known and appreciated as it should be. I've used it before and was pleasantly surprised at every turn how well it was designed. It's because of Slick that I prefer Java for 2D game development. –  Zach Conn May 10 '11 at 11:56

If you want a single framework to support both 2D and 3D the closest I have seen is jPct. It is 3D but inside their forums they have some tweaks to do 2D.

I recommend you go with Xith3D or Java Monkey Engine for 3D. And Slick or GTGE for 2D.

I'm writing a book about java game development, I already completed the chapters on the basics for 2D and 3D java game development, it can give you a starting point, look here:

http://code.google.com/p/lucu

Taksan

share|improve this answer

Although it doesnt support 3D, pulpcore is a good gaming framework. I havent personally used it, but i have browsed thru the code just to check it out, and it looks nice.

share|improve this answer

RedDwarf is a Java Game Engine. This is the old Project DarkStar that Sun use to fund.

share|improve this answer
    
RedDwarf is a Java network game "framework", but mainly the server part. Not really a game engine at all. –  Ricket Nov 11 '10 at 22:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.