diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2009-05-01 20:35:06 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2009-05-01 20:35:06 +0400 |
commit | 672492f563e148dc608965c5d0011413fbfae0eb (patch) | |
tree | 57aa0b79b8de32cef7ce3dee32e6013045e30d76 /source/gameengine/Ketsji/KX_KetsjiEngine.h | |
parent | 1c6cd47f2b93ba05c54f82c9363f269c71e28cda (diff) |
BGE: New function GameLogic.setMaxLogicFrame() to allow better control over the time spent on logic.
This function sets the maximum number of logic frame executed per render frame.
Valid values: 1..5
This function is useful to control the amount of processing consumed by logic.
By default, up to 5 logic frames can be executed per render frame. This is fine
as long as the time spent on logic is negligible compared to the render time.
If it's not the case, the default value will drag the performance of the game
down by executing unnecessary logic frames that take up most of the CPU time.
You can avoid that by lowering the value with this function.
The drawback is less precision in the logic system to physics and I/O activity.
Note that it does not affect the physics system: physics will still run
at full frame rate (actually up to 5 times the ticrate).
You can further control the render frame rate with GameLogic.setLogicTicRate().
Diffstat (limited to 'source/gameengine/Ketsji/KX_KetsjiEngine.h')
-rw-r--r-- | source/gameengine/Ketsji/KX_KetsjiEngine.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h index a8ccd6100d7..791c5d24daa 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.h +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h @@ -103,6 +103,7 @@ private: double m_previousClockTime;//previous clock time double m_remainingTime; + static int m_maxLogicFrame; /* maximum number of consecutive logic frame */ static double m_ticrate; static double m_anim_framerate; /* for animation playback only - ipo and action */ @@ -283,6 +284,14 @@ public: * Sets the number of logic updates per second. */ static void SetTicRate(double ticrate); + /** + * Gets the maximum number of logic frame before render frame + */ + static int KX_KetsjiEngine::GetMaxLogicFrame(); + /** + * Sets the maximum number of logic frame before render frame + */ + static void KX_KetsjiEngine::SetMaxLogicFrame(int frame); /** * Gets the framerate for playing animations. (actions and ipos) |