In the first part I talked about frame-limiting and some ideas as to how you can limit speed in a fairly accurate manner. It’s only fair to talk about the other part of keeping frame rates constant: frame-skipping.
Obviously with emulation there’s no guarantee you’ll have everything you want done for one frame in 1/60 of a second. Especially with the newer, more complex hardware it’s tough to do it all. You can’t really slow down cpu emulation since it’s vital for accurate emulation and you probably can’t live without sound support. About the best solution then is to just not draw anything to the screen for a frame or more until emulation catches up. If done right the users won’t notice any differences(unless you’re dropping a lot frames) and it’s something that everyone can live with. The only potential issue is that if the cpu emulation is taking signifcantly more processing than the video rendering, you’re screwed(since skipping frames won’t make that much difference).
Now then, here’s some basic pointers for implementing frame-skipping:
1. Don’t skip any more than I’d say 9 frames in succession. Heck, even that may be too much.
2. Just like with frame-limiting, you should be keeping track of timing every frame to see if a frame skip is needed.
3. Have some flexibility in your skiping code. So in case your frame is slow by like 1 ms, you don’t frameskip right away, but if the speed gets delayed by more than that, you skip a frame. You could also use this for frame-limiting as well.
So long as you keep those basic ideas in mind your implementation should work pretty well.

No comments yet.
RSS Feed for comments on this post. TrackBack URI.
You must be logged in to post a comment.