You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* A `Boolean` that specifies if the runner should use a fixed timestep (otherwise it is variable).
2708
-
* If timing is fixed, then the apparent simulation speed will change depending on the frame rate (but behaviour will be deterministic).
2709
-
* If the timing is variable, then the apparent simulation speed will be constant (approximately, but at the cost of determininism).
2707
+
* The fixed timestep size used for `Engine.update` calls in milliseconds, known as `delta`.
2710
2708
*
2711
-
* @default false
2712
-
*/
2713
-
isFixed?: boolean|undefined;
2714
-
2715
-
/**
2716
-
* A `Number` that specifies the time step between updates in milliseconds.
2717
-
* If `engine.timing.isFixed` is set to `true`, then `delta` is fixed.
2718
-
* If it is `false`, then `delta` can dynamically change to maintain the correct apparent simulation speed.
2709
+
* This value is recommended to be `1000 / 60` ms or smaller (i.e. equivalent to at least 60hz).
2710
+
*
2711
+
* Smaller `delta` values provide higher quality results at the cost of performance.
2712
+
*
2713
+
* You should usually avoid changing `delta` during running, otherwise quality may be affected.
2714
+
*
2715
+
* For smoother frame pacing choose a `delta` that is an even multiple of each display FPS you target, i.e. `1000 / (n * fps)` as this helps distribute an equal number of updates over each display frame.
2716
+
*
2717
+
* For example with a 60 Hz `delta` i.e. `1000 / 60` the runner will on average perform one update per frame on displays running 60 FPS and one update every two frames on displays running 120 FPS, etc.
2718
+
*
2719
+
* Where as e.g. using a 240 Hz `delta` i.e. `1000 / 240` the runner will on average perform four updates per frame on displays running 60 FPS and two updates per frame on displays running 120 FPS, etc.
2720
+
*
2721
+
* Therefore `Runner.run` will call multiple engine updates (or none) as needed to simulate the time elapsed between browser frames.
2722
+
*
2723
+
* In practice the number of updates in any particular frame may be restricted to respect the runner's performance budgets. These are specified by `runner.maxFrameTime` and `runner.maxUpdates`, see those properties for details.
2719
2724
*
2720
2725
* @default 1000 / 60
2721
2726
*/
2722
2727
delta?: number|undefined;
2723
2728
2724
2729
/**
2725
2730
* A flag that specifies whether the runner is running or not.
2731
+
*
2726
2732
* @default true
2727
2733
*/
2728
2734
enabled?: boolean|undefined;
2735
+
2736
+
/**
2737
+
* The measured time elapsed between the last two browser frames in milliseconds.
2738
+
* This is useful e.g. to estimate the current browser FPS using `1000 / runner.frameDelta`.
2739
+
*/
2740
+
frameDelta?: number|undefined;
2741
+
2742
+
/**
2743
+
* Enables averaging to smooth frame rate measurements and therefore stabilise play rate.
2744
+
*
2745
+
* @default true
2746
+
*/
2747
+
frameDeltaSmoothing?: boolean|undefined;
2748
+
2749
+
/**
2750
+
* Rounds measured browser frame delta to the nearest 1 Hz.
2751
+
* This option can help smooth frame rate measurements and simplify handling hardware timing differences e.g. 59.94Hz and 60Hz displays.
2752
+
* For best results you should also round your `runner.delta` equivalent to the nearest 1 Hz.
2753
+
*
2754
+
* @default true
2755
+
*/
2756
+
frameDeltaSnapping?: boolean|undefined;
2757
+
2758
+
/**
2759
+
* A performance budget that limits execution time allowed for this runner per browser frame in milliseconds.
2760
+
*
2761
+
* To calculate the effective browser FPS at which this throttle is applied use `1000 / runner.maxFrameTime`.
2762
+
*
2763
+
* This performance budget is intended to help maintain browser interactivity and help improve framerate recovery during temporary high CPU usage.
2764
+
*
2765
+
* This budget only covers the measured time elapsed executing the functions called in the scope of the runner tick, including `Engine.update` and its related user event callbacks.
2766
+
*
2767
+
* You may also reduce this budget to allow for any significant additional processing you perform on the same thread outside the scope of this runner tick, e.g. rendering time.
2768
+
*
2769
+
* See also `runner.maxUpdates`.
2770
+
*
2771
+
* @default 1000 / 30
2772
+
*/
2773
+
maxFrameTime?: number|undefined;
2774
+
2775
+
/**
2776
+
* An optional limit for maximum engine update count allowed per frame tick in addition to `runner.maxFrameTime`.
2777
+
*
2778
+
* Unless you set a value it is automatically chosen based on `runner.delta` and `runner.maxFrameTime`.
2779
+
*
2780
+
* See also `runner.maxFrameTime`.
2781
+
*
2782
+
* @default null
2783
+
*/
2784
+
maxUpdates?: number|null;
2729
2785
}
2730
2786
2731
2787
/**
@@ -2783,6 +2839,29 @@ declare namespace Matter {
2783
2839
*/
2784
2840
staticstart(runner: Runner,engine: Engine): void;
2785
2841
2842
+
/**
2843
+
* The fixed timestep size used for `Engine.update` calls in milliseconds, known as `delta`.
2844
+
*
2845
+
* This value is recommended to be `1000 / 60` ms or smaller (i.e. equivalent to at least 60hz).
2846
+
*
2847
+
* Smaller `delta` values provide higher quality results at the cost of performance.
2848
+
*
2849
+
* You should usually avoid changing `delta` during running, otherwise quality may be affected.
2850
+
*
2851
+
* For smoother frame pacing choose a `delta` that is an even multiple of each display FPS you target, i.e. `1000 / (n * fps)` as this helps distribute an equal number of updates over each display frame.
2852
+
*
2853
+
* For example with a 60 Hz `delta` i.e. `1000 / 60` the runner will on average perform one update per frame on displays running 60 FPS and one update every two frames on displays running 120 FPS, etc.
2854
+
*
2855
+
* Where as e.g. using a 240 Hz `delta` i.e. `1000 / 240` the runner will on average perform four updates per frame on displays running 60 FPS and two updates per frame on displays running 120 FPS, etc.
2856
+
*
2857
+
* Therefore `Runner.run` will call multiple engine updates (or none) as needed to simulate the time elapsed between browser frames.
2858
+
*
2859
+
* In practice the number of updates in any particular frame may be restricted to respect the runner's performance budgets. These are specified by `runner.maxFrameTime` and `runner.maxUpdates`, see those properties for details.
2860
+
*
2861
+
* @default 1000 / 60
2862
+
*/
2863
+
delta: number;
2864
+
2786
2865
/**
2787
2866
* A flag that specifies whether the runner is running or not.
* A `Boolean` that specifies if the runner should use a fixed timestep (otherwise it is variable).
2795
-
* If timing is fixed, then the apparent simulation speed will change depending on the frame rate (but behaviour will be deterministic).
2796
-
* If the timing is variable, then the apparent simulation speed will be constant (approximately, but at the cost of determininism).
2873
+
* The measured time elapsed between the last two browser frames in milliseconds.
2874
+
* This is useful e.g. to estimate the current browser FPS using `1000 / runner.frameDelta`.
2875
+
*/
2876
+
frameDelta: number;
2877
+
2878
+
/**
2879
+
* Enables averaging to smooth frame rate measurements and therefore stabilise play rate.
2797
2880
*
2798
-
* @defaultfalse
2881
+
* @defaulttrue
2799
2882
*/
2800
-
isFixed: boolean;
2883
+
frameDeltaSmoothing: boolean;
2801
2884
2802
2885
/**
2803
-
* A `Number` that specifies the time step between updates in milliseconds.
2804
-
* If `engine.timing.isFixed` is set to `true`, then `delta` is fixed.
2805
-
* If it is `false`, then `delta` can dynamically change to maintain the correct apparent simulation speed.
2886
+
* Rounds measured browser frame delta to the nearest 1 Hz.
2887
+
* This option can help smooth frame rate measurements and simplify handling hardware timing differences e.g. 59.94Hz and 60Hz displays.
2888
+
* For best results you should also round your `runner.delta` equivalent to the nearest 1 Hz.
2806
2889
*
2807
-
* @default1000 / 60
2890
+
* @defaulttrue
2808
2891
*/
2809
-
delta: number;
2892
+
frameDeltaSnapping: boolean;
2893
+
2894
+
/**
2895
+
* A performance budget that limits execution time allowed for this runner per browser frame in milliseconds.
2896
+
*
2897
+
* To calculate the effective browser FPS at which this throttle is applied use `1000 / runner.maxFrameTime`.
2898
+
*
2899
+
* This performance budget is intended to help maintain browser interactivity and help improve framerate recovery during temporary high CPU usage.
2900
+
*
2901
+
* This budget only covers the measured time elapsed executing the functions called in the scope of the runner tick, including `Engine.update` and its related user event callbacks.
2902
+
*
2903
+
* You may also reduce this budget to allow for any significant additional processing you perform on the same thread outside the scope of this runner tick, e.g. rendering time.
2904
+
*
2905
+
* See also `runner.maxUpdates`.
2906
+
*
2907
+
* @default 1000 / 30
2908
+
*/
2909
+
maxFrameTime: number;
2910
+
2911
+
/**
2912
+
* An optional limit for maximum engine update count allowed per frame tick in addition to `runner.maxFrameTime`.
2913
+
*
2914
+
* Unless you set a value it is automatically chosen based on `runner.delta` and `runner.maxFrameTime`.
0 commit comments