[Bf-gamedev] Proposal: finer clock management

Arnaud Degroote arnaud.degroote at laas.fr
Mon Nov 25 11:19:29 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.

As I understand the code, m_clocktime affects both logic and physics.
Basically, the framestep is computed from the difference between the
m_clocktime and the m_frametime (the time of the last physic / logic
frame rendered). The logic is a bit more complex if you have different
settings for maxLogicFrame and maxPhysicsFrame).


> On Nov 22, 2013 12:46 AM, "Arnaud Degroote" <arnaud.degroote at laas.fr> wrote:
> 
> > Hi, I want to propose some mechanisms to allow better clock management
> > at the Game Engine Level.
> >
> > At the moment, there is globally two tick models, one 'real-time' with
> > possibly frame drop, and another one which basically 'render all frame'.
> >
> > What I would like to do is to be able to 'accelerate' game engine, (i.e.
> > make the world move faster than 'real-time'), or 'slow-down' the world
> > (bullet effect-like) or even 'pause' the world.
> >
> > To 'pause' the world, I can just use suspend(). For 'slow-down', you can
> > do it in some complex method, using suspend() at different intervals for
> > different scenes to get more or less the desired behaviour, but it seems
> > quite complex and costly. To accelerate the world, as far as I know,
> > there is no easy way to do it.
> >
> > What I propose in these patches is to allow a 'user-settable' clock,
> > i.e. the possibility for the developer to finely control how the time
> > elapse in its game.
> >
> > The next issue is how to call it. Calling it from a 'normal' logic block
> > is a bit dangerous as, if for any reason, you don't make the time
> > progress enough, there is good change that your logic brick won't be
> > called anymore.
> >
> > So, one safer possibility is to use the 'main python controller' (see
> > KX_GetPythonMain) but it may a bit overkill in lot of situation. Maybe
> > we can add another special property (such as __main__) (I think at a
> > __clock__ property), and call it automatically, if it exists in
> > BL_KetsjiNextFrame.
> >
> > I would like to have your opinions on my goal (maybe I miss some easier
> > way to achieve it), current attached patches, and proposal to continue.
> >
> > Thanks in advance. Best regards,

-- 
Arnaud Degroote
Postdoc
RIA LAAS - CNRS
-------------- 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/451647ea/attachment.pgp 


More information about the Bf-gamedev mailing list