9

Me and my friend started developing a game just like Zelda for SNES using Java. The only problem is that we don't know what to use: our very own engine with AWT or if we could use SWING to make it easier.

So.. the short question is:

For soft java-2d games, is it a good or a bad idea to use Java Swing?

And WHY?

Consider that the game is not "heavy". Thanks in advance!

2
  • 1
    Bad: Because you'll just being re-doing all the work someone else has already done (for a 2d game library, perhaps one that uses Swing internally) :-) Swing aimed to replace AWT -- not to be a game library. Commented Feb 3, 2011 at 5:10
  • 10
    The final boss should be JButton ;) Commented Feb 3, 2011 at 5:32

2 Answers 2

7

I have attempted this a few times and found that:

  • If your graphics are all unrotated (or quadrant-rotated) sprites and fixed or tiled background images, it is usually fast enough.
  • If you need to rotate images or draw geometric shapes (with Graphics2D), forget it. It can slow to a crawl with just 20-30 polygon vertices on the screen. If you do a lot of rotation & scaling then you are probably better off with a 3D framework, even for a 2D world.

If you do choose swing, learn to use the BufferStrategy class.

Also consider PulpCore.

Sign up to request clarification or add additional context in comments.

Comments

2

While you could use the Java awt and swing libraries to build a game, you would probably have an easier time finding a game-specific library and building around that. Processing is a great choice, especially for beginners. http://processing.org/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.