1. Hey! Guest! The 34th GMC Jam will take place between August 22nd, 12:00 UTC (Thursday noon) and August 26th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

GM:S 1.4 Debug FPS vs. fps_real

Discussion in 'Programming' started by Vikom, Mar 17, 2019.

  1. Vikom

    Vikom Member

    Joined:
    Jun 21, 2016
    Posts:
    109
    Hi!
    I'm trying to optimalize the performance from the very begining of the project.
    I got surprised that the debug overlay's FPS was lower than the fps_real which was currently higher than the room_speed. (I believe that the "debug fps" == "fps")
    Does it mean something bad? The fps_real itself has no really bad values at all.

    If it's bad, is there something that can be done about it?
     

    Attached Files:

    • FPS.png
      FPS.png
      File size:
      230.3 KB
      Views:
      19
  2. Mert

    Mert Member

    Joined:
    Jul 20, 2016
    Posts:
    360
    The easiest explanation is;

    You computer can actually run the game at <fps_real> FPS, but you choose to make it run <60> fps (for example). What you see in the debug is the second value.
     
  3. Vikom

    Vikom Member

    Joined:
    Jun 21, 2016
    Posts:
    109
    Thank you.
    I actually understand this. I don't get why FPS is 42, while room_speed is 60 and fps_real is 982.

    I thought that...
    if fps_real > room_speed
    {
    fps = room_speed;
    } else {
    fps = floor(fps_real);
    }
     
  4. Taddio

    Taddio Member

    Joined:
    Nov 16, 2018
    Posts:
    463
    Straight from the manual:

    Syntax:
    fps_real

    Returns: Real

    Description
    In GameMaker: Studio there are two main ways that can be used to tell the speed at which your game runs. The room_speed (as specified in the room editor) and the fps (frames per second). These values are often confused, but basically one is the number of game steps that GameMaker: Studio is supposed to be completing in a second (room speed), while the other is the number of CPU steps that GameMaker: Studio is actually completing in a second (the real fps), and this value is generally much higher than the room speed, but will drop as your game gets more complex and uses more processing power to maintain the set room speed.
     
  5. RangerX

    RangerX Member

    Joined:
    Jun 20, 2016
    Posts:
    2,587
    This sounds like a cycle problem or maybe v-sync. What if you run your game with v-sync off? Is it full 60?
    Another test you can have is to change your step margin to 15. Thats the minimum time GameMaker will wait before having another cycle. It should fall in line with your computer more easily (maybe)
     
  6. Vikom

    Vikom Member

    Joined:
    Jun 21, 2016
    Posts:
    109
    Thank you, sounds like a clue.
    Sorry for a silly question, I've never been working with v-sync.
    display_set_windows_alternate_sync(0);?

    Ok, I've tried the sleep margin 15... Debug FPS: 42, FPS 41, fps_real 1316.

    Just about circumstances. In the room there's a 3D terrain object with 100x100 3d terrain + a model of "baked together" 500 semi-transparent trees made from 4 walls (you know, a both-sided 'X' model) My GPU gets frying because of the semi-transparency.
    Probably nothing important but still wanted to mention it.
     
  7. Smiechu

    Smiechu Member

    Joined:
    Jul 14, 2017
    Posts:
    626
    Yeah... nothing important, who would have care about such nuances.
    So the main thing is, fps real is only relevant for cpu load... if gpu is overloaded, fps real will not tell you that.
     
  8. dannyjenn

    dannyjenn Member

    Joined:
    Jul 29, 2017
    Posts:
    568
    I had this same problem... the fps was lower than the game speed even though the fps_real was in the 900s. I never did figure it out. (I was using a shader, so maybe the GPU was slowing it down...) But I noticed that when I export the game using the VM, it's kind of laggy... but when I export it using the YYC, it runs smooth.
     
    Last edited: Mar 17, 2019
  9. RangerX

    RangerX Member

    Joined:
    Jun 20, 2016
    Posts:
    2,587
    There you go. You found your problem. Your CPU can run the game easily but your GPU is rushing, hence the bad framerate. Find another way than transparency galore maybe? I am not knowledgeable much in 3D but there are solutions that's for sure.
    As for v-sync, that's the function you want to use:
    https://docs.yoyogames.com/source/dadiospice/002_reference/windows and views/display_reset.html
     
    Vikom likes this.
  10. Vikom

    Vikom Member

    Joined:
    Jun 21, 2016
    Posts:
    109
    Thank you!
    For some reason I believed that the GPU's load is not that important.

    I've lowered the view_porth/w from 1366x768 to 600x400 (this project is just a map editor, so it doesn't matter) and now it can handle even 5000 trees (500 before) with GPU use at only 80%, according to task manager.
    I have an average 450$ laptop from spring 2016, so I think the result is not bad at all and it will be better at more competent machines when the resolution is high again.
     

    Attached Files:

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice