I've just finished my entry
for the 14th Ludum Dare 48-hours game making competition yesterday, and decided to do it in java using java2d for the graphics.
I'm not that familiar with the API and haven't done a lot of graphics programming, but my game is quite small (only a dozen or so very small moving object) so I assumed I could program it naively and still encounter no performance problems.
Needless to say, I was wrong. The game performs alright most of the time but once there are a bit too many 'enemies' moving around on the screen or the resolution is cranked up too high it start getting visibly slower.
I've determined the performance bottleneck to be the screen drawing functions, when those are commented out the game is very fast.
Could someone give me a heads up on what I might be doing wrong here? The (very short) source code is located here
with most of it the Main
class, with the usual suspects being the draw()
function that is called in the inner game loop
Thanks in advance,