Page 1 of 1

[0.10.9] Low FPS due to slow flip

Posted: Thu Sep 04, 2014 12:21 pm
by cube

Re: [0.10.9] Low FPS due to slow flip

Posted: Thu Sep 04, 2014 4:51 pm
by Rseding91
This one also ties into that issue: https://forums.factorio.com/forum/vie ... =48&t=4883

There (may or may not) be helpful information on the last post I made on that.

Re: [0.10.9] Low FPS due to slow flip

Posted: Fri Sep 05, 2014 12:04 pm
by cube

Re: [0.10.9] Low FPS due to slow flip

Posted: Fri Sep 05, 2014 12:34 pm
by Rseding91
I'm re-posting this here for visibility:
I did some more research into this issue and I don't believe it's related to the Factorio graphics library: Allegro.

I believe it's simply a fault of VSYNC and the mechanic behind it. VSYNC limits the refresh rate of the game to that of the monitor. If for any reason it can't keep it at a steady 60 FPS it will half it and try to keep it at 30. If it can't do 30 it goes half that and repeats. That's why different reports from people have shown up where the "Flip" timer is taking 30~ MS instead of the normal 15~ MS.

In order to fix that, the refresh rate would need to be controlled manually: timing how long since the last refresh and sleeping 15MS - time since last each frame (or something close to this effect).


Now, this is all speculation up to this point. I haven't done any actual tests (yet). If I find out anything else that might be useful i'll post it here.

Re: [0.10.9] Low FPS due to slow flip

Posted: Fri Sep 05, 2014 12:53 pm
by kovarex
I need to know if the problem appeared exactly during the transition 0.10.9 -> 0.10.10.

Who could prove/disprove that?

Re: [0.10.9] Low FPS due to slow flip

Posted: Fri Sep 05, 2014 1:00 pm
by Rseding91
kovarex wrote:I need to know if the problem appeared exactly during the transition 0.10.9 -> 0.10.10.

Who could prove/disprove that?
I've had the issue since 0.9 - it's not specific to any version. Also, did you mean 0.10.8 -> 0.10.9? 0.10.10 isn't out for public use yet.


My current VSYNC theory does make sense though: Flip() waits for the next monitor refresh. If the total time since the last Flip() is greater than 15 MS it would have missed the refresh and it's going to wait for the next Flip() which would put the total time between frames at 30 MS for a total of 30 FPS.

Re: [0.10.9] Low FPS due to slow flip

Posted: Sat Sep 06, 2014 1:15 am
by micomico
Low FPS due to high flip happens to me every time there are a lot of trees in the screen, like when walking through a forest while zoomed out. Zooming in or walking away from the forest lowers the flip value again.

This happens since 0.10.3, which was the first version I played.

Re: [0.10.9] Low FPS due to slow flip

Posted: Sat Sep 06, 2014 8:52 am
by jazha
kovarex wrote:I need to know if the problem appeared exactly during the transition 0.10.9 -> 0.10.10.

Who could prove/disprove that?
I've had this problem since the first version I played namely 0.9.8. I have no data from before this version as I did not play them. Thanks for looking into it =)

Re: [0.10.9] Low FPS due to slow flip

Posted: Tue Sep 09, 2014 1:32 pm
by kovarex
I added experimental option to disable v sync (for 0.10.10), it is not good to play with that (v sync has its reason), but it could help to find out, if the time spent on the flip is caused by vsync or something other.

Re: [0.10.9] Low FPS due to slow flip

Posted: Thu Sep 11, 2014 6:18 pm
by jazha
kovarex wrote:I added experimental option to disable v sync (for 0.10.10), it is not good to play with that (v sync has its reason), but it could help to find out, if the time spent on the flip is caused by vsync or something other.

If released by the time I leave for work then I will help test this. (I am virtually without download possibilites due to internet situation onboard the ship I work on, and I am away for 4 weeks)

Re: [0.10.9] Low FPS due to slow flip

Posted: Fri Sep 12, 2014 3:06 pm
by pyrolytic_tungsten
I played a little with 0.10.10. In previous versions I sometimes had reduced framerate when fully zoomed out in forests with increased flip time. Now flip always stays low and the framerate is good in forests regardless of vsync setting (with game restarts when the setting is changed). I can't notice any difference with either vsync setting but I am using a CRT monitor with 75 Hz refresh so tearing may be more noticeable to those with LCD displays and the like. This issue is fixed for me.

Re: [0.10.9] Low FPS due to slow flip

Posted: Sun Sep 14, 2014 11:50 am
by jazha
It seems much better on my end aswell, I don't have the time to test properly, but I haven't had any really noticeable slowdowns with the latest version. Will play more with it when I get the spare time to do so :)

Re: [0.10.9] Low FPS due to slow flip

Posted: Sun Sep 14, 2014 12:03 pm
by kovarex
Well, this seems like magic, but ok.
By the way, this "might" be affected by the selection of default video adapter, anyway I'm moving this to resolved then.

Re: [0.10.9] Low FPS due to slow flip

Posted: Mon Sep 15, 2014 10:41 am
by Okami
Work better on my End aswell.

Now the Game runs faster, but with tearing of course without VSync.

Re: [0.10.9] Low FPS due to slow flip

Posted: Mon Sep 15, 2014 11:03 am
by kovarex
Well, this means it still isn't solved, could you post screenshots of the time spent in flip when the option is on and off?

Re: [0.10.9] Low FPS due to slow flip

Posted: Tue Sep 16, 2014 10:25 pm
by pyrolytic_tungsten
It turns out that during my previous tests the forest didn't want to give me low fps with vsync enabled. I had been mostly running with vsync off since my initial tests so I didn't see it. I saw that happen today. Disabling vsync causes the low fps to go away. I don't know why it didn't give me low fps in my earlier testing. It is erratic since I can find an area that gives low fps, save, disable vsync, restart Factorio, see it works fine, enable vsync, close Factorio, see the config has "v-sync=true", start Factorio, and it still works fine. I haven't seen any tearing with vsync disabled. Perhaps it's something weird about my linux/Xorg/proprietary Nvidia drivers/geforce 240/configurations/CRT monitor. I'll try and grab some screenshots next time.