Author Topic: FPS Monitor  (Read 381 times)

rand0m

  • Sr. Member
  • ****
  • Posts: 328
    • View Profile
FPS Monitor
« on: February 09, 2020, 11:31:46 PM »
Latest versions of Attract-Mode include a handy plug-in by Oomek called FPS Monitor. This monitor can be turned on through Configure > Plugin > FPS Monitor> Enabled yes. In the same page add a key for turning FPS Monitor on and off, if you have not mapped "reload" to any key then you can add a key for reload here too. I found Graph size "Large" to be best.

Usage:
When FPS Monitor is turned on in settings, it will auto-run on start (I wish default was off) go through your layout and keep an eye on the FPS Monitor, at any place where you see FPS drops (Usually between 50-59) check the layout code and see whats causing the drops. You can also narrow it down by turning off artwork one by one. Thats where reload key comes handy, after any changes in layout you can press the reload key and layout will reload with new changes.

Depending on the reason you might need to convert png to jpg or 8bit png or re-compress through website like tinyPNG (thanks Enkak!). Or you might want to resize if the image res is huge, specially when you are using reduced res output of said image in layout. You might also want to use something like Transition.EndNavigation.

BTW Videos WILL cause FPS drops, best to do this with videos disabled. I don't know of anyway to minimize drops on videos right now, though in some tests I did wmv caused minimal drops then avi them mp4. But this is on Win* system might be different on *nix. 

As Keil and Zpaolo mentioned in comments further down, multiple surfaces (specially nested) and heavy shaders can also cause slowdowns/ FPS drops, you can comment out one item at a time and reload/ check.

« Last Edit: February 10, 2020, 08:10:29 AM by rand0m »

rand0m

  • Sr. Member
  • ****
  • Posts: 328
    • View Profile
Re: FPS Monitor
« Reply #1 on: February 09, 2020, 11:32:59 PM »
Note: AM shows some drops when it first starts, in around 5-6 seconds FPS will stabilize.

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1160
    • View Profile
Re: FPS Monitor
« Reply #2 on: February 10, 2020, 05:38:31 AM »
Artwork was not a factor in the design of PICKnMIX. It was surfaces that made a difference with fps.

zpaolo11x

  • Hero Member
  • *****
  • Posts: 915
    • View Profile
    • My deviantart page
Re: FPS Monitor
« Reply #3 on: February 10, 2020, 06:17:05 AM »
Surfaces, especially nested surfaces, are the main cause of slowdowns, together with heavy glsl shaders that have an impact on low spec machines with poor GPU. But for "flowing" themes that load a lot of artwork in advance to maintain smooth scrolling, loading a 348x244 native resolution screenshot feels very different than loading high resolution box art or arcade flyers.

Avi and mpg loading causes stuttering in the same scenario (so better delay loading) and when a video is running the layout usually caps at the video framerate

rand0m

  • Sr. Member
  • ****
  • Posts: 328
    • View Profile
Re: FPS Monitor
« Reply #4 on: February 10, 2020, 08:17:51 AM »
@keilmillerjr @zpaolo11x Thanks guys, added surfaces and shaders to the list of common culprits causing slowdowns.

Surfaces, especially nested surfaces, are the main cause of slowdowns, together with heavy glsl shaders that have an impact on low spec machines with poor GPU. But for "flowing" themes that load a lot of artwork in advance to maintain smooth scrolling, loading a 348x244 native resolution screenshot feels very different than loading high resolution box art or arcade flyers.

Avi and mpg loading causes stuttering in the same scenario (so better delay loading) and when a video is running the layout usually caps at the video framerate

Thanks, about the highlighted part, I have tried some dozen ways to reduce impact of videos. i was aiming for the same thing (video delay) but no matter what I do if there are videos (playing) in a layout there are FPS drops. Most of the examples I have seen are where after x ms video becomes visible (but its playing in hidden as soon as one goes to next/ previous game, it only becomes visible after x ms).

is it possible to actually run the video after x ms (not visibility but playing)?

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1160
    • View Profile
Re: FPS Monitor
« Reply #5 on: February 10, 2020, 02:29:09 PM »
@keilmillerjr @zpaolo11x Thanks guys, added surfaces and shaders to the list of common culprits causing slowdowns.

Surfaces, especially nested surfaces, are the main cause of slowdowns, together with heavy glsl shaders that have an impact on low spec machines with poor GPU. But for "flowing" themes that load a lot of artwork in advance to maintain smooth scrolling, loading a 348x244 native resolution screenshot feels very different than loading high resolution box art or arcade flyers.

Avi and mpg loading causes stuttering in the same scenario (so better delay loading) and when a video is running the layout usually caps at the video framerate

Thanks, about the highlighted part, I have tried some dozen ways to reduce impact of videos. i was aiming for the same thing (video delay) but no matter what I do if there are videos (playing) in a layout there are FPS drops. Most of the examples I have seen are where after x ms video becomes visible (but its playing in hidden as soon as one goes to next/ previous game, it only becomes visible after x ms).

is it possible to actually run the video after x ms (not visibility but playing)?

Use tick callback to update fe.image.

rand0m

  • Sr. Member
  • ****
  • Posts: 328
    • View Profile
Re: FPS Monitor
« Reply #6 on: February 11, 2020, 01:11:55 PM »
@keilmillerjr @zpaolo11x Thanks guys, added surfaces and shaders to the list of common culprits causing slowdowns.

Surfaces, especially nested surfaces, are the main cause of slowdowns, together with heavy glsl shaders that have an impact on low spec machines with poor GPU. But for "flowing" themes that load a lot of artwork in advance to maintain smooth scrolling, loading a 348x244 native resolution screenshot feels very different than loading high resolution box art or arcade flyers.

Avi and mpg loading causes stuttering in the same scenario (so better delay loading) and when a video is running the layout usually caps at the video framerate

Thanks, about the highlighted part, I have tried some dozen ways to reduce impact of videos. i was aiming for the same thing (video delay) but no matter what I do if there are videos (playing) in a layout there are FPS drops. Most of the examples I have seen are where after x ms video becomes visible (but its playing in hidden as soon as one goes to next/ previous game, it only becomes visible after x ms).

is it possible to actually run the video after x ms (not visibility but playing)?

Use tick callback to update fe.image.

I am currently using following:
Code: [Select]
//Video Starts Playing After 1 Second In Place of Snap
local settings =
    {
        delay_timer = 0,
        play_delay = 1000,
    }

local video = fe.add_artwork("video", 680,705,472,355)
video.preserve_aspect_ratio = true;
video.mipmap = true;
video.trigger = Transition.EndNavigation;

function vid_on_transition(ttype, var, transition_time)
    {
        if (ttype == Transition.StartLayout || ttype == Transition.ToNewList || ttype == Transition.FromOldSelection)
            {
                settings.delay_timer = fe.layout.time
                video.visible = false
            }
        return false
    }

function vid_on_tick(tick_time)
    {
        if (video.video_playing && tick_time - settings.delay_timer >= settings.play_delay) video.visible = true
    }

fe.add_ticks_callback(this, "vid_on_tick")
fe.add_transition_callback(this, "vid_on_transition")

This runs the video hidden and makes it visible after a few ms. How do I adjust it so video doesn't run at previous/ next game but runs after a few ms (chnage visibility to video_playing)? Kind of stuck because I have no idea what to replace this line (  if (video.video_playing && tick_time - settings.delay_timer >= settings.play_delay) video.visible = true) with.