I'm not an expert on this topic, but pyglet is currently using a Waitable
Timer on Windows, and Glibc usleep on Linux. This should be microsecond
precision on both platforms. If there is a more precise way to do this,
then it's worth doing. The clock module actually has a built in test
function that you can run by: "python pyglet/clock.py"
There are a few options for testing.
On Wednesday, February 22, 2017 at 4:03:39 PM UTC+9, Charles wrote:
>
> I've been noticing this quite often, but what essentially what happens is,
> the sprite 'catches' and has a small stutter as it moves. At first I
> thought this was a camera issue, but I have since noticed it on sprites
> moving without any screen movement whatsoever.
>
> The movement is fast, but there seems to be periods where it starts to
> stutter. This can be several in a row, to constant, to every other second,
> but it's there.
>
> I have reduced the issue to a basic program:
>
> import pyglet
>
> window = pyglet.window.Window(800,600, vsync=False)
> fps_display = pyglet.clock.ClockDisplay(color=(1,0,0,0.5))
>
> batch = pyglet.graphics.Batch()
>
> tileImg = pyglet.image.load("tile_test.png")
>
> playerImg = pyglet.image.load("square.png")
>
> group = pyglet.graphics.Group()
>
> sprites = []
> for i in xrange(50):
> for j in xrange(50):
> sprites.append(pyglet.sprite.Sprite(tileImg, x=i*32, y=j*32,
> batch=batch))
>
> playerSprite = pyglet.sprite.Sprite(playerImg, x=50, y=50, batch=batch)
>
> @window.event
> def on_draw():
> window.clear()
>
> batch.draw()
>
> def moveChar(dt, axis, val):
> if axis == "x":
> playerSprite.update(x=playerSprite.x+val)
> else:
> playerSprite.update(y=playerSprite.y+val)
>
> @window.event
> def on_key_press(symbol,modifiers):
> if symbol == pyglet.window.key.LEFT:
> pyglet.clock.schedule_interval(moveChar, 1/60.0, "x", -1)
>
> elif symbol == pyglet.window.key.RIGHT:
> pyglet.clock.schedule_interval(moveChar, 1/60.0, "x", 1)
>
> elif symbol == pyglet.window.key.UP:
> pyglet.clock.schedule_interval(moveChar, 1/60.0, "y", 1)
>
> elif symbol == pyglet.window.key.DOWN:
>
> pyglet.clock.schedule_interval(moveChar, 1/60.0, "y", -1)
>
> else:
> pyglet.clock.unschedule(moveChar)
>
>
> pyglet.app.run()
>
>
> Can anyone test this to see if they too get an issue? I am not sure if we
> are allowed to post links here but I have a simple video showcasing the
> issue: http://www.mediafire.com/file/ir7f5x5gxnbgi90/sprite-stutter.mp4
> (Sorry on the hosting, YT butchers the quality to where you can't see it)
>
--
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.