How to fix performance issues?

  • 34 Replies
  • 4133 Views
*

Offline Purple Ink

  • 414
  • 41
    • View Profile
Re: How to fix performance issues?
« Reply #15 on: October 12, 2021, 04:32:28 »
I had a thought: could it be because Ks isn't installed on the same drive as windows?

*

Offline Lit Knob

  • 184
  • 34
  • Spoiler: (click to show/hide)
    • View Profile
Re: How to fix performance issues?
« Reply #16 on: October 12, 2021, 06:41:43 »
My other 2 computers both have a single drive, so I guess that's not the case, sadly. I will try and copy-paste KS+ in the C drive in my main pc just cause, but as I just said, it shouldn't change anything.
"The flaw expert" -egomassive

*

Offline egomassive

  • 1852
  • 250
    • View Profile
    • egomassive games
Re: How to fix performance issues?
« Reply #17 on: October 12, 2021, 10:16:58 »
KS+ 1.3.7 is out with a v-sync switch and a native 1080 version.
https://nifflas.lp1.nl/index.php?topic=4175.msg75639#msg75639

*

Offline Lit Knob

  • 184
  • 34
  • Spoiler: (click to show/hide)
    • View Profile
Re: How to fix performance issues?
« Reply #18 on: October 13, 2021, 03:53:40 »
Bad (also weird) news: I tested the new version and noticed 2 things:

It seems just setting refresh rate to 50hz is enough to stop the lag, because both 1080 version and ctrl X run smooth with it (they both lag as usual on 60hz) so I guess the update just got better performance in general when set to 50hz in comparison to previous ones? The thing is, there is random occasional lag now. Sometimes it's just smooth for several minutes (up to 12 in current tests) then it suddenly starts lagging, then goes back to smooth after another couple minutes. I don't know what's causing this really inconsistent lag when set to 50hz.

The second thing, that really doesn't make sense to me is the fact that when I test the old stretched fullscreen it has this same behavior even with refresh rate set to 60hz. So I guess there shouldn't even be the need to switch to 50hz to make it work in the 1080 version. I don't really know, just an observation. No idea how to get rid of the random lag though.

A third thing I noticed: I used DWM killer to see if it fixed the random 50hz lag, and while it seems to fix it, the new V-Sync either gets disabled too by DWM killer, or I just don't know what actually happens, because I get tearing (but just with DWM killer. There's no tearing when playing the usual way). I’m not sure what's the case here but I don't like DWM killer as a solution anyway, so just another observation.

I tried DWM killer again while also forcing Nvidia’s pretty good V-Sync. I’m not entirely sure it worked, but I didn't notice any tearing. The idea of disabling like half of the OS just to avoid some random lag still bothers me though.

Any idea what the problem might be?

What about unaffected users like Purple Ink and IxMarcel? Does the game just run the same as before?

Another thing I noticed: in my second computer the game constantly lags even with 50hz, so I'm starting to believe this game needs a "beefy" computer, for some reason (but 2 percent CPU and 15 percent GPU usage shown in Task Manager in my main pc suggests the opposite). Maybe my second computer is just really messed up software-wise. I'll try the game on my third one for comparison.
« Last Edit: October 13, 2021, 18:23:45 by Lit Knob »
"The flaw expert" -egomassive

*

Offline egomassive

  • 1852
  • 250
    • View Profile
    • egomassive games
Re: How to fix performance issues?
« Reply #19 on: October 13, 2021, 07:39:25 »
My first thought is the periodic lag may be due to another windows process, one that runs periodically in the background. You could try increasing the priority of KS if that's still possible in Win10. Also, check your power settings. Something could be dropping into a power conservation mode.

*

Offline Lit Knob

  • 184
  • 34
  • Spoiler: (click to show/hide)
    • View Profile
Re: How to fix performance issues?
« Reply #20 on: October 13, 2021, 18:22:48 »
I set priority to high, nothing changed. My current power plan is High performance and things like screensaver/sleep/suspend are set to never, I don't know if that's what you meant by power settings.

I checked task manager but I didn't see any "suspicious" processes. When the game is running, CPU usage is 2 percent, and GPU usage is 15, and they stay like that even when it's lagging.

Is it possible the 1080 fullscreen is actually still borderless like ctrl X, therefore affected by DWM's V-Sync? That would explain why they have the exact same performance, while also rendering the new KS+ V-Sync useless. But if that's the case, why would DWM periodically hurt performance instead of constantly doing it, when set to 50hz?

This whole DWM issue raises this question: what is causing DWM's poor V-Sync to "work properly" in unaffected users' systems? Is that even what's actually happening to them? What gives them the "privilege"?

Oh, I couldn't try the new version in the third pc. Turns out its monitor can't be set to 50hz, just 60 or 75. When set to those two values, it lags as usual.
« Last Edit: October 13, 2021, 20:16:57 by Lit Knob »
"The flaw expert" -egomassive

*

Offline Lit Knob

  • 184
  • 34
  • Spoiler: (click to show/hide)
    • View Profile
Re: How to fix performance issues?
« Reply #21 on: October 14, 2021, 17:12:56 »
Ok, I think I know what's going on:

When I started this thread, the original problem was constant lag caused by DWM's V-Sync. The fact the 1080 fullscreen still exhibits this behavior lead me to think it's affected by DWM. So I tried it with V-Sync disabled and as I expected, there wasn't any tearing at all. That means some other V-Sync is taking care of it and overriding yours (an even weirder thing is the fact when I disable DWM's V-Sync with DWM killer, it still doesn't let yours to work). Then I tried the start and task manager trick, that always minimizes games with exclusive fullscreen. As I expected, when pressing win key and opening task manager, KS+ doesn't hide in the taskbar. Even more obvious: when I disable DWM with DWM killer, the game runs smooth on 60hz.

All these things together seem to suggest the 1080 fullscreen is still a borderless window like ctrl X, for some reason.

Can you confirm this or disprove it?
Please let me know.
« Last Edit: October 15, 2021, 00:00:53 by Lit Knob »
"The flaw expert" -egomassive

*

Offline Lit Knob

  • 184
  • 34
  • Spoiler: (click to show/hide)
    • View Profile
Re: How to fix performance issues?
« Reply #22 on: October 16, 2021, 07:54:39 »
Other things I found (and Fusion games I tested for comparison): I tried the game "I wanna be the guy" (made in Fusion 2 and capped at 50 fps like KS. Also is windowed-only) and DWM doesn't hurt its performance. It perfectly runs at 50 fps with system refresh rate set to 60hz.

I recently played and finished Knytt Underground and it ran at constant 56 fps (and it's correct exclusive fullscreen. Is the weird frame rate number intentional though? I thought that game was capped at 60). I think that's thanks to Mathias' Chowdren though, so I guess it doesn't count as a proper comparison.

Also I probably should have mentioned this earlier but: I have really huge games like Forza and Ace Combat among other things, and Knytt Stories is literally the only thing that lags, in my whole computer...
Yeah, that's unfortunate.

So I guess it's safe to say at this point, whatever the difference between my computer and unaffected users' is, it only affects this game, for some obscure reason.
"The flaw expert" -egomassive

*

Offline egomassive

  • 1852
  • 250
    • View Profile
    • egomassive games
Re: How to fix performance issues?
« Reply #23 on: October 16, 2021, 10:16:09 »
Is it all KS versions or just KS+ at this point? KS+ does something weird to get the integer scaling and the fullscreen mode in the same package. The game window is actually a sub-application launched from the main window which presents itself as the black border seen in cinema mode. I don't know how this could affect refresh rates, but it does set it apart from most other games.

Here's another facet. The v-sync option added to version 1.3.7 is applied to the program by the main window. I've no idea if this affects the child window. Although, I have received a positive report from another user on the v-sync option's effectiveness.

*

Offline Lit Knob

  • 184
  • 34
  • Spoiler: (click to show/hide)
    • View Profile
Re: How to fix performance issues?
« Reply #24 on: October 16, 2021, 22:21:30 »
There you go. A benchmark of the Tutorial's first 10 seconds with refresh rate set to 60hz (I didn't test 50hz but I will if you are interested):

KS 1.2.1:

Windowed – 48/50, at least 8 frames get “corrupted” (there are very minor differences or none at all, for example a single raindrop appears/moves down while everything else is frozen, or the whole frame just gets repeated. The corrupted frames clearly take the place of the proper missing ones, because raindrops are way more distant between the corrupted frame and the next one). This corruption gives the “illusion” it's running at 37/40. Also I didn't notice before but “I wanna be the guy” has this exact same issue… my bad.

Fullscreen – 47/49, same corruption but way worse (several raindrops, sometimes even Juni only move in a frame). The repeating pattern is very inconsistent. Illusion: random 37/39

KS Ex:

Cinema mode – 50, the corruption is only comprised of perfectly repeated frames, no small differences. Illusion: stuttery 40. Repeating pattern: 4+1 (4 different frames + a copy of the fourth).

Fullscreen – 50, same heavy corruption and inconsistent pattern of the base game's fullscreen. Illusion: random 37/43

KS+ 1.3.6:

Cinema mode – 50, sometimes with an inconsistent pattern. Frames just get repeated like the Ex mod, no differences. Illusion: stuttery 40. Repeating pattern (not counting occasional inconsistencies): 4+1

Fullscreen – 50, no corruption (weird, huh?). Repeating pattern: none, every frame is different (well, finally…). The thing is, if we count the 60hz refresh rate as 10 extra frames, the resulting “repeating pattern” is not that consistent unfortunately, it's not 5+1. It's a random sequence of 5+1, 4+1 and 6+1, so even though every frame can be seen for once, it still doesn't look “exactly smooth” with this fullscreen mode (But maybe the issue is fixed on 50hz).

KS+ 1.3.7 1080:

Cinema mode – 36/47… What? I don't really know what happened but it was lagging. Corruption was only repeating, but I guess if it wasn't lagging, it's safe to say it would have had the behavior of the previous version.

Fullscreen (the 1080 one) – 41/50, almost the same as above (it was still lagging). No idea why. I don't know if this new version always lags like that at 60hz. Kinda ironic.

I also tried the original Knytt (the tail one) and results were: fullscreen – 47/48, windowed – 47/49, with the same corruption behavior as KS 1.2.1.

I don't know if it really changed anything, but I updated the Nvidia driver to latest, 3 days ago.

Regarding V-Sync, maybe Pfrangip didn't check for tearing before enabling it and assumed it worked, I don't know. If he gets the game to run smooth on 60hz, maybe he could help us find out what's wrong with all my 3 computers and this game. In the other hand, if he doesn't get periodic lag on 50hz he could still help us.
« Last Edit: October 17, 2021, 04:53:20 by Lit Knob »
"The flaw expert" -egomassive

*

Offline Lit Knob

  • 184
  • 34
  • Spoiler: (click to show/hide)
    • View Profile
Re: How to fix performance issues?
« Reply #25 on: October 20, 2021, 16:04:26 »
Any news? If you want me to also test 50hz let me know
"The flaw expert" -egomassive

*

Offline egomassive

  • 1852
  • 250
    • View Profile
    • egomassive games
Re: How to fix performance issues?
« Reply #26 on: October 22, 2021, 15:09:21 »
Sorry, thanks for all the info. It's interesting, but it doesn't bring me any closer to understanding why one game runs well and another doesn't. It is disappointing that the 1080 version didn't break out of window's frame-rate jail for you. I've done everything I can think of to give users a better chance at a good frame-rate. I don't know what further tests could reveal, but I doubt they'll reveal anything that points us to a solution.
« Last Edit: October 22, 2021, 15:12:35 by egomassive »

*

Offline Lit Knob

  • 184
  • 34
  • Spoiler: (click to show/hide)
    • View Profile
Re: How to fix performance issues?
« Reply #27 on: October 22, 2021, 17:20:18 »
Ok. The most interesting things to me are the fact all my computers are affected, hardware seems not to be involved and the previous KS+ fullscreen is the only one that runs almost perfect for some reason. Maybe there's something different in the source code? If that one fullscreen can be made integer-scaled, I think that would bring us closer.

I'd really like answers to the following:
Is it possible to just raise the frame rate cap to 60?
Can the Ultimate Fullscreen extension by Ultimatewalrus be implemented and would it fix the issue in the first place?
Can the game just be recompiled to C++ with Mathias' Chowdren?
"The flaw expert" -egomassive

*

Offline kilicool64

  • 225
  • 14
    • View Profile
Re: How to fix performance issues?
« Reply #28 on: October 24, 2021, 14:49:55 »
To my understanding, porting games to Chowdren is very difficult. It may also not support all of Knytt Stories' plugins.

*

Offline egomassive

  • 1852
  • 250
    • View Profile
    • egomassive games
Re: How to fix performance issues?
« Reply #29 on: October 24, 2021, 17:46:56 »
Does then normal 1.3.7 not run as well as 1.3.6? You only listed 1.3.7-1080 in your bench tests. I was under the impression it was the very fact that I changed the native resolution of the game to match your monitor that trapped you into the bad frame rate.

You can't raise the frame rate of the game without reprogramming everything. The frame rate is used for timing on most aspects of the game. I don't know anything about Ultimate Fullscreen or Chowdren, and I'd rather keep it that way. I'm not actively developing KS+ anymore, and I can't stand working with MMF2. I'm mainly just doing maintenance. Major overhauls aren't going to come from me. The KS+ source is available up to 1.3.6, and there are several remakes in the works. Also Win11 is on its way, there's no telling what surprises it will hold for old programs.