No FPS limit or separation of Update and Draw?

I wondered if there is an intended way in raylib to disable maximum FPS entirely (e.g. to benchmark something).

A related question is: Is there an intended way to have an Update function that runs faster than the Draw function? E.g. when I have a physics simulation and want to do more updates than 60 times a second but I only want to render with 60 fps.
Obviously I can measure the time myself and skip drawing for certain updates.. but is this the recommended way?

Btw is this the right place to ask these questions or should I instead use Github issues?


  • If not calling SetTargetFPS(60), game should run at the maximum possible FPS. But it could happen that GPU Vsync is activated by default on your GPU options (very common with NVIDIA GPUs), just go to GPU configuration (NVIDIA control panel) and disable Vertical-Sync.

    You can use a second program thread to do the update at a faster rate, but you have to program it yourself and also manage the share of information between threads... there is not an automatic way to do that... For small games (no complex physic calculations), I recommend using just one thread and stay on the 60 FPS for Update and Draw.

    The forum is the best place to ask, GitHub is more oriented to issues found with the library (bugs, specific improvements...).
  • Thanks for being so fast in answering!! :)

    I thought so about Github/forum.

    I know, I have vsync disabled on my system. I never had the idea to just not specify SetTargetFPS.. lol. I also just discovered I can set it to 0 to disable later on. Very good.

    I know I can use another thread for processing simulations but for now I just want to update faster than I draw. I guess I will just skip some draw calls then.

    I will soon show some GIFs from the particle system library.

    BTW: I tried recording with CTRL+F12 and it worked but the background was transparent. Is this intended? Looked kind of funny when watching the GIF :)
  • Hey! That's great! Waiting to see your particle system! :)

    About GIF transparent background... it was not intended... actually I already had this issue with PNG generation (F12 to capture screen). I'll take a look...
  • I just made a 60fps GIF with another tool.
    First test of a fountain. 3 Emitters, about 2200 active particles.

  • Wow! It looks amazing! :smiley:

    By the way, did you know you can generate particle texture if required with the new raylib 1.8 function:
    Image GenImageGradientRadial(int width, int height, float density, Color inner, Color outer);
    Check usage here:
  • Thanks! As soon as the library is in a more solid state I will of course add some more examples.

    And no, I didn't know about that function! That's really cool. Usually I would leave the sprite choice to the user of the library but with this I can easily set a default. Very nice!
Sign In or Register to comment.