Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorArnaud Degroote <arnaud.degroote@isae-supaero.fr>2015-12-12 04:37:42 +0300
committerJorge Bernal <jbernalmartinez@gmail.com>2015-12-12 04:46:53 +0300
commitaae93ae4c6c13e2b30ba272e24354dd020880868 (patch)
tree2f3cea018e4e19258d562ae45ccfdef929ff12d0 /doc
parente089b1f08bdf72eb4441e62f9c99e01ace0ef5c4 (diff)
BGE: Improve clock management
This patch improves clock management in BGE, to be able to accelerate / slow the time, and also to finely synchronize clock with external engines. Several new python functions have been added and existence ones have been improved for that purpose. Now we have: - getClockTime(): Get the current BGE render time, in seconds. The BGE render time is the simulation time corresponding to the next scene that will be rendered. - getFrameTime(): Get the current BGE frame time, in seconds. The BGE frame time is the simulation time corresponding to the current call of the logic system. Generally speaking, it is what the user is interested in. - getRealTime(): Get the number of real (system-clock) seconds elapsed since the beginning of the simulation. - getTimeScale(): Get the time multiplier between real-time and simulation time. The default value is 1.0. A value greater than 1.0 means that the simulation is going faster than real-time, a value lower than 1.0 means that the simulation is going slower than real-time. - setTimeScale(time_scale): Set the time multiplier between real-time and simulation time. A value greater than 1.0 means that the simulation is going faster than real-time, a value lower than 1.0 means that the simulation is going slower than real-time. Note that a too large value may lead to some physics instabilities. - getUseExternalClock(): Get if the BGE use the inner BGE clock, or rely or on an external clock. The default is to use the inner BGE clock. - setUseExternalClock(use_external_clock): Set if the BGE use the inner BGE clock, or rely or on an external clock. If the user selects the use of an external clock, he should call regularly the setClockTime method. - setClockTime(new_time): Set the next value of the simulation clock. It is preferable to use this method from a custom main function in python, as calling it in the logic block can easily lead to a blocked system (if the time does not advance enough to run at least the next logic step). Rationale are described more precisely in the thread http://lists.blender.org/pipermail/bf-gamedev/2013-November/000165.html. See also T37640 Reviewers: sybren, panzergame, #game_engine, lordloki, moguri Reviewed By: sybren, panzergame, #game_engine, lordloki, moguri Subscribers: moguri, hg1, sybren, panzergame, dfelinto, lordloki Projects: #game_engine Maniphest Tasks: T37640 Differential Revision: https://developer.blender.org/D728
Diffstat (limited to 'doc')
-rw-r--r--doc/python_api/rst/bge.logic.rst70
1 files changed, 70 insertions, 0 deletions
diff --git a/doc/python_api/rst/bge.logic.rst b/doc/python_api/rst/bge.logic.rst
index b119bdd1ba1..3f35901234a 100644
--- a/doc/python_api/rst/bge.logic.rst
+++ b/doc/python_api/rst/bge.logic.rst
@@ -378,6 +378,76 @@ General functions
Render next frame (if Python has control)
+**********************
+Time related functions
+**********************
+
+.. function:: getClockTime()
+
+ Get the current BGE render time, in seconds. The BGE render time is the
+ simulation time corresponding to the next scene that will be rendered.
+
+ :rtype: double
+
+.. function:: getFrameTime()
+
+ Get the current BGE frame time, in seconds. The BGE frame time is the
+ simulation time corresponding to the current call of the logic system.
+ Generally speaking, it is what the user is interested in.
+
+ :rtype: double
+
+.. function:: getRealTime()
+
+ Get the number of real (system-clock) seconds elapsed since the beginning
+ of the simulation.
+
+ :rtype: double
+
+.. function:: getTimeScale()
+
+ Get the time multiplier between real-time and simulation time. The default
+ value is 1.0. A value greater than 1.0 means that the simulation is going
+ faster than real-time, a value lower than 1.0 means that the simulation is
+ going slower than real-time.
+
+ :rtype: double
+
+.. function:: setTimeScale(time_scale)
+
+ Set the time multiplier between real-time and simulation time. A value
+ greater than 1.0 means that the simulation is going faster than real-time,
+ a value lower than 1.0 means that the simulation is going slower than
+ real-time. Note that a too large value may lead to some physics
+ instabilities.
+
+ :arg time_scale: The new time multiplier.
+
+.. function:: getUseExternalClock()
+
+ Get if the BGE use the inner BGE clock, or rely or on an external
+ clock. The default is to use the inner BGE clock.
+
+ :rtype: bool
+
+.. function:: setUseExternalClock(use_external_clock)
+
+ Set if the BGE use the inner BGE clock, or rely or on an external
+ clock. If the user selects the use of an external clock, he should call
+ regularly the setClockTime method.
+
+ :arg use_external_clock: the new setting
+
+.. function:: setClockTime(new_time)
+
+ Set the next value of the simulation clock. It is preferable to use this
+ method from a custom main function in python, as calling it in the logic
+ block can easily lead to a blocked system (if the time does not advance
+ enough to run at least the next logic step).
+
+ :arg new_time: the next value of the BGE clock (in second).
+
+
*****************
Utility functions
*****************