File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,20 @@ const ua = navigator.userAgent;
11
11
const FPS = 30 ;
12
12
const FRAMERATE = 1000 / FPS ;
13
13
14
- // skip frame(s) as needed, prevent the game from running too fast.
15
- const FRAME_MIN_TIME = ( 1000 / 60 ) * ( 60 / FPS ) - ( 1000 / 60 ) * 0.5 ;
14
+ /**
15
+ * Skip frame(s) as needed, prevent the game from running too fast.
16
+ *
17
+ * Note: 144 hz monitors (maybe on Windows?) may need 0.33 or less,
18
+ * or else the loop may run at 35+ FPS. This may be a 144 hz
19
+ * monitor thing, not necessarily tied to Windows. TBD.
20
+ *
21
+ * It may be this value needs to be made dynamic, starting at 0.5
22
+ * and trickling down to 0.33 or so if the frame rate is > 30FPS.
23
+ *
24
+ */
25
+ const frameOffset = parseFloat ( searchParams . get ( 'frameOffset' ) ) || 0.33 ;
26
+
27
+ const FRAME_MIN_TIME = ( 1000 / 60 ) * ( 60 / FPS ) - ( 1000 / 60 ) * frameOffset ;
16
28
17
29
/**
18
30
*
You can’t perform that action at this time.
0 commit comments