[java] Looking for an Easy Java 2D API

Started by
7 comments, last by Glass_Knife 14 years, 1 month ago
I'm currently in the planning stages of a project for an AI class at my university, and I'd like my project to be game-oriented. I have a lot of ideas for the project, but since the class doesn't focus on AI as related to video games, I'll be doing a lot of research in my own time. I could do a simple text-based checkers or chess project with game trees and path finding, but I'd prefer to work with graphics and modern video game AI. However, I do not want to spend a lot of project time struggling to learn graphics programming. Lord willing, I'll take a graphics course next year, but I want to keep my attention on AI during this project. I'm looking for an easy-to-learn 2D API that will allow me to implement AI methods with graphics as an afterthought. I don't need tons of special effects that display high resolution animations at two thousand polygons per krundle. Most of my programs will likely use simple blocks or non-animated images. I've done a little graphics programming in the past with Swing and Java 2D, but I acknowledge that these methods are not good for video games. On the other hand, I need neither the power nor the learning curve of something like lwjgl. I've seen a few APIs, such as Slick, that seem to fit what I need, but I'd like some input from those who've used these tools before I get knee deep in a bad API with little hope of backing out. Any recommendations, tips, suggestions, etc.?
Advertisement
You'll probably be fine with Java 2d, and OpenGL-based hardware acceleration is a system property away if you need it.
It's took me like two days to write my sprite, animation, tile, tilemap etc. classes with java2D with no previous experience. May as well do it from scratch tbh.
You can check out my tutorial:
Active Rendering

I actually figured out how to do this while working on some AI code. I needed a simple way to do graphics, and I found out quickly that Swing caused more trouble than it was worth.

I do agree with the above comments, however. Using the Java2D objects should work fine!

I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming

My Twitter: https://twitter.com/indieprogram

My Book: http://amzn.com/1305076532

I'll use Java2D, then. Active Rendering is really what I was after. I had previously used repaint, and it worked for that assignment (indeed, it was part of the assignment's instructions), but it seemed like it would be buggy for anything bigger. I just wasn't sure that active rendering was possible with only Java 2D. Now I know. Thanks for the help!
The Active Rendering tutorial is very nice... However, you're still using the old school way of drawing to the "back buffer", using a BufferedImage, and drawing it to the screen.

According to http://java.sun.com/docs/books/tutorial/extra/fullscreen/bufferstrategy.html, backbuffering is handled for you, and you flip the internally used buffer by doing something like:

bufferStrategy.show();
Yeah, that is true. The method works really well for full screen games, not swing games. The windowed rendering is just so you can have it in a window for debugging.

I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming

My Twitter: https://twitter.com/indieprogram

My Book: http://amzn.com/1305076532

Cool.

Also, sorry for digging up this somewhat old thread. I found the official thread for the article, were there were already some other comments regarding the various techniques to get max performance. Very good work.
Thank you. I am still working on stuff like that, but I need to use swing, so any better way you find, please post it.

Ciao,

I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming

My Twitter: https://twitter.com/indieprogram

My Book: http://amzn.com/1305076532

This topic is closed to new replies.

Advertisement