Results 1 to 10 of 53

Thread: Luna Game Library - Simple & Elegant Game Programming

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    I'm using frame-based timing in the library. I wanted to have an efficient way to do timing where rendering and updating where decoupled and your simulation is controlled as much as possible. Ideally if your game loop can run as fast as possible while your simulation ran at a known and predictable would give your the overall best visual experience.

    I expose two main routines for this: SetTargetFrameRate and GetDeltaTime. Call SetTargetFrameRate to 30, 60 fps for example and then when you call GetDeltaTime it will return a value that when you multiply by your object's speed, will try and keep them moving at the target frame rate. For example, if your game loop speed was 60 fps, GetDeltaTime would return 0.5. The timing code automatically handles and smooths out large delta time values and prevents large spikes. The end result is silky smooth motion where updating and rendering are decoupled. You get the best possible over visuals while keeping your simulation running at a known and predictable rate.

    Physics, on the other hand needs to run at fixed rates. When I eventually get around to adding physics support I will then also add support for this also.
    Last edited by drezgames; 23-04-2017 at 03:34 PM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •