Note that there are some explanatory texts on larger screens.

plurals
  1. POHorrendous Performance in a Simple Java2D App
    primarykey
    data
    text
    <p>I've just finished <a href="http://tametick.com/fwod/" rel="nofollow noreferrer">my entry</a> for the 14th Ludum Dare 48-hours game making competition yesterday, and decided to do it in java using java2d for the graphics.</p> <p>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.</p> <p>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.</p> <p>I've determined the performance bottleneck to be the screen drawing functions, when those are commented out the game is very fast.</p> <p>Could someone give me a heads up on what I might be doing wrong here? The (very short) source code is located <a href="http://github.com/ido/ludum-dare-2009/tree/master" rel="nofollow noreferrer">here</a> with most of it the <a href="http://github.com/ido/ludum-dare-2009/blob/b3e8d300227c52f890ad72f9708a5e717a903386/src/Main.java" rel="nofollow noreferrer">Main</a> class, with the usual suspects being the <a href="http://github.com/ido/ludum-dare-2009/blob/b3e8d300227c52f890ad72f9708a5e717a903386/src/Main.java#L123" rel="nofollow noreferrer">draw()</a> function that is called in the <a href="http://github.com/ido/ludum-dare-2009/blob/b3e8d300227c52f890ad72f9708a5e717a903386/src/Main.java#L285" rel="nofollow noreferrer">inner game loop</a>.</p> <p>I already use a <a href="http://github.com/ido/ludum-dare-2009/blob/b3e8d300227c52f890ad72f9708a5e717a903386/src/Main.java#L337" rel="nofollow noreferrer">BufferStrategy</a> to update the screen, so that shouldn't be the problem unless I'm doing it wrong.</p> <p>Thanks in advance, Ido.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload