I'm new in the game delevopment with java. And now I want to learn more about Game Engines.Until now, I only heard of Swing. Than I found out, that there are more game engines like lwjgl, libgdx, etc.

Now my problem:Why should I use lwjgl or something like this? What makes it "better" (better is a bad word for it I think).And whats the difference about lwjgl / libgdx? Where are the pros and cons?

Hope you can help me there. Please don't link me to the homepages of the Engines... Yes, there are informations about it... But only generally information, but I want to get a little deeper.Thanks for help!!

LWJGL - Light Weight Java Game Library. Not an engine. LWJGL contains these things - OpenGL binding, OpenAL, Keyboard, Mouse, Controller input and some more 'tiny' features. I guess you could say the backbone of the game.LibGDX is a game framework. It isn't an engine. It is like LWJGL, but has some higher level features and some more really awesome stuff.

You cannot make 3d games in swing. You can only make really simple 2d games in swing. The reason is performance. opengl is just plain faster..

A hearty welcome to the forum. First of all, it's not impossible to do a game engine in swing, I've made one and the author of the book "Game Development in Java", David Brackeen had even made a 3D engine using just swing. But the main reason is performance.

Swing is designed to be a UI toolkit rather than a library to build games upon. To get the good advantage of graphics card, we need some driver level libraries like OpenGL or DirectX. LWJGL is a java wrapper for OpenGL for graphics and OpenAL for audio along with OpenCL and is not a game engine. LibGdx is a game engine which uses LWJGL as one of it's backends to run on desktop.

You cannot make 3d games in swing. You can only make really simple 2d games in swing. The reason is performance. opengl is just plain faster..

Though what you're saying is generally correct, I find this quite misleading. First off, it's possible to create 3D games in Swing, though impractically difficult. Also, you cannot directly compare the speed of OpenGL and Swing. OpenGL is a low level graphics specification, however Swing is a high-level graphics API.

Op: LWJGL contains an OpenGL binding which allows you to take advantage of the speed of the GPU, by manipulating data at a low level. Doing so allows you to optimise the handling of data to increase the performance of your game. It also makes 3D graphics programming much easier than if you were to have to do it in Swing for many reasons which I can't be bothered to go into. LibGDX on the other hand is a mid level framework which hides most of the low level code. It is based on OpenGL ES which allows you to develop multi-platform games which work on Desktop, Android and iOS.

Depends on the game you want to make. If you want a simple game, a turn based game or a game with heavy gui, you should go with Swing. I was making this game without external libraries. I had good performance with multiple layers, big scrollable map, collision detection, animated tiles, etc.Also swing is good to practice in your first projects. Just my opinion.

@ricardo thanks for your opinion. I still made a game with Swing (The game is called Coloretto - it's a card game). And now I'm searching for other ways to develope games. It should be a 2D game for the first. But maybe I want to switch to 3D later.

@SHC and Troubleshoots.First of all: Thank you!

But now I have more questions. 1) LWJGL uses OpenGL (for the graphic) and OpenAL ( for the sound). But what is OpenCL for?2) Is the only difference between OpenGL and OpenGL ES that OpenGL ES allows you to develop multi-platform games?3) Is there a lifecycle how you can show how LWJGL works? (If not, doesnt matter)

For 2D games there are lots of options.. the only real answer is use what works for you.

When talking about lwjgl and libgdx the real trade off is they are wrappers exposing opengl to your java code. If your game will not benefit from opengl then there may not be a compelling reason to use these. On the other had these are both libraries suited to game development and opengl will provide high performance graphics, but they will be harder to work with then pure swing for very basic tasks like making buttons.

2) Is the only difference between OpenGL and OpenGL ES that OpenGL ES allows you to develop multi-platform games?

No no, you misunderstood the terms OpenGL and OpenGL ES. The former is Open Graphics Library and is a low level specification that interfaces the graphics card. The latter is Open Graphics Library for Embedded Systems. It is a subset of the OpenGL for rendering 2D and 3D computer graphics such as those used by video games, typically hardware-accelerated using a graphics processing unit. It is designed for embedded systems like smartphones, computer tablets, video game consoles and PDAs.

3) Is there a lifecycle how you can show how LWJGL works? (If not, doesnt matter)

LWJGL basically works by using JNI code to wrap the native libraries and make them available for java. OpenGL is actually a C specification, so LWJGL requires the use of JNI. If you want to learn more about LWJGL, checkout my tutorial series here.

Ricardo, using Swing is a waste of time when developing games. I would never recommend anyone beyond a new programmer to use Swing because eventually you will have to touch some low level graphics API like OpenGL or DirectX. Why should I spend my time learning a useless API (for game development, Swing is good for other stuff) when I'll have to learn OpenGL anyway? Swing is easier, yes, but that is no reason to not learn OpenGL. Its just laziness.

I'm new in the game delevopment with java. And now I want to learn more about Game Engines.Until now, I only heard of Swing. Than I found out, that there are more game engines like lwjgl, libgdx, etc.

Now my problem:Why should I use lwjgl or something like this? What makes it "better" (better is a bad word for it I think).And whats the difference about lwjgl / libgdx? Where are the pros and cons?

When you're new to Java, you could like the new JavaFX multi-media library, which is part of Java 8 (being released this month). It's meant as an alternative to or rather successor of Swing, actually. SUN's Swing veteran Richard Blair is also a key architect in the Fx library.

In contrast to the older Java2D (which you probably mean when you say Swing), the Fx library provides true hardware accelerated 2D and 3D with an easy to learn but solid scene-graph "engine", also suited for casual games.

Maybe you should have looked at existing topics about LibGDX and Swing... LibGDX has several backends, one of them is based on JGLFW, another one is based on LWJGL, another one is based on JogAmp (JOGL, JOAL, JOCL)... LibGDX is a middle level framework, JogAmp and LWJGL are 2 sets of (low level) bindings. I wouldn't use Swing for games even though GLG2D allows to get a better hardware acceleration with it, except for extremely rudimentary games.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org