Well, I am writing a game / engine in 2d in , and I have gotten quite far, my problem is I was reading some stuff about the engine Slick2D, which is pretty much one of the most popular 2d engines in Java, I noticed that the creator said he had used JOGL(Java OpenGL) to render his 2d graphics. In my game engine, I have classes such as Unit, Builing, Tile, Effect which all store cropped images of a tile sheet(standard in 2d), but the images are stored as ImageIcons for object serialization. I really want to optimize the graphics rendering, so that minimal processing is required, and I dont want to call repaint for EVERY single little change, and repaint the entire thing. To make sure I dont repaint EVERYTHING just because of say, ONE effect that was added, I was thinking of making sure I render the TILE layer only once, and the other layers such as Buildings and Effects should be stored in a Cache.. If the current / updated Vector of Buildings is NOT equal to the cached vector of buildings, then I will render it, I wanted to ask if this was a good way of saving time and processing. Also, I wanted to know, I use the Graphics of the Canvas, as well as the paintIcon method of the ImageIcon class to actually PAINT the images onto the canvas, should I change this method and use JOGL? What is the most efficient way of STORING the image information, making sure that the variable that it is stored in is serializable.
Currently, I load the image, store the cropped 32x32 tile into a ImageIcon variable in a class, and then the Canvas makes sure there is a difference from the previous paint, and then it calls the paintIcon method of the ImageIcon, or it just paints it in the canvas itself. What is the most efficient method to this! Thank you!