diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 8d36413e7..66c991d05 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -3019,11 +3019,11 @@ _ClassDB::~_ClassDB() { } /////////////////////////////// -void _Engine::set_iterations_per_second(int p_ips) { - Engine::get_singleton()->set_iterations_per_second(p_ips); +void _Engine::set_physics_ticks_per_second(int p_ips) { + Engine::get_singleton()->set_physics_ticks_per_second(p_ips); } -int _Engine::get_iterations_per_second() const { - return Engine::get_singleton()->get_iterations_per_second(); +int _Engine::get_physics_ticks_per_second() const { + return Engine::get_singleton()->get_physics_ticks_per_second(); } void _Engine::set_physics_jitter_fix(float p_threshold) { @@ -3128,8 +3128,8 @@ bool _Engine::is_printing_error_messages() const { } void _Engine::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_iterations_per_second", "iterations_per_second"), &_Engine::set_iterations_per_second); - ClassDB::bind_method(D_METHOD("get_iterations_per_second"), &_Engine::get_iterations_per_second); + ClassDB::bind_method(D_METHOD("set_physics_ticks_per_second", "physics_ticks_per_second"), &_Engine::set_physics_ticks_per_second); + ClassDB::bind_method(D_METHOD("get_physics_ticks_per_second"), &_Engine::get_physics_ticks_per_second); ClassDB::bind_method(D_METHOD("set_physics_jitter_fix", "physics_jitter_fix"), &_Engine::set_physics_jitter_fix); ClassDB::bind_method(D_METHOD("get_physics_jitter_fix"), &_Engine::get_physics_jitter_fix); ClassDB::bind_method(D_METHOD("get_physics_interpolation_fraction"), &_Engine::get_physics_interpolation_fraction); @@ -3166,7 +3166,7 @@ void _Engine::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "editor_hint"), "set_editor_hint", "is_editor_hint"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "print_error_messages"), "set_print_error_messages", "is_printing_error_messages"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "iterations_per_second"), "set_iterations_per_second", "get_iterations_per_second"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "physics_ticks_per_second"), "set_physics_ticks_per_second", "get_physics_ticks_per_second"); ADD_PROPERTY(PropertyInfo(Variant::INT, "target_fps"), "set_target_fps", "get_target_fps"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "time_scale"), "set_time_scale", "get_time_scale"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "physics_jitter_fix"), "set_physics_jitter_fix", "get_physics_jitter_fix"); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index a61fc06bb..521289bca 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -767,8 +767,8 @@ protected: public: static _Engine *get_singleton() { return singleton; } - void set_iterations_per_second(int p_ips); - int get_iterations_per_second() const; + void set_physics_ticks_per_second(int p_ips); + int get_physics_ticks_per_second() const; void set_physics_jitter_fix(float p_threshold); float get_physics_jitter_fix() const; diff --git a/core/engine.cpp b/core/engine.cpp index fc8cd342e..32eff37d8 100644 --- a/core/engine.cpp +++ b/core/engine.cpp @@ -35,11 +35,11 @@ #include "core/license.gen.h" #include "core/version.h" -void Engine::set_iterations_per_second(int p_ips) { +void Engine::set_physics_ticks_per_second(int p_ips) { ERR_FAIL_COND_MSG(p_ips <= 0, "Engine iterations per second must be greater than 0."); ips = p_ips; } -int Engine::get_iterations_per_second() const { +int Engine::get_physics_ticks_per_second() const { return ips; } diff --git a/core/engine.h b/core/engine.h index 52df6e7c3..0a4d25c60 100644 --- a/core/engine.h +++ b/core/engine.h @@ -75,8 +75,8 @@ private: public: static Engine *get_singleton(); - virtual void set_iterations_per_second(int p_ips); - virtual int get_iterations_per_second() const; + virtual void set_physics_ticks_per_second(int p_ips); + virtual int get_physics_ticks_per_second() const; void set_physics_jitter_fix(float p_threshold); float get_physics_jitter_fix() const; diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml index aa23aa0c8..6f05c637a 100644 --- a/doc/classes/Engine.xml +++ b/doc/classes/Engine.xml @@ -149,9 +149,9 @@ See [url=$DOCS_URL/tutorials/misc/running_code_in_the_editor.html]Running code in the editor[/url] in the documentation for more information. [b]Note:[/b] To detect whether the script is run from an editor [i]build[/i] (e.g. when pressing [code]F5[/code]), use [method OS.has_feature] with the [code]"editor"[/code] argument instead. [code]OS.has_feature("editor")[/code] will evaluate to [code]true[/code] both when the code is running in the editor and when running the project from the editor, but it will evaluate to [code]false[/code] when the code is run from an exported project. - - The number of fixed iterations per second. This controls how often physics simulation and [method Node._physics_process] methods are run. This value should generally always be set to [code]60[/code] or above, as Godot doesn't interpolate the physics step. As a result, values lower than [code]60[/code] will look stuttery. This value can be increased to make input more reactive or work around collision tunneling issues, but keep in mind doing so will increase CPU usage. See also [member target_fps] and [member ProjectSettings.physics/common/physics_fps]. - [b]Note:[/b] Only 8 physics ticks may be simulated per rendered frame at most. If more than 8 physics ticks have to be simulated per rendered frame to keep up with rendering, the game will appear to slow down (even if [code]delta[/code] is used consistently in physics calculations). Therefore, it is recommended not to increase [member Engine.iterations_per_second] above 240. Otherwise, the game will slow down when the rendering framerate goes below 30 FPS. + + The number of fixed iterations per second. This controls how often physics simulation and [method Node._physics_process] methods are run. This value should generally always be set to [code]60[/code] or above, as Godot doesn't interpolate the physics step. As a result, values lower than [code]60[/code] will look stuttery. This value can be increased to make input more reactive or work around collision tunneling issues, but keep in mind doing so will increase CPU usage. See also [member target_fps] and [member ProjectSettings.physics/common/physics_ticks_per_second]. + [b]Note:[/b] Only 8 physics ticks may be simulated per rendered frame at most. If more than 8 physics ticks have to be simulated per rendered frame to keep up with rendering, the game will appear to slow down (even if [code]delta[/code] is used consistently in physics calculations). Therefore, it is recommended not to increase [member Engine.physics_ticks_per_second] above 240. Otherwise, the game will slow down when the rendering framerate goes below 30 FPS. Controls how much physics ticks are synchronized with real time. For 0 or less, the ticks are synchronized. Such values are recommended for network games, where clock synchronization matters. Higher values cause higher deviation of the in-game clock and real clock but smooth out framerate jitters. The default value of 0.5 should be fine for most; values above 2 could cause the game to react to dropped frames with a noticeable delay and are not recommended. diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 91c8834e7..dfb54c0be 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -290,7 +290,7 @@ - Returns the time elapsed (in seconds) since the last physics-bound frame (see [method _physics_process]). This is always a constant value in physics processing unless the frames per second is changed via [member Engine.iterations_per_second]. + Returns the time elapsed (in seconds) since the last physics-bound frame (see [method _physics_process]). This is always a constant value in physics processing unless the frames per second is changed via [member Engine.physics_ticks_per_second]. @@ -646,7 +646,7 @@ - Enables or disables physics (i.e. fixed framerate) processing. When a node is being processed, it will receive a [constant NOTIFICATION_PHYSICS_PROCESS] at a fixed (usually 60 FPS, see [member Engine.iterations_per_second] to change) interval (and the [method _physics_process] callback will be called if exists). Enabled automatically if [method _physics_process] is overridden. Any calls to this before [method _ready] will be ignored. + Enables or disables physics (i.e. fixed framerate) processing. When a node is being processed, it will receive a [constant NOTIFICATION_PHYSICS_PROCESS] at a fixed (usually 60 FPS, see [member Engine.physics_ticks_per_second] to change) interval (and the [method _physics_process] callback will be called if exists). Enabled automatically if [method _physics_process] is overridden. Any calls to this before [method _ready] will be ignored. diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 72ec999bd..ef2d1f234 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -410,7 +410,7 @@ Message to be displayed before the backtrace when the engine crashes. - Maximum number of frames per second allowed. The actual number of frames per second may still be below this value if the game is lagging. See also [member physics/common/physics_fps]. + Maximum number of frames per second allowed. The actual number of frames per second may still be below this value if the game is lagging. See also [member physics/common/physics_ticks_per_second]. If [member display/window/vsync/use_vsync] is enabled, it takes precedence and the forced FPS number cannot exceed the monitor's refresh rate. This setting is therefore mostly relevant for lowering the maximum FPS below VSync, e.g. to perform non-real-time rendering of static frames, or test the project under lag conditions. [b]Note:[/b] This property is only read when the project starts. To change the rendering FPS cap at runtime, set [member Engine.target_fps] instead. @@ -1106,7 +1106,7 @@ The default angular damp in 2D. - [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_fps], [code]60[/code] by default) will bring the object to a stop in one iteration. + [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_ticks_per_second], [code]60[/code] by default) will bring the object to a stop in one iteration. The default gravity strength in 2D (in pixels per second squared). @@ -1126,7 +1126,7 @@ The default linear damp in 2D. - [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_fps], [code]60[/code] by default) will bring the object to a stop in one iteration. + [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_ticks_per_second], [code]60[/code] by default) will bring the object to a stop in one iteration. Threshold defining the surface size that constitutes a large object with regard to cells in the broad-phase 2D hash grid algorithm. @@ -1154,7 +1154,7 @@ The default angular damp in 3D. - [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_fps], [code]60[/code] by default) will bring the object to a stop in one iteration. + [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_ticks_per_second], [code]60[/code] by default) will bring the object to a stop in one iteration. The default gravity strength in 3D (in meters per second squared). @@ -1174,7 +1174,7 @@ The default linear damp in 3D. - [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_fps], [code]60[/code] by default) will bring the object to a stop in one iteration. + [b]Note:[/b] Good values are in the range [code]0[/code] to [code]1[/code]. At value [code]0[/code] objects will keep moving with the same velocity. Values greater than [code]1[/code] will aim to reduce the velocity to [code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim to reduce the velocity to [code]0[/code] in half a second. A value equal to or greater than the physics frame rate ([member ProjectSettings.physics/common/physics_ticks_per_second], [code]60[/code] by default) will bring the object to a stop in one iteration. @@ -1203,10 +1203,10 @@ - During pause, picking only considers collision objects immune to pause, sending input events and enter/exit callbacks to them as expected. If disabled, the legacy behavior is used, which consists in queuing the picking input events during pause (so nodes won't get them) and flushing that queue on resume, against the state of the 2D/3D world at that point. - + The number of fixed iterations per second. This controls how often physics simulation and [method Node._physics_process] methods are run. See also [member debug/settings/fps/force_fps]. - [b]Note:[/b] This property is only read when the project starts. To change the physics FPS at runtime, set [member Engine.iterations_per_second] instead. - [b]Note:[/b] Only 8 physics ticks may be simulated per rendered frame at most. If more than 8 physics ticks have to be simulated per rendered frame to keep up with rendering, the game will appear to slow down (even if [code]delta[/code] is used consistently in physics calculations). Therefore, it is recommended not to increase [member physics/common/physics_fps] above 240. Otherwise, the game will slow down when the rendering framerate goes below 30 FPS. + [b]Note:[/b] This property is only read when the project starts. To change the physics FPS at runtime, set [member Engine.physics_ticks_per_second] instead. + [b]Note:[/b] Only 8 physics ticks may be simulated per rendered frame at most. If more than 8 physics ticks have to be simulated per rendered frame to keep up with rendering, the game will appear to slow down (even if [code]delta[/code] is used consistently in physics calculations). Therefore, it is recommended not to increase [member physics/common/physics_ticks_per_second] above 240. Otherwise, the game will slow down when the rendering framerate goes below 30 FPS. If [code]true[/code], the renderer will interpolate the transforms of physics objects between the last two transforms, such that smooth motion is seen when physics ticks do not coincide with rendered frames. diff --git a/doc/translations/classes.pot b/doc/translations/classes.pot index 238ab77ba..673813dc4 100644 --- a/doc/translations/classes.pot +++ b/doc/translations/classes.pot @@ -22621,12 +22621,12 @@ msgid "" "will look stuttery. This value can be increased to make input more reactive " "or work around collision tunneling issues, but keep in mind doing so will " "increase CPU usage. See also [member target_fps] and [member ProjectSettings." -"physics/common/physics_fps].\n" +"physics/common/physics_ticks_per_second].\n" "[b]Note:[/b] Only 8 physics ticks may be simulated per rendered frame at " "most. If more than 8 physics ticks have to be simulated per rendered frame " "to keep up with rendering, the game will appear to slow down (even if " "[code]delta[/code] is used consistently in physics calculations). Therefore, " -"it is recommended not to increase [member Engine.iterations_per_second] " +"it is recommended not to increase [member Engine.physics_ticks_per_second] " "above 240. Otherwise, the game will slow down when the rendering framerate " "goes below 30 FPS." msgstr "" @@ -36472,7 +36472,7 @@ msgid "" "Returns the time elapsed (in seconds) since the last physics-bound frame " "(see [method _physics_process]). This is always a constant value in physics " "processing unless the frames per second is changed via [member Engine." -"iterations_per_second]." +"physics_ticks_per_second]." msgstr "" #: doc/classes/Node.xml @@ -36865,7 +36865,7 @@ msgid "" "Enables or disables physics (i.e. fixed framerate) processing. When a node " "is being processed, it will receive a [constant " "NOTIFICATION_PHYSICS_PROCESS] at a fixed (usually 60 FPS, see [member Engine." -"iterations_per_second] to change) interval (and the [method " +"physics_ticks_per_second] to change) interval (and the [method " "_physics_process] callback will be called if exists). Enabled automatically " "if [method _physics_process] is overridden. Any calls to this before [method " "_ready] will be ignored." @@ -45484,7 +45484,7 @@ msgstr "" msgid "" "Maximum number of frames per second allowed. The actual number of frames per " "second may still be below this value if the game is lagging. See also " -"[member physics/common/physics_fps].\n" +"[member physics/common/physics_ticks_per_second].\n" "If [member display/window/vsync/use_vsync] is enabled, it takes precedence " "and the forced FPS number cannot exceed the monitor's refresh rate.\n" "This setting is therefore mostly relevant for lowering the maximum FPS below " @@ -46539,7 +46539,7 @@ msgid "" "[code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim " "to reduce the velocity to [code]0[/code] in half a second. A value equal to " "or greater than the physics frame rate ([member ProjectSettings.physics/" -"common/physics_fps], [code]60[/code] by default) will bring the object to a " +"common/physics_ticks_per_second], [code]60[/code] by default) will bring the object to a " "stop in one iteration." msgstr "" @@ -46576,7 +46576,7 @@ msgid "" "[code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim " "to reduce the velocity to [code]0[/code] in half a second. A value equal to " "or greater than the physics frame rate ([member ProjectSettings.physics/" -"common/physics_fps], [code]60[/code] by default) will bring the object to a " +"common/physics_ticks_per_second], [code]60[/code] by default) will bring the object to a " "stop in one iteration." msgstr "" @@ -46646,7 +46646,7 @@ msgid "" "[code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim " "to reduce the velocity to [code]0[/code] in half a second. A value equal to " "or greater than the physics frame rate ([member ProjectSettings.physics/" -"common/physics_fps], [code]60[/code] by default) will bring the object to a " +"common/physics_ticks_per_second], [code]60[/code] by default) will bring the object to a " "stop in one iteration." msgstr "" @@ -46683,7 +46683,7 @@ msgid "" "[code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim " "to reduce the velocity to [code]0[/code] in half a second. A value equal to " "or greater than the physics frame rate ([member ProjectSettings.physics/" -"common/physics_fps], [code]60[/code] by default) will bring the object to a " +"common/physics_ticks_per_second], [code]60[/code] by default) will bring the object to a " "stop in one iteration." msgstr "" @@ -46737,13 +46737,13 @@ msgid "" "simulation and [method Node._physics_process] methods are run. See also " "[member debug/settings/fps/force_fps].\n" "[b]Note:[/b] This property is only read when the project starts. To change " -"the physics FPS at runtime, set [member Engine.iterations_per_second] " +"the physics FPS at runtime, set [member Engine.physics_ticks_per_second] " "instead.\n" "[b]Note:[/b] Only 8 physics ticks may be simulated per rendered frame at " "most. If more than 8 physics ticks have to be simulated per rendered frame " "to keep up with rendering, the game will appear to slow down (even if " "[code]delta[/code] is used consistently in physics calculations). Therefore, " -"it is recommended not to increase [member physics/common/physics_fps] above " +"it is recommended not to increase [member physics/common/physics_ticks_per_second] above " "240. Otherwise, the game will slow down when the rendering framerate goes " "below 30 FPS." msgstr "" diff --git a/doc/translations/hu.po b/doc/translations/hu.po index b93dc20bc..1a64843a4 100644 --- a/doc/translations/hu.po +++ b/doc/translations/hu.po @@ -22645,12 +22645,12 @@ msgid "" "will look stuttery. This value can be increased to make input more reactive " "or work around collision tunneling issues, but keep in mind doing so will " "increase CPU usage. See also [member target_fps] and [member ProjectSettings." -"physics/common/physics_fps].\n" +"physics/common/physics_ticks_per_second].\n" "[b]Note:[/b] Only 8 physics ticks may be simulated per rendered frame at " "most. If more than 8 physics ticks have to be simulated per rendered frame " "to keep up with rendering, the game will appear to slow down (even if " "[code]delta[/code] is used consistently in physics calculations). Therefore, " -"it is recommended not to increase [member Engine.iterations_per_second] " +"it is recommended not to increase [member Engine.physics_ticks_per_second] " "above 240. Otherwise, the game will slow down when the rendering framerate " "goes below 30 FPS." msgstr "" @@ -36557,7 +36557,7 @@ msgid "" "Returns the time elapsed (in seconds) since the last physics-bound frame " "(see [method _physics_process]). This is always a constant value in physics " "processing unless the frames per second is changed via [member Engine." -"iterations_per_second]." +"physics_ticks_per_second]." msgstr "" #: doc/classes/Node.xml @@ -36950,7 +36950,7 @@ msgid "" "Enables or disables physics (i.e. fixed framerate) processing. When a node " "is being processed, it will receive a [constant " "NOTIFICATION_PHYSICS_PROCESS] at a fixed (usually 60 FPS, see [member Engine." -"iterations_per_second] to change) interval (and the [method " +"physics_ticks_per_second] to change) interval (and the [method " "_physics_process] callback will be called if exists). Enabled automatically " "if [method _physics_process] is overridden. Any calls to this before [method " "_ready] will be ignored." @@ -45569,7 +45569,7 @@ msgstr "" msgid "" "Maximum number of frames per second allowed. The actual number of frames per " "second may still be below this value if the game is lagging. See also " -"[member physics/common/physics_fps].\n" +"[member physics/common/physics_ticks_per_second].\n" "If [member display/window/vsync/use_vsync] is enabled, it takes precedence " "and the forced FPS number cannot exceed the monitor's refresh rate.\n" "This setting is therefore mostly relevant for lowering the maximum FPS below " @@ -46624,7 +46624,7 @@ msgid "" "[code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim " "to reduce the velocity to [code]0[/code] in half a second. A value equal to " "or greater than the physics frame rate ([member ProjectSettings.physics/" -"common/physics_fps], [code]60[/code] by default) will bring the object to a " +"common/physics_ticks_per_second], [code]60[/code] by default) will bring the object to a " "stop in one iteration." msgstr "" @@ -46661,7 +46661,7 @@ msgid "" "[code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim " "to reduce the velocity to [code]0[/code] in half a second. A value equal to " "or greater than the physics frame rate ([member ProjectSettings.physics/" -"common/physics_fps], [code]60[/code] by default) will bring the object to a " +"common/physics_ticks_per_second], [code]60[/code] by default) will bring the object to a " "stop in one iteration." msgstr "" @@ -46731,7 +46731,7 @@ msgid "" "[code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim " "to reduce the velocity to [code]0[/code] in half a second. A value equal to " "or greater than the physics frame rate ([member ProjectSettings.physics/" -"common/physics_fps], [code]60[/code] by default) will bring the object to a " +"common/physics_ticks_per_second], [code]60[/code] by default) will bring the object to a " "stop in one iteration." msgstr "" @@ -46768,7 +46768,7 @@ msgid "" "[code]0[/code] in less than a second e.g. a value of [code]2[/code] will aim " "to reduce the velocity to [code]0[/code] in half a second. A value equal to " "or greater than the physics frame rate ([member ProjectSettings.physics/" -"common/physics_fps], [code]60[/code] by default) will bring the object to a " +"common/physics_ticks_per_second], [code]60[/code] by default) will bring the object to a " "stop in one iteration." msgstr "" @@ -46822,13 +46822,13 @@ msgid "" "simulation and [method Node._physics_process] methods are run. See also " "[member debug/settings/fps/force_fps].\n" "[b]Note:[/b] This property is only read when the project starts. To change " -"the physics FPS at runtime, set [member Engine.iterations_per_second] " +"the physics FPS at runtime, set [member Engine.physics_ticks_per_second] " "instead.\n" "[b]Note:[/b] Only 8 physics ticks may be simulated per rendered frame at " "most. If more than 8 physics ticks have to be simulated per rendered frame " "to keep up with rendering, the game will appear to slow down (even if " "[code]delta[/code] is used consistently in physics calculations). Therefore, " -"it is recommended not to increase [member physics/common/physics_fps] above " +"it is recommended not to increase [member physics/common/physics_ticks_per_second] above " "240. Otherwise, the game will slow down when the rendering framerate goes " "below 30 FPS." msgstr "" diff --git a/main/main.cpp b/main/main.cpp index 7b291e7f3..9433832c9 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1191,8 +1191,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } } - Engine::get_singleton()->set_iterations_per_second(GLOBAL_DEF("physics/common/physics_fps", 60)); - ProjectSettings::get_singleton()->set_custom_property_info("physics/common/physics_fps", PropertyInfo(Variant::INT, "physics/common/physics_fps", PROPERTY_HINT_RANGE, "1,1000,1")); + Engine::get_singleton()->set_physics_ticks_per_second(GLOBAL_DEF("physics/common/physics_ticks_per_second", 60)); + ProjectSettings::get_singleton()->set_custom_property_info("physics/common/physics_ticks_per_second", PropertyInfo(Variant::INT, "physics/common/physics_ticks_per_second", PROPERTY_HINT_RANGE, "1,1000,1")); Engine::get_singleton()->set_physics_jitter_fix(GLOBAL_DEF("physics/common/physics_jitter_fix", 0.5)); Engine::get_singleton()->set_target_fps(GLOBAL_DEF("debug/settings/fps/force_fps", 0)); ProjectSettings::get_singleton()->set_custom_property_info("debug/settings/fps/force_fps", PropertyInfo(Variant::INT, "debug/settings/fps/force_fps", PROPERTY_HINT_RANGE, "0,1000,1")); @@ -2158,12 +2158,12 @@ bool Main::iteration() { uint64_t ticks_elapsed = ticks - last_ticks; - int physics_fps = Engine::get_singleton()->get_iterations_per_second(); - float frame_slice = 1.0 / physics_fps; + int physics_ticks_per_second = Engine::get_singleton()->get_physics_ticks_per_second(); + float frame_slice = 1.0 / physics_ticks_per_second; float time_scale = Engine::get_singleton()->get_time_scale(); - MainFrameTime advance = main_timer_sync.advance(frame_slice, physics_fps); + MainFrameTime advance = main_timer_sync.advance(frame_slice, physics_ticks_per_second); double step = advance.idle_step; double scaled_step = step * time_scale; diff --git a/main/main_timer_sync.cpp b/main/main_timer_sync.cpp index b78c499a9..11ae3be81 100644 --- a/main/main_timer_sync.cpp +++ b/main/main_timer_sync.cpp @@ -320,14 +320,14 @@ int MainTimerSync::get_average_physics_steps(float &p_min, float &p_max) { } // advance physics clock by p_idle_step, return appropriate number of steps to simulate -MainFrameTime MainTimerSync::advance_core(float p_frame_slice, int p_iterations_per_second, float p_idle_step) { +MainFrameTime MainTimerSync::advance_core(float p_frame_slice, int p_physics_ticks_per_second, float p_idle_step) { MainFrameTime ret; ret.idle_step = p_idle_step; // simple determination of number of physics iteration time_accum += ret.idle_step; - ret.physics_steps = floor(time_accum * p_iterations_per_second); + ret.physics_steps = floor(time_accum * p_physics_ticks_per_second); int min_typical_steps = typical_physics_steps[0]; int max_typical_steps = min_typical_steps + 1; @@ -360,7 +360,7 @@ MainFrameTime MainTimerSync::advance_core(float p_frame_slice, int p_iterations_ // try to keep it consistent with previous iterations if (ret.physics_steps < min_typical_steps) { - const int max_possible_steps = floor((time_accum)*p_iterations_per_second + get_physics_jitter_fix()); + const int max_possible_steps = floor((time_accum)*p_physics_ticks_per_second + get_physics_jitter_fix()); if (max_possible_steps < min_typical_steps) { ret.physics_steps = max_possible_steps; update_typical = true; @@ -368,7 +368,7 @@ MainFrameTime MainTimerSync::advance_core(float p_frame_slice, int p_iterations_ ret.physics_steps = min_typical_steps; } } else if (ret.physics_steps > max_typical_steps) { - const int min_possible_steps = floor((time_accum)*p_iterations_per_second - get_physics_jitter_fix()); + const int min_possible_steps = floor((time_accum)*p_physics_ticks_per_second - get_physics_jitter_fix()); if (min_possible_steps > max_typical_steps) { ret.physics_steps = min_possible_steps; update_typical = true; @@ -403,7 +403,7 @@ MainFrameTime MainTimerSync::advance_core(float p_frame_slice, int p_iterations_ } // calls advance_core, keeps track of deficit it adds to animaption_step, make sure the deficit sum stays close to zero -MainFrameTime MainTimerSync::advance_checked(float p_frame_slice, int p_iterations_per_second, float p_idle_step) { +MainFrameTime MainTimerSync::advance_checked(float p_frame_slice, int p_physics_ticks_per_second, float p_idle_step) { if (fixed_fps != -1) { p_idle_step = 1.0 / fixed_fps; } @@ -414,7 +414,7 @@ MainFrameTime MainTimerSync::advance_checked(float p_frame_slice, int p_iteratio // compensate for last deficit p_idle_step += time_deficit; - MainFrameTime ret = advance_core(p_frame_slice, p_iterations_per_second, p_idle_step); + MainFrameTime ret = advance_core(p_frame_slice, p_physics_ticks_per_second, p_idle_step); // we will do some clamping on ret.idle_step and need to sync those changes to time_accum, // that's easiest if we just remember their fixed difference now @@ -454,7 +454,7 @@ MainFrameTime MainTimerSync::advance_checked(float p_frame_slice, int p_iteratio #endif if (time_accum > p_frame_slice) { - const int extra_physics_steps = floor(time_accum * p_iterations_per_second); + const int extra_physics_steps = floor(time_accum * p_physics_ticks_per_second); time_accum -= extra_physics_steps * p_frame_slice; ret.physics_steps += extra_physics_steps; } @@ -515,8 +515,8 @@ void MainTimerSync::set_fixed_fps(int p_fixed_fps) { } // advance one frame, return timesteps to take -MainFrameTime MainTimerSync::advance(float p_frame_slice, int p_iterations_per_second) { +MainFrameTime MainTimerSync::advance(float p_frame_slice, int p_physics_ticks_per_second) { float cpu_idle_step = get_cpu_idle_step(); - return advance_checked(p_frame_slice, p_iterations_per_second, cpu_idle_step); + return advance_checked(p_frame_slice, p_physics_ticks_per_second, cpu_idle_step); } diff --git a/main/main_timer_sync.h b/main/main_timer_sync.h index 1c49fefb9..1cc32d416 100644 --- a/main/main_timer_sync.h +++ b/main/main_timer_sync.h @@ -139,10 +139,10 @@ protected: int get_average_physics_steps(float &p_min, float &p_max); // advance physics clock by p_idle_step, return appropriate number of steps to simulate - MainFrameTime advance_core(float p_frame_slice, int p_iterations_per_second, float p_idle_step); + MainFrameTime advance_core(float p_frame_slice, int p_physics_ticks_per_second, float p_idle_step); // calls advance_core, keeps track of deficit it adds to animaption_step, make sure the deficit sum stays close to zero - MainFrameTime advance_checked(float p_frame_slice, int p_iterations_per_second, float p_idle_step); + MainFrameTime advance_checked(float p_frame_slice, int p_physics_ticks_per_second, float p_idle_step); // determine wall clock step since last iteration float get_cpu_idle_step(); @@ -158,7 +158,7 @@ public: void set_fixed_fps(int p_fixed_fps); // advance one frame, return timesteps to take - MainFrameTime advance(float p_frame_slice, int p_iterations_per_second); + MainFrameTime advance(float p_frame_slice, int p_physics_ticks_per_second); }; #endif // MAIN_TIMER_SYNC_H diff --git a/modules/network_synchronizer/doc_classes/NetworkedController.xml b/modules/network_synchronizer/doc_classes/NetworkedController.xml index f7262d494..4245dd4d7 100644 --- a/modules/network_synchronizer/doc_classes/NetworkedController.xml +++ b/modules/network_synchronizer/doc_classes/NetworkedController.xml @@ -92,7 +92,7 @@ - + diff --git a/modules/network_synchronizer/networked_controller.cpp b/modules/network_synchronizer/networked_controller.cpp index bf464da6d..454e01ce5 100644 --- a/modules/network_synchronizer/networked_controller.cpp +++ b/modules/network_synchronizer/networked_controller.cpp @@ -99,7 +99,7 @@ void NetworkedController::_bind_methods() { ClassDB::bind_method(D_METHOD("get_current_input_id"), &NetworkedController::get_current_input_id); - ClassDB::bind_method(D_METHOD("player_get_pretended_delta", "iterations_per_seconds"), &NetworkedController::player_get_pretended_delta); + ClassDB::bind_method(D_METHOD("player_get_pretended_delta", "physics_ticks_per_seconds"), &NetworkedController::player_get_pretended_delta); ClassDB::bind_method(D_METHOD("mark_epoch_as_important"), &NetworkedController::mark_epoch_as_important); @@ -289,9 +289,9 @@ uint32_t NetworkedController::get_current_input_id() const { return controller->get_current_input_id(); } -real_t NetworkedController::player_get_pretended_delta(uint32_t p_iterations_per_seconds) const { - ERR_FAIL_COND_V_MSG(is_player_controller() == false, 1.0 / real_t(p_iterations_per_seconds), "This function can be called only on client."); - return get_player_controller()->get_pretended_delta(p_iterations_per_seconds); +real_t NetworkedController::player_get_pretended_delta(uint32_t p_physics_ticks_per_seconds) const { + ERR_FAIL_COND_V_MSG(is_player_controller() == false, 1.0 / real_t(p_physics_ticks_per_seconds), "This function can be called only on client."); + return get_player_controller()->get_pretended_delta(p_physics_ticks_per_seconds); } void NetworkedController::mark_epoch_as_important() { @@ -1441,7 +1441,7 @@ void DollController::receive_batch(const PoolVector &p_data) { net_poorness); // TODO cache this? - const double frames_per_batch = node->get_doll_epoch_batch_sync_rate() * real_t(Engine::get_singleton()->get_iterations_per_second()); + const double frames_per_batch = node->get_doll_epoch_batch_sync_rate() * real_t(Engine::get_singleton()->get_physics_ticks_per_second()); const double next_batch_arrives_in = Math::ceil(double(next_collect_rate) / frames_per_batch) * frames_per_batch; const real_t doll_interpolation_max_speedup = node->get_doll_interpolation_max_speedup(); diff --git a/modules/network_synchronizer/networked_controller.h b/modules/network_synchronizer/networked_controller.h index 5d85e0eaa..d68805572 100644 --- a/modules/network_synchronizer/networked_controller.h +++ b/modules/network_synchronizer/networked_controller.h @@ -284,7 +284,7 @@ public: } /// Returns the pretended delta used by the player. - real_t player_get_pretended_delta(uint32_t p_iterations_per_seconds) const; + real_t player_get_pretended_delta(uint32_t p_physics_ticks_per_seconds) const; void mark_epoch_as_important(); diff --git a/modules/network_synchronizer/scene_synchronizer.cpp b/modules/network_synchronizer/scene_synchronizer.cpp index b7847f86d..6bc83fb1a 100644 --- a/modules/network_synchronizer/scene_synchronizer.cpp +++ b/modules/network_synchronizer/scene_synchronizer.cpp @@ -2003,7 +2003,7 @@ void ClientSynchronizer::process() { } const real_t delta = scene_synchronizer->get_physics_process_delta_time(); - const real_t physics_ticks_per_second = Engine::get_singleton()->get_iterations_per_second(); + const real_t physics_ticks_per_second = Engine::get_singleton()->get_physics_ticks_per_second(); #ifdef DEBUG_ENABLED if (unlikely(Engine::get_singleton()->get_frames_per_second() < physics_ticks_per_second)) { diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp index 56891fa92..49215ba74 100644 --- a/scene/3d/cpu_particles.cpp +++ b/scene/3d/cpu_particles.cpp @@ -632,7 +632,7 @@ void CPUParticles::_particles_process(float p_delta) { } float system_phase = time / lifetime; - real_t physics_tick_delta = 1.0 / Engine::get_singleton()->get_iterations_per_second(); + real_t physics_tick_delta = 1.0 / Engine::get_singleton()->get_physics_ticks_per_second(); // Streaky particles can "prime" started particles by placing them back in time // from the current physics tick, to place them in the position they would have reached diff --git a/scene/3d/spatial_velocity_tracker.cpp b/scene/3d/spatial_velocity_tracker.cpp index 78d074d95..cec5c39cf 100644 --- a/scene/3d/spatial_velocity_tracker.cpp +++ b/scene/3d/spatial_velocity_tracker.cpp @@ -68,7 +68,7 @@ Vector3 SpatialVelocityTracker::get_tracked_linear_velocity() const { if (position_history_len) { if (physics_step) { uint64_t base = Engine::get_singleton()->get_physics_frames(); - base_time = float(base - position_history[0].frame) / Engine::get_singleton()->get_iterations_per_second(); + base_time = float(base - position_history[0].frame) / Engine::get_singleton()->get_physics_ticks_per_second(); } else { uint64_t base = Engine::get_singleton()->get_idle_frame_ticks(); base_time = double(base - position_history[0].frame) / 1000000.0; @@ -81,7 +81,7 @@ Vector3 SpatialVelocityTracker::get_tracked_linear_velocity() const { Vector3 distance = position_history[i].position - position_history[i + 1].position; if (physics_step) { - delta = float(diff) / Engine::get_singleton()->get_iterations_per_second(); + delta = float(diff) / Engine::get_singleton()->get_physics_ticks_per_second(); } else { delta = double(diff) / 1000000.0; }