Sign in to follow this  
Mongooseman

[java] Looking for an Easy Java 2D API

Recommended Posts

Mongooseman    122
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.?

Share this post


Link to post
Share on other sites
samcoles    100
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.

Share this post


Link to post
Share on other sites
Glass_Knife    8636
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!

Share this post


Link to post
Share on other sites
Mongooseman    122
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!

Share this post


Link to post
Share on other sites
a1programmer    122
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();

Share this post


Link to post
Share on other sites
Glass_Knife    8636
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.

Share this post


Link to post
Share on other sites
a1programmer    122
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this