[Bf-gamedev] Proposal: finer clock management

Arnaud Degroote arnaud.degroote at laas.fr
Mon Nov 25 14:10:44 CET 2013


On 23/Nov - 10:03, Jacob Merrill wrote:
> I use properties to manage animations, and scripts and physics impulses,
> using logic brick for loops.
> 
> With this method, the logic tic rate can control the animations and
> scripts, however I don't know how to effect bullet to change it's clock
> speed.
> 
> If one could adjust the global frame rate by a float, and adjust the
> physics engine accordingly, this would allow for slow down and speed up
> gracefully.

Please find in attachment a set of patches related to the described
issues. In particular, the patch 0002 adds support for this time_scale
parameter. 

There is one open question still about this variable, and how is related
to ticrate. Basically, is ticrate related to 'real seconds' or
'simulated seconds'. Here, I use ticrate as a 'real seconds' but it
would be easy to consider 'real seconds'. To be clearer, if you set
time_scale to 2.0 (i.e simulated two seconds in one real-time second),
and ticrate at 60, you will (using this implementation) call your physic
/ logic 60 time in one real second, so only 30 times by game second.

If the other behaviour is preferred, you just need to remove the
time_scale factor in the computation of timestep.

Anyway, whatever behaviour you choose, it is easy to let the use the
other option, as it can always call bge.logic.setLogicRate() in
association with bge.logic.setTimeScale().

Any comments are welcome.

-- 
Arnaud Degroote
Postdoc
RIA LAAS - CNRS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Expose-the-different-clock-through-a-python-API.patch
Type: text/x-diff
Size: 2309 bytes
Desc: not available
Url : http://lists.blender.org/pipermail/bf-gamedev/attachments/20131125/7f1c1108/attachment.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Add-a-time_scale-float-to-control-how-the-time-elaps.patch
Type: text/x-diff
Size: 5615 bytes
Desc: not available
Url : http://lists.blender.org/pipermail/bf-gamedev/attachments/20131125/7f1c1108/attachment-0001.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-BGE-Remove-some-unused-variables.patch
Type: text/x-diff
Size: 1721 bytes
Desc: not available
Url : http://lists.blender.org/pipermail/bf-gamedev/attachments/20131125/7f1c1108/attachment-0002.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
Url : http://lists.blender.org/pipermail/bf-gamedev/attachments/20131125/7f1c1108/attachment.pgp 


More information about the Bf-gamedev mailing list