godot/core
Manuel Moos d5abd4eb75 Add hysteresis to physics timestep count per frame
Add new class _TimerSync to manage timestep calculations.
The new class handles the decisions about simulation progression
previously handled by main::iteration(). It is fed the current timer
ticks and determines how many physics updates are to be run and what
the delta argument to the _process() functions should be.

The new class tries to keep the number of physics updates per frame as
constant as possible from frame to frame. Ideally, it would be N steps
every render frame, but even with perfectly regular rendering, the
general case is that N or N+1 steps are required per frame, for some
fixed N. The best guess for N is stored in typical_physics_steps.

When determining the number of steps to take, no restrictions are
imposed between the choice of typical_physics_steps and
typical_physics_steps+1 steps. Should more or less steps than that be
required, the accumulated remaining time (as before, stored in
time_accum) needs to surpass its boundaries by some minimal threshold.
Once surpassed, typical_physics_steps is updated to allow the new step
count for future updates.

Care is taken that the modified calculation of the number of physics
steps is not observable from game code that only checks the delta
parameters to the _process and _physics_process functions; in addition
to modifying the number of steps, the _process argument is modified as
well to stay in expected bounds. Extra care is taken that the accumulated
steps still sum up to roughly the real elapsed time, up to a maximum
tolerated difference.

To allow the hysteresis code to work correctly on higher refresh
monitors, the number of typical physics steps is not only recorded and
kept consistent for single render frames, but for groups of them.
Currently, up to 12 frames are grouped that way.

The engine parameter physics_jitter_fix controls both the maximum
tolerated difference between wall clock time and summed up _process
arguments and the threshold for changing typical_physics_steps. It is
given in units of the real physics frame slice 1/physics_fps. Set
physics_jitter_fix to 0 to disable the effects of the new code here.
It starts to be effective against the random physics jitter at around
0.02 to 0.05. at values greater than 1 it starts having ill effects on
the engine's ability to react sensibly to dropped frames and framerate
changes.
2018-04-09 22:27:29 +02:00
..
bind Add hysteresis to physics timestep count per frame 2018-04-09 22:27:29 +02:00
helper Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
io Merge pull request #17227 from Faless/multiplayer_api 2018-04-08 11:04:16 -03:00
math Resolves Inccorect Quaternion Conversion 2018-04-09 14:48:03 +08:00
os Fixed signal input variable name 2018-04-06 09:09:40 +02:00
allocators.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
array.cpp Duplicate Arrays and Dictionaries when instancing scene in editor 2018-03-13 17:18:08 +02:00
array.h Duplicate Arrays and Dictionaries when instancing scene in editor 2018-03-13 17:18:08 +02:00
class_db.cpp Ctrl+Clicking a enum now scrolls down to it in the docs. 2018-04-03 21:56:54 +02:00
class_db.h Ctrl+Clicking a enum now scrolls down to it in the docs. 2018-04-03 21:56:54 +02:00
color_names.inc
color.cpp Fix mismatch between Color.h and Color.from_hsv() 2018-03-14 21:04:02 +01:00
color.h Add Color.from_hsv() 2018-01-18 22:13:00 +01:00
command_queue_mt.cpp Fix several in-class initialization clang warning 2018-03-22 00:17:18 -03:00
command_queue_mt.h Fix several in-class initialization clang warning 2018-03-22 00:17:18 -03:00
compressed_translation.cpp Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
compressed_translation.h Fix typos with codespell 2018-02-21 19:46:06 +01:00
core_string_names.cpp Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
core_string_names.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
dictionary.cpp Duplicate Arrays and Dictionaries when instancing scene in editor 2018-03-13 17:18:08 +02:00
dictionary.h Duplicate Arrays and Dictionaries when instancing scene in editor 2018-03-13 17:18:08 +02:00
dvector.cpp Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
dvector.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
engine.cpp Add hysteresis to physics timestep count per frame 2018-04-09 22:27:29 +02:00
engine.h Add hysteresis to physics timestep count per frame 2018-04-09 22:27:29 +02:00
error_list.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
error_macros.cpp Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
error_macros.h Fix typos with codespell 2018-02-21 19:46:06 +01:00
func_ref.cpp Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
func_ref.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
global_constants.cpp Fix typos with codespell 2018-02-21 19:46:06 +01:00
global_constants.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
hash_map.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
hashfuncs.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
image.cpp Merge pull request #16898 from Lerc/master 2018-04-08 15:52:05 -03:00
image.h change to clang format 2018-02-24 13:59:02 +13:00
input_map.cpp Allows to map an action to all devices. 2018-04-07 20:08:09 +00:00
input_map.h Allows to map an action to all devices. 2018-04-07 20:08:09 +00:00
int_types.h Update copyright statements to 2018 2018-01-01 14:40:47 +01:00
list.h Fix typos in code and docs with codespell 2018-01-18 22:01:42 +01:00
make_binders.py Properly closing all files in Python code 2018-03-11 14:55:50 +01:00
map.h Fix typos with codespell 2018-02-21 19:46:06 +01:00
message_queue.cpp Fix typos with codespell 2018-02-21 19:46:06 +01:00
message_queue.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
method_bind.cpp Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
method_bind.h Fix typos in code and docs with codespell 2018-01-18 22:01:42 +01:00
method_ptrcall.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
node_path.cpp Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
node_path.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
oa_hash_map.h Fix typos in code and docs with codespell 2018-01-18 22:01:42 +01:00
object.cpp Bind many more properties to scripts 2018-01-12 00:58:14 +02:00
object.h Make sure PropertyHint matches in the VisualScript editor. 2018-01-15 22:19:54 +01:00
ordered_hash_map.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
packed_data_container.cpp Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
packed_data_container.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
pair.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
path_remap.cpp Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
path_remap.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
pool_allocator.cpp Fix typos with codespell 2018-02-21 19:46:06 +01:00
pool_allocator.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
print_string.cpp Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
print_string.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
project_settings.cpp Merge pull request #16947 from Faless/ui_actions 2018-03-16 20:55:11 +01:00
project_settings.h Improve error reporting of ProjectSettings::setup() 2018-02-19 16:41:43 +01:00
ref_ptr.cpp Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
ref_ptr.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
reference.cpp Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
reference.h Fix several in-class initialization clang warning 2018-03-22 00:17:18 -03:00
register_core_types.cpp Add new MultiplayerAPI class 2018-03-03 18:28:49 +01:00
register_core_types.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
resource.cpp Duplicate Arrays and Dictionaries when instancing scene in editor 2018-03-13 17:18:08 +02:00
resource.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
rid.cpp Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
rid.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
ring_buffer.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
safe_refcount.cpp Fix inconsistencies and typos in argument names 2018-02-01 16:47:20 +01:00
safe_refcount.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
script_debugger_local.cpp Kill an old debugging message 2018-02-05 11:18:49 +01:00
script_debugger_local.h Mono: Implement stack info for errors and exceptions 2018-01-09 17:19:03 +01:00
script_debugger_remote.cpp Fix typos with codespell 2018-02-21 19:46:06 +01:00
script_debugger_remote.h Mono: Implement stack info for errors and exceptions 2018-01-09 17:19:03 +01:00
script_language.cpp Bind many more properties to scripts 2018-01-12 00:58:14 +02:00
script_language.h Ctrl+Clicking a enum now scrolls down to it in the docs. 2018-04-03 21:56:54 +02:00
SCsub Merge pull request #17440 from viktor-ferenczi/issue-5042 2018-03-13 11:49:58 +01:00
self_list.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
set.h Fix typos with codespell 2018-02-21 19:46:06 +01:00
simple_type.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
sort.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
string_buffer.h Fix several in-class initialization clang warning 2018-03-22 00:17:18 -03:00
string_builder.cpp fixed crash with StringBuilder 2018-01-20 15:26:58 +01:00
string_builder.h Fix several in-class initialization clang warning 2018-03-22 00:17:18 -03:00
string_db.cpp Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
string_db.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
translation.cpp Add locale renames for Hebrew and Indonesian on Windows 2018-02-14 18:49:27 +01:00
translation.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
type_info.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
typedefs.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
ucaps.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
undo_redo.cpp obsolete UndoRedo max_steps; no users identified 2018-01-08 10:57:07 -06:00
undo_redo.h obsolete UndoRedo max_steps; no users identified 2018-01-08 10:57:07 -06:00
ustring.cpp Fix buggy percent-encoding 2018-04-05 21:49:44 +02:00
ustring.h Unify http- and percent- encode/decode 2018-03-27 19:18:30 +02:00
variant_call.cpp Duplicate Arrays and Dictionaries when instancing scene in editor 2018-03-13 17:18:08 +02:00
variant_construct_string.cpp Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
variant_op.cpp Merge pull request #17382 from bojidar-bg/13971-path-array-unsaved 2018-04-08 09:39:03 -03:00
variant_parser.cpp add template argument for size in StringBuffer 2018-01-20 20:03:17 +01:00
variant_parser.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
variant.cpp Add base support for 2D meshes in Godot, including Sprite -> Mesh2D conversion. 2018-02-21 09:39:09 -03:00
variant.h Duplicate Arrays and Dictionaries when instancing scene in editor 2018-03-13 17:18:08 +02:00
vector.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
version.h Refactor version macros and fix related bugs 2018-02-23 20:15:29 +01:00
vmap.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00
vset.h Add missing copyright headers and fix formatting 2018-01-05 01:22:23 +01:00