linuxgurugamer

[1.8.x] Click Through Blocker

Recommended Posts

@linuxgurugamer perhaps I should mention that in the last occurance of the log spamming I was editing RealChutes via the AG menu's UI and going back to build mode.

Share this post


Link to post
Share on other sites
On 5/25/2018 at 7:22 PM, Gordon Dry said:

@linuxgurugamer perhaps I should mention that in the last occurance of the log spamming I was editing RealChutes via the AG menu's UI and going back to build mode.

Can you provide me with a specific set of steps which produces these errors?

Edit: I've been looking at this, the nullref is happening inside KSP, not this mod.  Has this happened with anything other than Realchutes?

Edited by linuxgurugamer

Share this post


Link to post
Share on other sites

Edited: Posted on the correct thread.

Edited by Ericwi

Share this post


Link to post
Share on other sites
12 minutes ago, Ericwi said:

Thanks for adopting this and all you do for the KSP community. I have seen new members searching and finding this mod but ending up frustrated that it's been orphaned.

I test the buttons and axis and had this input.  I hope it helps.

Win10 64-bt
KSP Version 1.4.3.2152  64-bit  (Steam)
note AGExt is installed too
afbw 1.8.0.1 5/27/18 AM

CTB 0.1.6.5
TbC 0.1.6.7

Buttons with issues:

Pitch Trim+  : Pegs the input to the top right away

Pitch Trim-  : Pegs the input to the bottom right away

SAS (Radial in): Triggers Radial out

SAS (Radial out): Triggers Radial in 

EVA Jetpack: does nothing

EVA interact: not sure what this does

EVA Jump: Does nothing

EVA AutoRun [Toggle]: displays "AutoRun: On/Off" but does not run. 

Physics TimeWarp+ = only works if physics time warp is already started

Navball [Toggle]: Does nothing

IVA Focus Window: Far as I can tell does nothing, but IDK what it should do ( recenter would be a good idea to have as VR roles out)

Axis:

All work but the Wheel Trim(s) are hard to use. Mainly because of there is no way of seeing the input like on attitude. 

 

LOG:

https://drive.google.com/file/d/1Qt-NR-AtBdj6oWtQx7igpPWnnsUPwafq/view?usp=sharing

 

Suggestions:

Add Camera Reset to buttons

Add Steer Left\Right into buttons

Add Drive Forward\Back into buttons

Have options for the action groups to be toggle-able.

Hud mode:  target\surface\orbit 

 

 

Thank you,

 

What mod are you talking about?

Share this post


Link to post
Share on other sites

@linuxgurugamer I could be that this issue is already solved - I also had other issues during the short test with the semi-updated Landertron mod (it had newer configs from end of March, but the DLL still was old).
I already removed Landertron and other issues have gone, so I guess this also is gone now - I didn't see any occurance of it since then.

Share this post


Link to post
Share on other sites

The files need to go into Gamedata, right? Because I've tried putting them in almost every folder in my KSP data, and I can't get it to work.

Share this post


Link to post
Share on other sites
18 minutes ago, MjrLeeObvious said:

The files need to go into Gamedata, right? Because I've tried putting them in almost every folder in my KSP data, and I can't get it to work.

Correct, the '000_ClickThroughBlocker' folder must be in your 'GameData' folder, but what do you mean with 'you can't get it to work'? This mod will not do anything by itself but there are several other mods which requires ClickThroughBlocker to work properly.

Share this post


Link to post
Share on other sites

Hey @linuxgurugamer :)

I stumbled upon some strange FPS drops, possibly be related to ClickThroughBlocker:

While in the editor, everytime the cursor hovers over a window of a mod which uses ClickThroughBlocker, the framerate drops to ~100 (obviously, this requires a higher framerate before). I did some tests with different settings for the FPS limit and this FPS drop just happens if the game runs with more then 100 FPS. There are some minor FPS drops if the game runs with an FPS limit <= 100 but it's just about 1 or 2 frames.

I tested this behaviour on a fresh install of KSP 1.4.3 and with different mods, always using just a single mod + dependencies: EEX, AGExT, RCS Build Aid, Science Alert and KER as reference since it does not use ClickThroughBlocker (always the latest release, fresh downloaded from github).

The result: This happens with every mod but KER,  just in the editor (VAB and SPH) and the framerate always drops to ~100.
While in a flight scene, the cursor can hover above the windows of AGExT, Science Alert and KER without any mentionable FPS drop.

There is nothing in the logs, no exceptions, errors, warnings...anyway, here are some links to logs from a test with AGExT while in the editor and a flight scene, FPS limit set to 180.

output_log:
https://www.dropbox.com/s/xrfrh4rgez534yy/output_log(fps_drop).txt?dl=0

KSP.log:
https://www.dropbox.com/s/yb5at7kvrdiefzd/KSP(fps_drop).log?dl=0

Please let me know if you need any further informations.

Share this post


Link to post
Share on other sites
24 minutes ago, 4x4cheesecake said:

While in the editor, everytime the cursor hovers over a window of a mod which uses ClickThroughBlocker, the framerate drops to ~100 (obviously, this requires a higher framerate before). I did some tests with different settings for the FPS limit and this FPS drop just happens if the game runs with more then 100 FPS. There are some minor FPS drops if the game runs with an FPS limit <= 100 but it's just about 1 or 2 frames.

I bet on the GC. :-)

A screenshot front GCMonitor, or better yet, MemGraph (logging into a file) would help to confirm (or not) the thesys.

Share this post


Link to post
Share on other sites
45 minutes ago, Lisias said:

I bet on the GC. :-)

A screenshot front GCMonitor, or better yet, MemGraph (logging into a file) would help to confirm (or not) the thesys.

Well, I can do that but I don't think it is the GC.

I should be a bit more precise: The framerate stays at 100 until the cursor leaves the mod window. If it is the GC, the framerate should normalise after some seconds.

I'll take a look at the memgraph output anyway, it's a good idea..

edit:

@Lisias Well, memgraph shows something really interesting:

1) GC goes crazy all the time
2) Everytime the cursor hovers above a mod window, the mono heap usage is ~5 times higher (still just in the editor)

l38zN8r.png

I put all log files from memgraph into a .rar file: https://www.dropbox.com/s/5bgjcmk3fk346sy/memgraph_log_CTB.rar?dl=0

I also set some markers:

Mark 1: before moving the cursor over the mod window (editor, FPS limit 180)
Mark 2: after maving the cursor away again

Mark 3: before moving the cursor over the mod window (flight, FPS limit 180)
Mark 4: after maving the cursor away again

Mark 5: before moving the cursor over the mod window (editor, FPS limit 60)
Mark 6: after maving the cursor away again

Mark 7: before moving the cursor over the mod window (flight, FPS limit 60)
Mark 8: after maving the cursor away again

 

edit 2:

Memgraph on a stock game:

HfRRVEk.png

Edited by 4x4cheesecake

Share this post


Link to post
Share on other sites

An FPS drop is much more noticeable when you have a very fast framerate, simply because anything which takes time is multiplied that many more times.  Interestingly enough, while you said that it dropped TO 100fps, you didn't mention what it was before.  You mentioned the limit was set to 180, but that is meaningless without knowing what it exactly was before.

Let me give you an example:

A framerate of 120 fps means that each frame is 8.3333 milliseconds.  If something were to increase that to 9 milliseconds, the FPS would drop to 111.  If something were to increase it to 10ms, the FPS would drop to 100

Now, the same thing with an FPS of 60, means that each frame is 16.6666 milliseconds.  Increasing it by .66666 to 17.333333   gives an FPS of 57.69.  A drop of only 2.3 fps. Increasing it  by 1.666666 would lead to an fps of 54.54, a drop of 5.46 fps.

As you see, the exact same overhead has different impact depending on the initial FPS.  With an extremely high initial framerate, the drop is (using measurements), much more noticable than with a lower initial framerate.

Frankly, I'm not concerned about anything in the editor with an FPS of 100.  It is more than fast enough, and considering what is being done, the drop you observed is perfectly acceptable, and frankly is expected.

The heap info was interesting, but I'm not sure it's related to this mod directly.  There are some minor optimizations I can to to address this, mainly moving variable allocation out of methods and into the main class.  But it is most likely having to do with the fact that there is an extra layer of calls between mods and Unity, as well as having to check the mouse position constantly.

 

Share this post


Link to post
Share on other sites
8 minutes ago, linuxgurugamer said:

The heap info was interesting, but I'm not sure it's related to this mod directly.  There are some minor optimizations I can to to address this, mainly moving variable allocation out of methods and into the main class.  But it is most likely having to do with the fact that there is an extra layer of calls between mods and Unity, as well as having to check the mouse position constantly.

I don't think it worths. The "issue" only happens when the mouse is over the button. How much time one do that?

And even by every button on the toolbar having this problem, only one has the mouse over it at each time - so stacking performance loss is not a problem neither.

Share this post


Link to post
Share on other sites

Following up, I just did some tests, both with the current version of  CTB and an updated one with optimizations.

I have multiple mods installed, including RCS Build Aid.  I'm using the ShowFPS mod to see the framerate.

With just the RCSBuildAid window open, it hovers around 120 fps.  Moving the mouse over the window has no apparent effect.  And I'm not seeing any any effect in Memgraph either

Using the updated version, essentially the same thing, actually slightly more stable.

So I'm now wondering if something in your system may be influencing it.

Regardless, I'll release the update later today, but I'm not concerned about this at all

11 minutes ago, Lisias said:

I don't think it worths. The "issue" only happens when the mouse is over the button. How much time one do that?

And even by every button on the toolbar having this problem, only one has the mouse over it at each time - so stacking performance loss is not a problem neither.

He said it was while the mouse was over the window, not the button:

Quote

everytime the cursor hovers over a window of a mod which uses ClickThroughBlocker

 

Share this post


Link to post
Share on other sites

Ok, time for clarification:
Whenever I report an issue, I like to isolate and test it before I start to write anything in the mod thread. If I actually can isolate and replicate an issue, I'll start writing and that's what I did here as well.

The first time I've noticed a framedrop was after installing 'Part Angle Display' and used it along with 'Editor Extensions Redux'...and oh boy, my framerate droped to 10 and that's even in the editor way too low.  Well, I have several mods installed and the last one added was 'Part Angle Display', so I removed it and my frames went back to 60. Ofc my first though was that it is an issue with 'Part Angle Display' but running it alone was perfectly fine.
So I added more and more mods, tried different combinations and at some point I realised that the framedrop appears to hit really hard as soon as I do something in the windows of mod which are using 'Click Though Blocker'.
The issue was isolated, so I did some tests and started writing. Since other mods would make test results 'unclean', I used just a single mod every time and that's what you can see in my post above.

I totally agree that a frame drop to 100 is totally fine but this is just the case if a single mod is used. Several additional mods will reduce the framerate below 20 and that's not fine anymore.

As you have mentioned, I forgot to write my down my FPS before I moved he cursor above a mod window, so let me add these informations: Every time, my framerate was at the maximum which was allowed through the limiter, so:

180 droped to 100
140 droped to 100
120 dropped to 100
100 stayed at 100
60 stayed at 60

Even though I see your point in the difference of influences to a high start framerate compared to lower start framerate, I think it is just too convenient that the framerate always drops to 100.

And while I'm writing this, you already answered that you cannot reproduce the issue, so I guess I have to start looking at my own system...

Edited by 4x4cheesecake

Share this post


Link to post
Share on other sites
2 minutes ago, linuxgurugamer said:

He said it was while the mouse was over the window, not the button:

Whoops… I could swear I had read "button". =/

But, I think the same applies. But one thing to be tested if when many windows are stacked to see if the performance penalty piles up.

In time…. ClickThoughBlocker blocks also keystrokes, I'm right?

How hard do you think it would be to add an option to allow the keystrokes to "leak" into the game? If I manage to implement this thing, would you merge the feature?

Share this post


Link to post
Share on other sites
16 minutes ago, Lisias said:

Whoops… I could swear I had read "button". =/

But, I think the same applies. But one thing to be tested if when many windows are stacked to see if the performance penalty piles up.

In time…. ClickThoughBlocker blocks also keystrokes, I'm right?

How hard do you think it would be to add an option to allow the keystrokes to "leak" into the game? If I manage to implement this thing, would you merge the feature?

What do you mean about keystrokes leaking into the game?

ClickThroughBlocker doesn't do anything with keystrokes, only mouse clicks

 

 

Share this post


Link to post
Share on other sites
2 minutes ago, linuxgurugamer said:

What do you mean about keystrokes leaking into the game?

ClickThroughBlocker doesn't do anything with keystrokes, only mouse clicks

Humm… Since I added CTB into a customized plugin, my keystrokes are "eaten" when the plugin window is focused (white border on the window). Perhaps another plugin could be influencing on CTB?

Share this post


Link to post
Share on other sites

Have you ever seen such a beautiful memgraph diagram before? :D

YJJVuW7.png

Well, this happens after using the fine adjust tool of EEX (rotate gizmo, along with part Angle Display) and doing nothing more then, just relaxing in the VAB. FPS drops from 60 to 30 (constant) and even further to 2 - 10 as soon as I hover the curser above a mod window which uses ClickThroughBlocker. I'm inclined to say, that the original issue was caused by EEX and brought me to an different issue with ClickThroughBlocker which at least appears on my system.

I thought it might be a G-Sync / V-Sync issue but different settings and turning everything off does not help...

@linuxgurugamer I'll do some further testing with EEX and raise a github issue so you can keep track of it ;)

Share this post


Link to post
Share on other sites

It seems like you are having some weird memory problems. The GC is constantly running because you have basically no padding for the heap memory, the min amount is 1703 MB and the max is 1706 MB (the garbage allocation from the KER windows alone will be enough to fill this up basically every second). There should be at least several 100 MB between them unless you are running out of RAM.

Do you have some weird settings for MemGraph that is cutting the padding to nearly nothing?

Share this post


Link to post
Share on other sites
58 minutes ago, DMagic said:

Do you have some weird settings for MemGraph that is cutting the padding to nearly nothing?

Nothing changed in the settings for memgraph., everything is on default except for the scaling. Actually, I can increase the padding to 10GB and fill it up anyway...at least the GC stops running after a while (nope, it doesn't...just a different interval but still too often) but that cannot be the solution ;)

FbkibYl.png

Unfortunately, I cannot recreate this behaviour with just EEX or EEX + Part Angle Display installed..so, still looking for the reason...

edit: nvm...1) default config of memgraph for 'allow padding' is false, changed it to true 2) I can recreate it (anyway)^^

Edited by 4x4cheesecake

Share this post


Link to post
Share on other sites

@4x4cheesecake You might want to clean out everything and start over. That interval between the min and max heap is definitely not normal and will make KSP basically unplayable. And it makes diagnosing any problems with click through blocker very difficult.

The earlier screenshot shows a min of 1703MB and a max of 1706MB. That means that Unity has allocated 1706MB of RAM for the heap (which is a lot, but more or less normal for KSP), but when the GC runs it only finds 3MB of unused memory to clean up. That's an amount you might expect for mobile, where you might have 15MB allocated to heap memory, but not for KSP. With so little overhead Unity should be asking for more heap space, but based on your second screenshot that seems to be immediately filled up, too, which is also not normal.

You might try installing GC Monitor, which can show the absolute memory usage for the heap, instead of just the allocation rate. That would show if there is some continual increase in the total space reserved for the heap. But, again, it's not normal for there to be such a small interval between the min amount used and the max amount of space reserved.

Edited by DMagic

Share this post


Link to post
Share on other sites

@DMagic I'll take a look at GC Monitor, and share the results but I think, this will happen in a separat thread in the support forum, since this is starting to drift away from the original topic and I'm no longer sure if a mod is the reason for this issue, or if it is just my system...especially since it cannot be recreated by linuxgurugamer.

Thanks for advice so far, I'll ping all of you as soon as the thread is created ;)

Share this post


Link to post
Share on other sites
4 hours ago, Lisias said:

Humm… Since I added CTB into a customized plugin, my keystrokes are "eaten" when the plugin window is focused (white border on the window). Perhaps another plugin could be influencing on CTB?

???  Meaning you added it to a mod and recompiled it?  Which mod? 

Some mods eat the keystrokes themselves, so I would need more info on this

Share this post


Link to post
Share on other sites

So, I tried my setup on a linux install and got the same issue but since I had to download all the mods again, I noticed the CTB 1.6.6 update....I just missed it before. Well, lets keep it short: the issue is gone with ne new version of CTB :) No frame drop, not a single spike in memgraph or GC monitor and the GC keeps calm.

@linuxgurugamer thank you very much for your help and the quick update and ofc @DMagic @Lisias thank you too, I really appreciate your help :)

Edited by 4x4cheesecake

Share this post


Link to post
Share on other sites
1 hour ago, linuxgurugamer said:

???  Meaning you added it to a mod and recompiled it?  Which mod? 

Some mods eat the keystrokes themselves, so I would need more info on this

Now I'm sure. It's the CTB (or/and Toolbar+Blizzy - I'm only mentioning it because it's the other code intervention I did) running on KSP 1.4.4 + MH 1.3  under MacOSX.

By using a old, 1.3 binary, for a mod I'm using (HLAirships), I can select the HLA window (the window border became white) and Shift and Control (and everything else) works.

By using "my" binary, modified to use Toolbar and CTB, when the HLA window is selected, all the keystrokes are ignored.

I hope this is not yet another Unity's idiosyncrasy. :)

 

— EDIT — 

HLA is not the only mod with the issue. Every single mod those window border became white does it, MechJeb2 is another one. I don't know if MJ2 uses or not the CTB, but HLA didn't presented the problem before recompiling with CTB, so it is at least a trigger.

Edited by Lisias
addendum

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.