How to Run at 60Hz

We recently came across an interesting article on IMVU’s engineering blog. That blog is well worth following if you are interested in collaborative virtual environments: IMVU is one of the better social platforms and it constantly involves. They also give back to the open source community (notably through their contributions to Cal3D).

Anyway, the recent article “How to Write an Interactive, 60 Hz Desktop Application” struck a chord. One topic we wanted to spend more time on in the book is how real-time applications are actually structured with respect to operating system facilities. In Chapter 5 we talked about the structure of real-time graphics-heavy applications, and that part of the book talks at several points about abstractions and middleware. There wasn’t time to talk or space about specific control architectures.

The article on IMVU’s blog does a good job of studying one particular programming paradigm: the Windows event loop. How should you structure the event loop to avoid blocking or waiting for simulation, and thus maintain a high frame-rate. Multithreading might be one answer. You could use higher-level APIs that hide the event loop, but it is important to understand the underlying event processing.

Anyway, the article is well worth a look. If we get time, we’ll encode their final suggestion in to one of our boid test programs.