Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (537)
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  
  Graphics, which "library" to choose?  (Read 3805 times)
0 Members and 1 Guest are viewing this topic.
Offline Archibald

Junior Member


Projects: 1



« Posted 2012-02-13 12:08:20 »

Hi

I'm a C/C++ programmer, but I got a bit tired of my precious language and I had a long break so my awesome hand made libraries got outdated (and I forgotted what these did and where I put them) so I decided to give Java a try Smiley

My needs: I will be doing rather low CPU intensive games (strategies, RPGs), I'm also not planning to use heavily 3D ever again in my life, so the maximum performance is not critical (still, it should be fast). I will probably be doing both Application and Applet games, so the code size is important (the more standard components/libraries the better).

My skills: SDL, OpenGL, DirectDraw5.0, Zx-Spectrum/C64/Amiga Basics. I'm familiar and fine with these, I would prefer a graphic library that is similar to one of these (I just beg, no libraries that are like D3D and generally nothing similar to Microsoft interfaces if possible).


So, which gfx library I should choose (and what options do I have, since whenever I check any source code I see a completely different library Cheesy)?
Generally, I need these two things, if possible one libarary/package/whatever should cover them both, if not I can go for 2 separate setups:
1) Standard 2D (blit, stretch, alpha, rotation or at least mirror would be nice, load image, draw rectangle).
2) 2D+OpenGL (I'm not interested in learning anything other than OpenGL when it comes to 3D, but I believe in Java you can use only OpenGL anyway?).
Online kappa
« League of Dukes »

JGO Kernel


Medals: 75
Projects: 15


★★★★★


« Reply #1 - Posted 2012-02-13 12:12:56 »

Go with either Slick2D or LibGDX, best 2d Java games libraries. Both use a high level API so pretty fast to get stuff done (although LibGDX also has a low level API available) and they both use OpenGL behind the scenes so they are pretty fast for 2d games. If you want to go pure OpenGL then go for one of the low level OpenGL Java bindings like LWJGL.
Offline theagentd
« Reply #2 - Posted 2012-02-13 13:38:04 »

My needs: I will be doing rather low CPU intensive games (strategies, RPGs), I'm also not planning to use heavily 3D ever again in my life, so the maximum performance is not critical (still, it should be fast). I will probably be doing both Application and Applet games, so the code size is important (the more standard components/libraries the better).
Lol, it almost sounds like you're implying that Java is slow.

I'd recommend Slick2D, or if you're interested in more advanced graphics or just low-level graphics in general you can just use OpenGL through LWJGL or JOGL. Everything's identical except for pointer arguments, which will need to be put into Buffer objects in Java. However, there are lots of convenience functions for fixed-size arguments, so the only time you really need to use Buffers is pretty much when you're uploading or reading back data to/from a VBO or a texture.

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

JGO Ninja


Medals: 38



« Reply #3 - Posted 2012-02-13 13:59:50 »

If you don't want to dig into OpenGL and want to avoid the native bundling, you might want to take a look at some java only libraries, like e.g. PulpCore: http://www.java-gaming.org/topics/pulpcore-tutorial-1-stages-scenes-sprites-and-hello-world/24461/view.html

Mathias - I Know What [you] Did Last Summer!
Offline Archibald

Junior Member


Projects: 1



« Reply #4 - Posted 2012-02-13 15:02:29 »

Lol, it almost sounds like you're implying that Java is slow. If you can't write a game in Java because it's "too slow" then you
I did "HelloWorld" in Java only yesterday, so it would be too early for me to have an opinion if it is slow or not Smiley BTW, your sentence was cut in half for some reason, please finish it because it sounded interesting.

I meant that the GFX library/solution I look for doesn't need to be the fastest one because most likely I won't need the full speed. So, if there is some library that is slighly slower but considerably more convenient I could use it.


Hmmm, Slick2D is 500kb which will need to be included (I assume .jar is already compressed?), so it is not an option for an applet... OK, maybe like this, what options do I have when using the standard bundled with Java graphics modules (without downloading anything)? How many of these there are (I have even seen one source where everything was done by pixel, even display of text, so I'm a bit confused)? Also, can I use OpenGL without any downloaded library?
Offline evilfrenchguy

Junior Member


Medals: 3



« Reply #5 - Posted 2012-02-13 15:13:17 »

You can use Slick in Applets. Just package slick.jar with your class files on the web server.
Online kappa
« League of Dukes »

JGO Kernel


Medals: 75
Projects: 15


★★★★★


« Reply #6 - Posted 2012-02-13 15:14:30 »

Hmmm, Slick2D is 500kb which will need to be included (I assume .jar is already compressed?), so it is not an option for an applet
That size shouldn't really be that much of an issue with the fast internet connections these days, many web pages are now larger than that e.g. the BBC front page is 999kb, the YouTube front page is 956kb, Twitter page is 1.76mb, etc. Even flash games are starting to average between 5mb - 32mb in download size. Even all that is insignificant considering the amount of bandwidth that is casually spent watching SD/HD video's online nowadays.

If you are really worried about the download size, then you can use a combination of tools like Pack200, LZMA and ProGuard with Slick2D which should get it down massively (including its dependencies) to under 300kb.

In any event if you intend to go only applet then the above mentioned PulpCore library is an excellent choice.

OK, maybe like this, what options do I have when using the standard bundled with Java graphics modules (without downloading anything)? How many of these there are (I have even seen one source where everything was done by pixel, even display of text, so I'm a bit confused)?
With just the standard Java bundle there is the AWT/Java2D option which might be good enough for you but for any serious games its a bit crappy.

Also, can I use OpenGL without any downloaded library?
There is currently no OpenGL binding included with the standard Java library, so you'll have to use an external library like those mentioned above.
Offline theagentd
« Reply #7 - Posted 2012-02-13 15:49:50 »

Lol, it almost sounds like you're implying that Java is slow. If you can't write a game in Java because it's "too slow" then you
BTW, your sentence was cut in half for some reason, please finish it because it sounded interesting.
Uh, I wrote that and then realized how insulting it sounded but forgot to remove that... >_> Sorry...

Myomyomyo.
Offline Archibald

Junior Member


Projects: 1



« Reply #8 - Posted 2012-02-13 16:35:16 »

So, there is only one graphic library boundled with Java, the one called AWT? No other options?

Quote
but for any serious games its a bit crappy.
You mean crappy because of convenience of coding or because of performance?


What about "JavaFX"? I found it via Netbeans examples, it allows some nice things, and even has some 3D (althrough it does not look like OpenGL at all). What's that? Or to be more precise, if I distribute the jar file written as JavaFx will it work on all machines without the need for a user to download anything?


Lol, it almost sounds like you're implying that Java is slow. If you can't write a game in Java because it's "too slow" then you
BTW, your sentence was cut in half for some reason, please finish it because it sounded interesting.
Uh, I wrote that and then realized how insulting it sounded but forgot to remove that... >_> Sorry...
Don't be shy Smiley The odds are you are unable to sucessfully offend me, I'm rather hard skinned. I'm here to get information, if I'm insulted or not in the meantime is of extremely low importance.
Offline theagentd
« Reply #9 - Posted 2012-02-13 16:44:15 »

AWT is the standard graphics library, but in my opinion it is way too unreliable and slow for games. I guess it will work fine for simple 2D games since it is accelerated by hardware to some extent (this is the unreliable part), but Slick2D is from what I've heard somewhat similar to Java2D but based on OpenGL, so I'd definitely recommend that over Java2D (= AWT) for you. No idea about JavaFX...

Myomyomyo.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online kappa
« League of Dukes »

JGO Kernel


Medals: 75
Projects: 15


★★★★★


« Reply #10 - Posted 2012-02-13 17:29:26 »

JavaFX is Oracles new RIA framework which is intended to replace the ancient AWT/Swing/Java2D libraries. However its not actually part of the standard Java Standard Edition platform (and only started getting bundled with recent Oracle Java 7 releases, it will be a few years before this overtakes Java 6 and becomes widespread enough to be worth targeting). JavaFX is available for Java 6 but its a separate (rather large) download. So IMO not really a mature enough library to target yet.
Offline dishmoth
« Reply #11 - Posted 2012-02-13 19:45:17 »

Just a comment that if you're using Slick2D or libGDX (or anything OpenGL-based) for an Applet, then the user will have to click on a pop-up warning message before they can run the game.  Not a big deal but it might scare a few potential players off.

You can browse through the Featured Games/Showcase sections to get an impression of what's possible with the different technologies.  (I'm sure people will be happy to tell you what their games are created with if it's not obvious.)

Simon

Online princec

JGO Kernel


Medals: 343
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #12 - Posted 2012-02-13 20:25:31 »

I'd shy away from applets as a serious method of distribution if I were you. They're notoriously unreliable and fragile.

Cas Smiley

Offline pitbuller
« Reply #13 - Posted 2012-02-13 20:38:49 »

Pick libgdx and you get fast and high level 2d api. Really fast low level opengl es bindings. Tons of utility. Total freedom how to code things, nothing is forced.
Best part is that you can target all desktop platforms and android with single code base. In future there might be more backends too.(there is some experimental with webgl etc)
Offline Archibald

Junior Member


Projects: 1



« Reply #14 - Posted 2012-02-21 23:26:26 »

Just a comment that if you're using Slick2D or libGDX (or anything OpenGL-based) for an Applet, then the user will have to click on a pop-up warning message before they can run the game.  Not a big deal but it might scare a few potential players off.
So, basicly with an Applet I have to stick with AWT Sad And even then there will be some problems.

OK, assume desktop only (including mobiles).
Can you write something about libgdx vs LWJGL? Also, I haven't noticed libgdx subboard on the forum, where it is discussed?
Offline sproingie

JGO Kernel


Medals: 202



« Reply #15 - Posted 2012-02-21 23:33:18 »

libgdx, along with the higher level stuff like asset management, provides an OpenGL ES API.  This API is just a front end, not an implementation.  LWJGL is the implementation of the OpenGL API that libgdx uses on the desktop (or at least the interface to the system's implementation), and the Android GLES implementation is the one it uses on Android.

libgdx has its own forums: http://www.badlogicgames.com/forum/
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.

CogWheelz (17 views)
2014-08-01 22:53:16

CogWheelz (15 views)
2014-08-01 22:51:43

CopyableCougar4 (20 views)
2014-08-01 19:37:19

CogWheelz (19 views)
2014-07-30 21:08:39

Riven (27 views)
2014-07-29 18:09:19

Riven (16 views)
2014-07-29 18:08:52

Dwinin (14 views)
2014-07-29 10:59:34

E.R. Fleming (42 views)
2014-07-29 03:07:13

E.R. Fleming (13 views)
2014-07-29 03:06:25

pw (44 views)
2014-07-24 01:59:36
Resources for WIP games
by CogWheelz
2014-08-01 18:20:17

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

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

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

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

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22
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!