Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6894265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:45:40+00:00 2026-05-27T06:45:40+00:00

A friend just asked me this interesting question and I had no answer to

  • 0

A friend just asked me this interesting question and I had no answer to this.

He’s making a game and sometimes he experiences lags in the frame rate. As if 10 or more frames get dropped.

The run loop function is called by CADisplayLink.

Is there a way to tell programmatically if frame rate was lagging? I’d just measure the time in the run loop function and then check if it’s bigger than supposed to be. And if it is, remember that there was a lag.

Could be useful to test on various devices on the go. How would you go about tracking this without being connected to Xcode?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:45:41+00:00Added an answer on May 27, 2026 at 6:45 am

    The proper way is with a delta (difference between lastTime and now), something like this:

        CFTimeInterval time;
        time = CACurrentMediaTime();
        if (lastTime == 0) {
            delta = 0.0;
        } else {
            delta = time - lastTime;
        }
        lastTime = time;
    

    But he should use this delta for a lot more stuff in the game, framerate is always a fickle thing, so anything time sensitive should be offset by the delta.

    Say you want to update the position of an object which has a speed, it should be something like this:

    objectXPos.pos = delta/targetDelta*objectXSpeed;
    

    Target Delta would be the perfect frame rate, say 60 fps would give you a targetDelta of 1/60=0.0167

    This way game wont be affected by poor of better performance.

    You should also implement a disaster mode, say the bloody thing stopped for a second or more, and you can opt to not update the game logic, in that case it’s better than everything happening magically for the user. This part depends on the type a game, a second might be overkill, maybe 0.033 s is already too much (half the frame rate)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is just a random question my friend asked me which I also do
I think this question is best asked with a small code snippet I just
My friend asked this question to me - You are given a table with
I know this question has been asked a million times in various ways by
A friend of mine asked me the other day if I'm just looking at
I was recently asked by a friend of mine who's just starting to play
This question hasn't been asked yet. Some solutions probably have been proposed though to
A friend asked me to check out Wefeelfine and I was just flabbergasted on
I have been looking all over the Internet for an answer to this question
I friend asked me this today. Picasa Web has a cool (and frightening :-)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.