AWTEngine2D WIP | A 2D Engine using only AWT Canvas

Game Example:


Hello, I am Zeejfps and I am fairly new to this forums. I have programmed in java for a while now and I want to share something I have been working on for a few days now. It is a 2D game engine like frame work of sorts. I had attempted this before however this time I think its by far my best, so here goes nothing:

The basic principle of this project is to create a framework / engine that will help out in creating very simple prototype 2D games in java without using any external libraries and then be able to display it in either a JFrame or an Applet.

The basic steps are: you extend a Game class and then do your game logic and rendering in the appropriate methods without having to worry about the game loop or how the rendering works, as well as a couple of helpful classes for loading SpriteSheets, etc…Because the only real way I am able to render without using openGl is using AWT Graphics, the performance is not superb, however I believe I have made it render as fast as it is possible without an external library.

I am still working on all of the java docs and comments any and all criticism will be appreciated and if somebody wants to contribute they can go ahead.

The code as well as examples can be found here:

Update (07/05/2014) :

  • Added toString() and equals() methods to the Vector2 class
  • Added Matrix2 and Matrix3 classes
  • Getting ready to change around the rendering code

Update (07/04/2014) :

  • Finished the Vector2 class
  • Added ability to rotate a Bitmap
  • Created a very simple snake game as an example

Very good work so far; everything is wrapped around AWT so nicely!

I found some issues by surfing the source and posted them to the Github Issue Tracker.


Ok thanks for the feedback, I will definitely flesh out the vector2 class today and will add a setFillColor method.

Edit: Finished the vector2 class. I think I have added all the methods you possibly need for a vector class.


Actually, by default Java2D may use one of its (badly optimized) hardware accelerated pipeline (OpenGL or Direct3D/Direct2D under the hood). I understand you’re not a big fan of external libraries but GLG2D contains an optimized implementation of Graphics2D based on JOGL (JogAmp), it might be useful to get better performance with extremely minimal changes.

Hmm, its not that I am against external libraries, It is just I thought it would be a lot more fun to try accomplishing this without the use of them.

I know that AWT used some Hardware acceleration for some things but I always thought it was very minimal. I will however take a look at this library as I have never seen it before.

Thank you for linking this, I had no idea it existed.

Added a snake game I made real quickly, its far from perfect but should provide a good basic example of how to use all of the engine’s / framework’s features.

Need ideas to what I should add, Really I think its mostly complete, other then a few more comments here and there.