why are people trying to use Java2D to make games?

Wouldn’t not learning how things work be the same as jumping into trigonometry without any understanding of anything such as algebra, multiplication, addition, subtraction, etc… be comparable to jumping into something that uses OpenGL without knowing anything about OpenGl? If so then it’s a horrible idea to do so.

Back in the day (more than 3 years ago) most openGL games posted here didn’t work. I’m not sure if that was because the programmers used strange openGL functions or if the openGL drivers were really that bad. So if you wanted to make a game that just worked, you had to use java2d. That’s what i did and many others too.

These days it seems like openGL drivers have improved a lot so most games work. Maybe minecraft or openGL ES helped the situation, I’m not sure.

I agree that java2d should probably be discouraged now. The API is largely abandoned at oracle/sun. Most of the original engineers Chet Haas, Chris Campbell and even Dmitri Trembovetski (http://www.linkedin.com/pub/dmitri-trembovetski/2/511/ba8) have left oracle. The only java graphics API being worked on at oracle is that stupid one whose name I forgot which is ridiculously slow and is forever being hyped and re-hyped and always fading back into oblivion.
From what i understand libGDX and Slick2D help bridge the gap between openGL and java2D.

Of course is it not for consumers. And of course does the understanding of OpenGL allow you to do optimizing. But libraries like libGDX or whatever already use efficient rendering methods. If I would learn how OpenGL works I might be able to re-produce something similar one day, but what would be the point of that then?

That’s not comparable if you ask me. For algebra there is no ‘easier way’ or something. You are simply forced to learn it. But in the case of OpenGL you actually have libraries/frameworks which really simplify your work. Slick2D for example feels a lot like Java2D but uses OpenGL beneath. Do you have to know how OpenGL works there? No.

[quote]Slick2D for example feels a lot like Java2D but uses OpenGL beneath. Do you have to know how OpenGL works there? No.
[/quote]
Yes, if you want to do anything remotely awesome. Or you want to know why it runs at 15fps. Or why some strange rendering bug occurs.

Cas :slight_smile:

Wow, Java is considered low level these days. The times they are a changin’! ;D

Summary of this thread:

OpenGL (through LWJGL) is better than Java2D.

LibGDX and Slick2D make using OpenGL (Through LWJGL) easier.

Some people want to know how things work instead of blindly following whatever API they use.

Some people don’t.

You can’t convince someone that your method is better than theirs if they think theirs is better than yours. Whether yours is better or not does not affect anything.

Google is the answer

You should just get on with programming and worry about your code when you hit performance issues or a huge bug.

Some people need to do their research before joining a discussion and going on about stuff that is completely wrong.

Like I said, if you want to do something fancy. Optimization and making new lib are included. This too

I think everybody are using OpenGL to make their games in Java. Nobody starts a real game project in Java hellbent on using Java2D… that’s project suicide.

So to answer the OP, not all people are making games using Java2D. Most don’t, and very few do.

And as a personal preference, I like libgdx because it’s current and gives that crossover into android.

I wish there was a way to convert Java+OpenGL -> Javascript without having to use LibGDX. :emo:

I’m trying to step back and see the big picture for Java game development. Compare our community to other game development communities.

I see people here using Java2D and I think we should do more to push them toward Slick/libgdx/etc. Java2D is a tool that can be used to make games, but it is not a good tool for that task. By making this more clear, people would not have so much pain to endure and would be more productive at the same time.

I would even argue that we should not encourage users to use LWJGL directly.

If I came here for the first time and saw it filled with people dorking with long and cryptic Java2D and LWJGL code snippets, what impression would I take away? That these Java guys are just tinkerers messing with nasty and low level APIs? Is that something anyone that isn’t a complete noob would want to join up for?

Honestly I didn’t start this thread with the intention of making it a commercial for my OSS, but game development in Java can and should be easy and pleasurable. This is unlikely to occur if people choose the lowest level API they can find. As a community there doesn’t seem to be much focus on productivity.

Programmers are tinkerers, I get that, but our users seem to spend an inordinate amount of time tinkering. I’m sure this happens in all communities, but I get the impression it happens more here. Maybe this is due to our general disorganization of technologies? Whatever it is, I’d much rather see people use a lib that handles the game loop, loading images, drawing images, etc than to have those people slog through recreating all these things.

If your knee-jerk response is to ramble about these being fundamental concepts that every noob should struggle with and write from scratch: STOP THAT. You can be as academic as you like, but you are discouraging other people from being productive and actually writing games. You don’t need to have written poor game loops yourself to use Slick or libgdx. You really don’t need to know how much of a pain it is to decode an image and upload it to the GPU. You don’t need to know OpenGL or VBOs to call batch.draw(image, x, y). You can still learn these things over time, but there is no need to jump head first into hell right from the start. It is bad for our community to actually encourage people to get derailed and wander off into the weeds!

Java on the (mobile) client side is going to fade into oblivion anyways pretty soon. So all of these points are mood :smiley:

Well, I use java2d because I am just a hobbiest that nowerdays only really has time for java4k games… so java2d meets my needs perfectly.

Sounds like me exactly. I actually do not have some grandiose (or not so grandiose) vision/plan for any games I attempt to make… and instead I learn concepts, techniques that I find interesting and if it progresses enough into a game then fantastic, otherwise i drop the game. You might call that a lack of commitment or determination… but why should I toil to complete a game that I do not have fun making?? To me the game aspect is a by-product of learning and implementing something I find interesting.

And is it any better to have a noob that has issues with another library such as slick or libgdx and posts a question here but gets no answer or wrong answers because the members here are not familiar with these libraries?

All of the problems mentioned are a part of programming. If a n00b wants to skip over that, then they can do so. Those who are serious about programming however should not be pushed towards spoon-feeding. Java2D itself is a big improvement from the graphics apis of other programming languages (such as C++).

There have to be people who can actually program with the bare metal amongst the next generation or game programmin will die out when ther is no-one to write the new APIs.

I’m not saying LibGDX/Slick2D/lwjgl-basics are bad, I’m saying that we should not scream at new people to use them when they may want to tackle Java2D/LWJGL. The people who are going to be successful are going to be the people who do occasionally reinvent the wheel instead of taking someone else’s wheel. They will learn HOW things work and be easily able to transfer the concepts over to other programming languages if neccessary.

People who want to be a casual programmer and never get anything noticable out there are the people who will go for the easy-to-use premade-wheel libraries, and they will be happy.

People who take programming seriously/are n00bs with a slight problem will charge at the wall of Java2D and LWJGL and once the n00bs are filtered out, those that made it will go on to make Awesome games. And they will be happy.

There will forever be conflict between the real programmers and the other novice programmers. Novices will laugh at the real programmers for reinventing the wheel when other wheels are available, and the real programmers will laugh at the novices because they can’t create a wheel while their custom-made wheel is far superior to the one-size-fits-all design.

You can’t force a n00b to be serious, and you can’t force a serious person to be a n00b.
People are different. Get used to it.

I have tried LibGDX and I had some nice things done and like the possibility to produce stuff for both PC and Android. But I ended up learning more OpenGL because of the possibilities that I wanted to check out. It is even harder for me to learn cool techniques for nice visual effects without knowing the background. So I first go and learn the underlying structure with it’s way to do things.

I have a background of simple game makers. I used RPGMaker2000 a long time from 2002 to 2004. I was active in a community trying to get the best out of this limited engine. Still I didn’t make a complete game despite some minor projects I finished. I always ended up searching for new ways to achieve cool effects. Once I designed a Metal Gear Solid clone in 2D with smooth animations. But I did not want to go all the way and finish the game.
The possibilities were really limited but that was a nice challenge.

Then sometime in 2010 I took my first steps with Java2D. At first it was struggling with Images / BufferedImages and Graphics / Graphics2D and the need to get an idea of a good game loop and good timers. I got myself a copy of “Killer Game Programming in Java” and this helped me a lot. I finished my time with Java2D when I worked with 7 other students to create a bigger project about Carcassonne. We tried to get everything out of the limited possibilities. We made tricks with rotations and blending and pixel perfect collision testing. Now I felt really ready for going on to OpenGL.

So now, after taking a first look at LibGDX, I know that I want to learn more about how OpenGL works. I even have to, because I took a course called “Human Computer Interaction” and there OpenGL is used. It feels awesome to achieve those small goals step by step and always getting nearer to creating cool looking effects. g And sometime in the future I will be able to create small 3D games. :slight_smile:

I am this kind of person who WANTS to learn these things “the hard way”. Because my experience told me that this is the way that I really get to learn these things. I can’t trick myself into understanding it, I have to take one step at a time and put my hands on everything and ask questions. Then I will do almost anything wrong, just to learn again that it should be done some other way to make it work. This is the way to achieve true knowledge about these things for me.

… end of the story.

An interesting bit of history:

Years and years ago - 2000ish maybe - I was working on the BBC’s election programmes here in the UK and I was building the election results systems in Java for them. A pain point at the time was feeding the systems that generated all the fancy graphics and even the tickertape at the bottom of the screen, which were all written or made with various bespoke software and hardware solutions. I thought I’d have a crack at making a TV graphics output system that just talked directly to the results system saving a whole load of trouble. I discovered that Java2D was fundamentally crap; being unable to get a reliable and rock-solid 50Hz output was its main bugbear but also the APIs were very difficult to fathom and it left so much “unseen” stuff going on under the hood it was mostly just guesswork trying to get it to work at all rather let alone at 50Hz.

I solved this particular problem by making an OpenGL wrapper called JGLIB. Unfortunately I never did get the contract for the election graphics systems (which would have been nice as it was worth easily over £1m for a single night). In the end though I sold the system to APTN where it powers their story caption generators to this day. JGLIB got punted into the public domain and some helpful Danes came along and turned it into LWJGL.

Anyway the rambly point of all this is, I started out down this road because Java2D was absolutely no good for doing realtime graphics - that is the sort of graphics you want in games. It was harder than learning OpenGL from scratch, which I had to do.

The main problem I see with OpenGL and Java these days is how the really simple things are conflated into the most complicated solutions for beginners. Texture atlases! VBOs! Variable-delta game loops! Shaders!

You don’t need any of this crap.

I wrote my first game back in 2003. It had a fixed-rate logic and rendering loop - a glassy smooth 60Hz. It used the fixed-function OpenGL pipeline in immediate mode. It did, in fact, use texture atlases, but only when I started to fling a lot of sprites and animation about.

Believe it or not I carried on in this manner until 2010. Titan Attacks, Droid Assault, and Ultratron all used this supposedly outdated and ancient tech. I only upgraded to VBOs in 2010 because Revenge of the Titans was flinging literally thousands of sprites about in every frame and it was running a bit slow on an integrated laptop chipset. We only literally added shaders a few weeks ago, so we could do a fancypants anachronistic PAL CRT effect, and then later, the even fancier LOS rendering in Droid Assault.

You can use it too. It’s really, really easy, if you stop listening to all these clever clogs with their fancy tech and just concentrate on the simple task at hand.

Cas :slight_smile:

One other thing I learned along the way:

Learning every tiny bit of an API is hard, and my tiny brain is not big enough. Every time I figure out how to do something, I bung the code in a class somewhere and promptly forget about how it works afterwards.

So stuff like texture loading … I did that years ago and never looked back at it. This is programming! You only have to solve something once. It doesn’t take long.

Cas :slight_smile:

Java 2D <3<3<3

Found it very hard to get into openGL as an internet-taught java only programmer, most learning resources are for C and when people say ‘but it’s practically the same code you can easily get it working in opengl/jogl’ for me this has not been the case.

I even bought a book I found purely aimed at learning JOGL, only to find every single example no longer worked with current versions; not even minor changes would make it worked, so I immediatly moved to LWJGL :slight_smile:

I see the smiley, but it’s still hard to tell - was that “ha, ha … only serious”, or were you just baiting?

… and this is what’s wrong with a lot of programs released today. :wink:

To be blunt, as I am always blunt, knowing how things work under the hood allows you to write more solid and optimized code. Just linking things together in a way that works usually leads to a huge mess in the end, sure it runs, but you will have tons of memory leaks, extra CPU/GPU polls, and you will have no idea of how to fix those issues. A program is a work of art, not a hammer.

We already provide tons of examples from the red book, they work very well with JOGL 2.0. Replacing GL by another interface and using a profile are not difficult (and it’s explained in our Wiki, in several official tutorials and in the main user’s guide). If you don’t accept major changes in a public API (aged of more than 10 years if we include its ancestor “Jungle”), just stop programming. For example, Lucene 3 is very different of Lucene 1, I haven’t stopped using it in Jeti because some things were not working any more with the latest version, I took some time to port the code and it worked.

I agree with KittenKoder about the importance of understanding how things work under the hood.