Looking for where to Start with 2D games in Java. Help?

Hello, I’m new to this forum and I have looked around and it looks very helpful. I’m also rather new to java. Currently, I have taken an intro to Java course and learned basic Java syntax. I have (pretty much) mastered text based stuff, and would I’m interested in learning 2D graphics programming with Java. I just recently downloaded Eclipse and am playing with it as well. (Previously used BlueJ)

I was inspired by the game recently programmed by Mojang at the HumbleBundle.com Mojam, and I would like to learn to program games that are similar in looks. It’s called Catacomb Snatch, and you should be able to find screenshots on google. The graphics seem like they wouldn’t be too hard to code, but they released the source code, and after opening it with eclipse, it’s just WAY over my head. The biggest project I worked with using just text was a “Dungeons & Dragons” type text co-op adventure with 4 or 5 rooms (each a separate class), two playable characters (each a separate class), and 4 or 5 monsters (all from one class). This project ended up with only around 10 classes, plus a main class which housed the main method.

What I’m looking for I guess, is just where to start to go from a 10 class text game to a 20 class graphical 2D Shoot 'em up using lib, res, and src folders and files. That gap is where I’m stuck currently, and I’ve looked for a way to get across and haven’t found it.

P.S. In the one programming class I took, we made a PacMan game using Greenfoot towards the end of the year. It was terrible. Greenfoot took 2-5 minutes to load one world with 40 or so objects in it. I learned enough to accomplish a Shooter game in Greenfoot, but it would be slow, bulky and not nearly advanced as I would like. I’m looking to transition to more advanced programming, not simply improvise with the noob skills I have currently.

If you made it this far, thanks for reading my post and thanks in advance for the help! ;D

For 2D games, I would start with something REALLY simple. My first game was a Tetris clone. By starting with something simple like Tetris, you can focus on the basic constructs that go into making a game, (the game loop, handling input, updating graphics, game state, etc.) without having to worry about complex graphics (pretty much anyone can draw a Tetris block) or about AI. Once you have finished a game like Tetris, Pong, or Breakout, you will have a good idea of how ready you are to move on to more complex stuff.

As far as graphics go, you can start with Java2D, which I know a lot of people do. It’s pretty easy to work with and abstracts away most of the more low-level stuff. However, you might find it more useful, albeit more difficult, to start with something like Slick2D, as Java2D will only take you so far, and it’s likely that you’ll eventually want to move on to something else.

Edit: Personally, I have very limited experience with Java2D, and made my first game with OpenGL, so it is possible. I’ve only heard from others about the performance issues concerning Java2D as things get more complex.

Ok, that sounds great. I read some other “Help me, I’m New” posts, and I was thinking about starting with Slick2D because it sounded better than Java2D. I think I’ll try to create Pong to start with.

2 questions

  1. How is OpenGL related to Slick2D?

  2. Do you know any tutorials that I could go to in order to start learning Slick2D?

  1. Slick2D uses OpenGL underneath, it just uses a friendly, Java2D-like API so it’s great for beginners.

  2. The Slick2D site should have many helpful links on the right side.

Also, this post should explain the whole situation with java gaming.

Alright, thanks for everything. Hopefully I’ll have Pong up and running in no time! (no time=hours of debugging and practice)

Start with Java2D and the zetcode tutorials: http://zetcode.com/tutorials/javagamestutorial/