Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (492)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Why should I use a Game-Engine like lwjgl or libgdx instead of Swing?  (Read 818 times)
0 Members and 1 Guest are viewing this topic.
Offline SnowOwl

Junior Newbie





« Posted 2014-03-05 13:54:30 »

Hey Guys,

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!!

greetz...
Offline trollwarrior1
« Reply #1 - Posted 2014-03-05 13:58:04 »

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..

Offline SHC
« Reply #2 - Posted 2014-03-05 14:06:26 »

@SnowOwl

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.

And once again, welcome to the forum.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Troubleshoots

JGO Knight


Medals: 36
Exp: 7-9 months


Damn maths.


« Reply #3 - Posted 2014-03-05 14:21:55 »

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.

Why are all OpenGL tutorials written in Brainf**k?
Offline ricardo

Senior Member


Medals: 2
Projects: 3



« Reply #4 - Posted 2014-03-05 14:23:40 »

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. Wink
Offline SnowOwl

Junior Newbie





« Reply #5 - Posted 2014-03-05 14:46:37 »

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

Greetz... Smiley
Offline jmguillemette
« Reply #6 - Posted 2014-03-05 14:56:12 »

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.

-=Like a post.. give the author a medal!=-
Offline SHC
« Reply #7 - Posted 2014-03-05 15:01:53 »

1) LWJGL uses OpenGL (for the graphic) and OpenAL ( for the sound). But what is OpenCL for?

OpenCL stands for Open Computing Language which allows you to write programs that are executed by your GPU instead of the CPU. This increases a lot of speed since GPUs are more capable than the CPUs.

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.

LWJGL Tutorial Series - Contents

Hope this clarifies your doubts.

Offline Varkas
« Reply #8 - Posted 2014-03-05 15:33:55 »

LWJGL is not a game engine, it's just a set of libraries.

Why use it? It can do some things that Swing can't do. It can do some things more efficiently than Swing does them. If you need that, use it. If you don't, let it be.

A game engine is one level higher than LWJGL though. It's a framework where you just plug in your functionality.

if (error) throw new Brick(); // Blog (german): http://gedankenweber.wordpress.com
Online opiop65

JGO Kernel


Medals: 154
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #9 - Posted 2014-03-05 15:34:56 »

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.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Preston

Senior Member


Medals: 4



« Reply #10 - Posted 2014-03-05 15:53:32 »

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.

I've just recently mentioned it here in the other thread: Libraries vs. Pure Java
Offline gouessej
« Reply #11 - Posted 2014-03-05 16:33:15 »

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.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (33 views)
2014-08-22 19:31:30

atombrot (41 views)
2014-08-19 09:29:53

Tekkerue (40 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (25 views)
2014-08-16 06:20:21

Tekkerue (37 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (49 views)
2014-08-09 21:09:32
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!