Actually set_fps_limit works fine it just doesn't do anything for
schedule_interval or schedule_interval_soft (as you might expect).

What may have confused you somehwat here is that the default clock
does not tick every time your update function is called. Create a
separate clock to tick in your update function and see for yourself. I
would recommend not disabling vsync, there's nothing to be gained by
it.

Richard.

On Aug 28, 10:41 am, Padraig Kitterick <[email protected]>
wrote:
> Hi Guillaume,
>
> Set_fps_limit is no longer effective. Your fps is high because pyglet  
> will redraw the window as often as is necessary to keep it updated,  
> i.e. if the mouse passes over it. Try setting the windows 'invalid'  
> flag which should stop pyglet from drawing that window, and instead  
> schedule your on_draw function in your scheduled update function. That  
> will limit draws to the frequency of the update function calls.
>
> Padraig
>
> On 28 Aug 2009, at 05:48, Guillaume Simard <[email protected]> wrote:
>
>
>
> > I forgot to mention my OS,
>
> > I'm using Mac OS X 10.5.8
>
> > On Aug 28, 12:41 am, Guillaume Simard <[email protected]> wrote:
> >> Hi everyone,
> >> In my current application, I am using
>
> >>     def update(dt):
> >>         # update stuff
>
> >>     pyglet.clock.schedule_interval(update, 1.0 / 60.0)
>
> >> and
>
> >>     @window.event
> >>     def on_draw():
> >>         # draw stuff
>
> >> for my basic "game loop" (drawing and updating the game). My needs  
> >> are
> >> simple. I want "update" and "draw" to be called approximatively 60
> >> times per second.
> >> However, I've been having a lot of issues with this way of doing
> >> things even though the documentation seems to recommend it.
>
> >> First, if vsync is enabled, update will be called with varying
> >> timesteps. Even though it should be called around 60 times per  
> >> second,
> >> I often end up with a call every 30th of a second and get an average
> >> update per second varying between 30 and 60.
>
> >> Disabling vsync fixes that issue and gives me a constant 60 update  
> >> per second.
>
> >> Second, if I disable vsync, my draws per second (fps) become very
> >> high. Averaging around 400 fps.
> >> This is problematic since my extremely simple game now takes up over
> >> 80% of my cpu.
>
> >> I tried using pyglet.clock.set_fps_limit() but it doesn't seem to be
> >> doing anything.
>
> >> The recommended way of doing a "game loop" is simple and I can see  
> >> the
> >> advantages. However, I'd like to have more control over it.
> >> Has anyone experienced similar problems ?
> >> Am I doing something wrong ?
>
> >> Thanks in advance for the help !
>
> >> --
> >> Guillaume S.
> >> guisim.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to