nannou icon indicating copy to clipboard operation
nannou copied to clipboard

Improve loop timing and revisit `LoopMode`s

Open mitchmindtree opened this issue 5 years ago • 2 comments

This is a reminder for myself to revisit our approach to application loop timing, and perhaps implement some options based on the game loop article here.

Options that we definitely want:

  • Loop once: model runs once, update runs once then view runs once. Following this, the application simply waits on window, application and input events. update and view are never called again. This would be best implemented a manner that allows any number of loops. Our LoopMode::NTimes is basically this.
  • Wait: model runs once, update runs once then view runs once. Following this, the application waits on window, application and input events. Once events are cleared, update and then view run, and the application goes back to waiting for events. This is currently implemented as LoopMode::Wait.
  • A continuous loop mode: We currently have RefreshSync and Rate modes, but both are a little unstable on different platforms. This article describes a nice solution which may solve the issues that we currently have with both.

mitchmindtree avatar Feb 23 '20 13:02 mitchmindtree

This article might be useful as well: https://gafferongames.com/post/fix_your_timestep/

foltik avatar Apr 17 '20 02:04 foltik

This seems like an integral part of Nannou... As it stands, the Rate mode does not even follow the user preference for a given update rate. It's been two years — are there still plans to work on this?

bluelhf avatar Jun 04 '22 12:06 bluelhf