Well you've hit on the issue I'm trying to resolve. How can I schedule
movement at a fixed time step if the scheduling functions are all variable
time step no matter what? Let's say I want to move a sprite, if I create an
update function for it Example:
def move_sprite(dt):
sprite.x += 50*(1/60.0)
pyglet.clock.schedule_interval(move_sprite, 1.0/60)
Even if I progress movement at a fixed paced, the schedule is not
scheduling it at correct times. I was also under the impression the on_draw
is the display routine, which doesn't take a dt parameter. Not to mention
how are you going to separate movement if the sprite position is directly
related to its render position and interpolate? I am having trouble
understanding how this would even look with pyglet.
On Wednesday, November 2, 2016 at 5:16:35 PM UTC-5, Greg Ewing wrote:
>
> Baitshop wrote:
> > My main concern is making sure movement is deterministic, so things like
> > replays and speed checking are able to be calculated properly and
> > reliably.
>
> The way this is usually handled is to run the physics with
> a *fixed* time step, which is independent of the display
> frame rate. In that case, the physics update routine doesn't
> need or want a dt parameter -- you always advance the game
> time by the same amount, even if it's not exactly the
> amount of real time that has passed.
>
> Then if you want the frame rate to be higher than the
> physics rate, the display routine is the one that takes
> a dt parameter, and interpolates between two physics
> steps accordingly.
>
> --
> Greg
>
>
--
You received this message because you are subscribed to the Google Groups
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.