why are people trying to use Java2D to make games?

Graphics are a great way to pull people in to buy your game, but the level of immersion felt is completely done by the game play itself. If you want proof, take a look at books. 0% graphics, 100% immersion. They can inspire you and immerse you in the same way a great game can. To be honest, I believe it is very distracting to game makers to have all these extra features that OpenGL gives. There is a lot more people now thinking they’ll be able to make an AAA title game on their first try.

It is just an argument about game creation speed vs. learning game programming.

For all you aspiring game creators out there, the best course of action is to learn a library. LibGDX is pretty much the best decision if you want to make sure your game will be played by the most people fast. If you stick directly to the library defined functions, you should be able to create your game vision decently without much issues. The problem is when you try to achieve something that the library API doesn’t show you.

Enter learning game programming…

For those of us who started with Java2D or OpenGL, we have a deeper understanding of the underlying technologies. When the LibGDX library comes to us with a limitation, we are much more equipped to deal with the problems than those who decided to take the library learning route. The sad part is, those who learned the library first will have it 150% harder to learn Java or OpenGL because they will have no basics to fall back on.

What does this mean?

It means that time is truly of the essence. Game designers have to create a good plan for themselves.

Learning the library first will get a game out faster in most cases. But, you will not have a fail safe if you find the library documentation or functions limited. Designers who take this route have to be prepared to not get every single feature in their game, and just get used to working within the limits of the technology.

Learning the language is more like a journey. Most of the things you’ll learn from Java2D you’ll be able to take with you when you code OpenGL, and work with libraries like LibGDX. You’ll have a building tool set that’ll last you no matter what new technologies or libraries emerge. When problems occur, you’ll be able to spot them and adapt much easier.

People have to realize that there is more than one route to a good game…

For us programmers, building a good tool set will make sure we will be able to survive. We are the architects, the builders of the programming world. When Java is faced with destruction from a flooding river, we are the ones with the most knowledge that’ll get a moat built of OpenGL to keep Java from going under. We are also the ones who can build games, but most of us are always looking and preparing for the next wave of destruction.

For the game designers, they invested in property in our Java world through libraries. Some of these properties are bustling cities, like LibGDX. Others are going down in the suburbs like Java2D. All of our community is important to game creation. People who live in the city have the dreams to create great games, but they are confined within the structures that they live in.

Where do you fit in this world?

That is the question we should really be asking ourselves before even thinking about game creation.

A couple more thoughts thrown in to the mix:-

  1. Every tool you use to make a game has to solve some problem you’ve got, otherwise you’re just wanking around creating problems for yourself. I started out using OpenGL because it solved the problems I had, which were basically performance, features, reliability, and portability. Ease-of-use is a bit of a harder one to nail down because basically if the API you’re using hasn’t got the features you want then trying to bend it to your will can get extremely complex and frustrating. OpenGL solved this by being right at the very bottom of the graphics stack; it can be bent in any direction.

  2. Missing from a large majority of game developers is some sense of what is shit. I mean, you create something, get it out there, feel all proud and that… but if you really took a critical eye to your own work, you could probably come up with 100 things wrong with it straight away. And the surprising thing is that you won’t actually spot any of the massive areas of shitness that the other 50,000 people who see it will instantly spot. Like for example, there is this general attitude amongst developers that it’s ok to make 2D games that don’t run at 60Hz. It isn’t. Everyone else who plays your game instantly notices and compares it to all the games they played at 60Hz and it instantly looks and feels shit to them. You might also think, for example, that you can get away without antialiased sprites these days. Unfortunately there is a shrinking section of the population who actually remembers real pixel art and a very large and growing section of the population who never saw it the first time round. Your graphics look like shit to them. And then there’s sound. It’s actually one of the most fun bits to do of a game and also surprisingly one of the most important but it’s almost always a total afterthought. And woe betide anyone trying to use the standard Java Sound APIs to do it. (Btw: MIDI is shit. Please. Just don’t do it. You might think it’s great but it really does help to try and put yourself in the shoes of, uh, some other million people and guess what their reaction will be to it)

  3. There are awesome games that don’t need performance, or even many features. If you don’t need performance or features particularly then Java2D is probably a great choice, although one might question again why you’re using a low-level language at all if this is the case.

Cas :slight_smile:

princec is sadly right on all accounts.

If you show someone a game, the first thing they look at is graphics. If all your game does is look good, they would still think it is better then a game that you could actually play because it is super purdy. Sound is another animal all together. Most people will not notice much about sound when it is done right. If you do it wrong, then it drops the game to shittery. Even if everything is super polished, people will still find thousands of things that are legitimately bad. Try taking a friend that knows nothing about programing and showing them some of the stuff on here and you will quickly find out how truly ugly all the games on here are. (Not being discouraging, but our stuff is ugly) You need every edge you can get and java2d is like taking a stone to it.

I watch a video someone posted on here about totalbasket or something reviewing Titan Attacks. He liked it but the big thing he liked was the graphics and retro-ness. He didn’t talk about game play much at all but boy did he mention how he would buy any remake game that had that style of art.

I try to keep everything I do looking at least some what presentable and even then it is months of polish behind most flash games today. If you are at all serious about making a game more then solitaire, then you need to move on from java2d.

@princec
how many times did you say shit?

[quote]Graphics are a great way to pull people in to buy your game, but the level of immersion felt is completely done by the game play itself. If you want proof, take a look at books. 0% graphics, 100% immersion.
[/quote]
Apples and oranges. Games are visual/auditory media, whereas with books you become immersed through your own imagination.

When a game’s frame rate drops, or when the sound glitches, or when the GUI looks like something from Windows 98, the effect is lost.

The rest of your post is pretty incoherent, and I’m not sure what you are trying to say.

Learning LibGDX will not hinder your ability to learn OpenGL. In fact, it’s probably much easier to learn the OpenGL pipeline through a library like LibGDX. The design of the API forces you to think about textures, vertices, batching, matrices, and even shaders

Whereas with Java2D these concepts are foreign. The graphics programming you learn from Java2D will not translate well to the OpenGL pipeline – “square peg in a round hole” – nor will it prepare you for matrices, shaders, vertices, or anything else of the sort.

Apples and oranges. Games are visual/auditory media, whereas with books you become immersed through your own imagination.

When a game’s frame rate drops, or when the sound glitches, or when the GUI looks like something from Windows 98, the effect is lost.

The rest of your post is pretty incoherent, and I’m not sure what you are trying to say.

Learning LibGDX will not hinder your ability to learn OpenGL. In fact, it’s probably much easier to learn the OpenGL pipeline through a library like LibGDX. The design of the API forces you to think about textures, vertices, batching, matrices, and even shaders

Whereas with Java2D these concepts are foreign. The graphics programming you learn from Java2D will not translate well to the OpenGL pipeline – “square peg in a round hole” – nor will it prepare you for matrices, shaders, vertices, or anything else of the sort.
[/quote]
Well, comparing games to film is the exact same type of comparison, like apples and bananas. Games immersion comes through the actions you do within the game. Movies immersion comes through connecting with the characters and story. I would like to believe that people don’t play games for the cut scenes alone.

To be more concise with my previous point post, it is this. Just like you used LibGDX to create an easier jump into OpenGL. People can use Java2D for a better jump into LibGDX. You need to understand the basics of programming in order to use the underlying libraries correctly.

Most gaming problems are not because of drawing issues, they are because of logic issues. I can say that without any doubt. Most people who can’t build Pac-Man on Java2D, will not be able to build Pac-Man on LibGDX or OpenGL. It has nothing to do with the hardware, people just can’t figure out how to make code do what they want.

For those who just want to get games published, using a well-made game library will get it done. Point-and-click game engines like “The Games Factory” are fully capable of creating games. However, it comes with the price that you will not manually be able to change the coding. That is the price for using libraries, you can’t always get everything you want.

I’d really like to see an increase in graphical games for Java. However, we are just not there yet technology wise. If the JVM could target X-Box Live, PS Store, and other console venues, this discussion would not exist. The fact is, we need more games period. It shouldn’t matter the technology as long as we have a healthy community that continues to produce.

It will be a struggle regardless of the library you choose to start with, but choosing LibGDX will make the experience much less painful.

Person A spends their first year learning to use Java2D. They learn how to program in that time, but they’ll still be unprepared when migrating to OpenGL.

Person B spends their first year learning to use LibGDX. They learn how to program. They will also write more games, and less boilerplate. Their games will run faster and more reliably across systems. Their games will be playable on a variety of platforms including mobile and HTML5. They will have a richer community of game developers (forums, IRC), and more game-development geared documentation/tutorials. They will be more comfortable with textures, matrices, vertices, etc. And after it all they will be much better prepared to use lower level OpenGL (which, in fact, they may never need).

Why is this still a discussion!? ??? You’d have to be a fool to recommend Java2D as a viable alternative for newcomers.

The fact is, Java2D is useless beyond the very small confines of the Java platform. Knowing OpenGL not only lets you understand how Java2D might work under the hood and graphics processors in general, but also let you move on to Android coding, iOS, and Playstation, and will give you a steady foundation into DirectX as well. The bigger picture is that Java2D is an obsolete, stagnant API that lives in a wasteland; the future is OpenGL (ES). So get learning that, from scratch if you really want to do something useful with your time beyond Java.

Another fish for the kettle - back in 2000 when I started doing graphics in Java, Java2D was considerably more rubbish than it is today. It’s made a lot of improvements in 12 years.

Cas :slight_smile:

My 2p for Java2d - it’s a powerful and flexible drawing API which produces high quality images with near pixel-perfect accuracy between platforms.

You’ll notice that nowhere in the above sentence does the word ‘fast’ appear. For the J2D team, ‘fast’ is not on their list of priorities, only that the performance is ‘adequate’.

Fact - you NEED to use OpenGL directly or using library to make ANY more advanced, good looking game. I would not recommend Java2d for anything related to game programming, with exception of 4k games and minigames.

After all, I think that… Java2d is good for newbies. Why? Java2d API is very simple, you don’t need to make your own texture loaders, camera classes and stuff like this, so I think it is good if your first (mini)game is made in Java2d.

Yes, quite! Somewhere the good advice to not use Java2D for (most) games turned into a general slanging match at Java2D for not being what it was never designed to be. As a general purpose graphics toolkit, it still has a lot of other uses.

I generally agree with most of what you’ve said, but those two statements don’t exactly match up, assuming you’re suggesting (as per recent JS thread) to use OpenAL. If you ignore all the cruft in the JavaSound API (Clip, Port, Control, etc.) the direct mixers and output lines give you far lower-level interaction with the soundcard - it’s about as close-to-the-metal as you can get without working with each platform’s sound API natively. It would be possible to implement something similar to OpenAL on top of it.

The general advice that most people should choose a decent library still holds, though. Audio is often an afterthought, and that goes for audio code too - there’s about as much to learn about doing low-level audio programming as there is about low-level graphics! A decent JavaSound backed library can be as stable and usable as OpenAL.

hmm … MIDI could potentially be interesting again in a Java 7+ world. The Gervill software synthesizer now built into the JRE is actually a great bit of code. Mix that with a decent customized sound bank, and you’ve got a powerful and fairly easy to use live DSP system for background music and SFX.

Every time we tried midi in computer science we kept getting illegalaccessexceptions unless we were admins. Most people aren’t admins on the computers they use.

If you want sequenced music (which is the common reason for wanting midi) then there are several better alternatives like .xm or .s3m, some of which have open source players already available. They support more feature than midi which will make your music guy happier. And you don’t tie yourself to a VM release. :slight_smile:

Using MIDI to play music is like using SVG to render sprites. Don’t! Make OGGs and stream them! And pre-render your sprites into an atlas while you’re about it! :slight_smile:

Cas :slight_smile:

pre-render into an atlas? Not sure what you mean there.

Take your separate textures, render them into a single texture and use texture coordinates to address them. This cuts down on texture binds, which are quite expensive.

I kind of wonder how bindless textures will change the picture there though… (edit: looks like not at all, bindless graphics are for buffers, but don’t appear to replace texture units)

Yes, pre-render if it’s a static thing - I did say “live” system. If you want to do some interesting stuff where SFX and music respond to player actions though, Gervill might be an interesting way to achieve that. Combine that with JFugue as well and you’ve got an interesting system for evolving and adapting music at runtime (note the comment on the JFugue front page about music responding to game states! :wink: )

As well as noting the “live” comment (I’m not really meaning sequenced music - the fact that it involves using MIDI messaging is incidental), MIDI combined with Gervill (SF2, DLS, etc.) potentially offers more features not less. And whether your music guy prefers mod files really depends on the music guy - they have their own limitations!

Oh, and you’re not tied to a VM release, you can ship Gervill by itself.

btw - I only brought this up here as Cas mentioned not to use MIDI earlier. I generally agree with that comment (as regards MIDI files) but we shouldn’t disregard a rather good sound processing system embedded in the JDK just because it needs driving by MIDI messages - they’re just method calls really! … And, I have a pathological need to act as devil’s advocate at times! ;D

Just as an aside: gamma space rendering is wrong. It’s worse wrong the not pre-computed alphas. Go into a dark room and shine two identical flashlights with new batteries such that the spotlight overlaps…or go look at the moon. End of aside.

On This Argument:

Just stop it.

Nobody cares what is better. You can try your hardest to convince someone that you are doing something the best way, but as long as they think they’re doing it the best way, there is no way to convince them otherwise.

You think LibGDX is the best? Good for you. I don’t care, and neither does anyone else who just uses LWJGL. There is no way you can convince us otherwise, and there is no way we can convince you to use LWJGL.

The fact that Java2D is useless for making games is irrelevant. Those who use it don’t care if your API is better. They just want to make games with it, and change over when they feel like it.

A person’s idea of laziness (or anything for that matter) is their own. If they want to share their opinion, then they have the right to. You can’t stop them. They can’t stop you from sharing your opinion.

Just shut up and make some games!!! >:(

You remind me that some C++ programmers think we are lazy because we use Java. I think that there are tons of ways to learn game programming as I explained here but those who succeed in creating games are not lazy, it requires some time not only to create them but to learn how to achieve that.

I spend so much time in writing tools and my main game is currently not very good, I’m happy when I learn that some “lazy” guys use them to make their own game(s).

Well I know what atlas are and actually in my engine you can make them on the fly I just was not sure if you were referring to something different.