Hello everyone, it's been a while! Allow me to report on some things I've been learning since the JGO thread was started.
So currently I know of at least 10 different versions of the fixed timestep loop--- all from various sources, some of those sources being examples of code that people (like Chromanoid) have submitted here and in the JGO thread--- so I prepared three different versions of the
LWJGL example someone called Cero posted in the JGO thread, each of which incorporates one of the different fixed timestep code examples.
I've bundled together those examples in a single download, along with some other example programs (like a similar Game Maker example) and the source for all the different examples. You can download it here:
box.com downloadNote: example_simple.jar and example_variabletimestep.jar are examples without fixed timesteps; they're there for comparison.
There are various settings you can toggle within the JARs, like vsync and the usage of Thread.yield and Thread.sleep. More details are contained in the included readme file.
Here's what I discovered:
-With certain settings, the stuttering can be improved pretty well on all tested computers (at least one school computer, our desktop, and my laptop).
-Rendering as fast as possible seems to yield fairly smooth graphics, but it seems that our desktop and my laptop have difficulty with that kind of rendering (I can't tell if it's difficult for the computers at my school).
-I
finally saw that LWJGL's vsync actually
does have an effect, and yields some of the smoothest rendering I've seen yet! (That is, with Java.) ...However, although this smooth rendering was achieved on a computer at school, it doesn't seem to work on our desktop or my laptop. In fact the API documentation for LWJGL says:
[About Display.setVSyncEnabled:] This call is a best-attempt at changing the vertical refresh synchronization of the monitor, and is not guaranteed to be successful.
That being said, I think at least one particular setting on one example
may yield suitably smooth rendering all around: example_delventhal.zip without Display.sync, with yield and sleep, and without
frequent yield and sleep. It still stutters with those settings, but, if I'm not mistaken, it only stutters a little more than does the Game Maker example.
Admittedly, I don't know how this setting fares on a computer on which vsync works; it may have to be turned off on such computers. But then again, on such a computer, vsync might yield smooth rendering on its own.