I've been trying to create a game using JavaFX, but couldn't help but notice random speedups in the animation speed. I've been using animation timer, and I created a simple script to output the amount of fps the last 2 frames were played at, based on the amount of ms in-between animation timer handle method invocations. Here is the output:
0
8
5
62
62
62
62
62
62
62
62
62
62
62
62
62
31
62
62
62
62
62
62
35
200
66
142
111
62
62
62
62
58
66
62
62
62
62
58
66
62
62
62
62
62
62
62
62
62
62
62
62
62
62
62
62
62
62
62
62
58
62
66
62
62
62
62
62
62
62
62
62
62
62
62
58
66
62
62
62
62
62
62
62
62
62
62
62
62
62
62
58
66
62
62
62
62
62
58
62
66
62
58
62
66
62
58
66
62
62
62
62
62
62
62
62
62
62
62
58
66
62
62
62
62
62
62
58
62
66
62
62
58
66
62
62
62
62
62
62
62
62
62
62
58
62
62
62
62
62
66
52
71
62
62
62
66
62
62
62
62
62
62
62
62
62
62
62
62
62
27
1000
37
166
So obviously, you can see that while it does hover around an ok 62, random speedups and slowdowns are present (notably random 100s, 200s, and an entire 1000 at the end), and I need to find a way to remove them to keep the game's physics running properly. Is there any way to set the frame cap? I've been searching around the internet, and haven't been able to find any solution that works. While most of them more or less seem ok, 1000 was especially troublesome, passing over 16 frames in the span of 1s.