Mihara / RasterPropMonitor

Plugin for Kerbal Space Program. This repository is out of date and is primarily of historic interest. See https://github.com/JonnyOThan/RasterPropMonitor
http://forum.kerbalspaceprogram.com/threads/57603
Other
116 stars 66 forks source link

JSIVariableAnimator rebuild #564

Closed MOARdV closed 8 years ago

MOARdV commented 8 years ago

Currently more of an idle question. Instead of using Update to ask "Did my variable change? Do I need to update my animations?", what about using the callback mechanism introduced with JSICallbackAnimator, and take advantage of the Unity coroutine capability with a yield returne WaitWhile()? The WaitWhile runs between Update and LateUpdate, and it can manage for itself whether it fires again.

This would eliminate the need for refreshRate in JSIVariableAnimator, and it would mean that quieter variables wouldn't be continuously spending cycles on no-op Update calls. On the other hand, noisy variables will continuously fire callbacks and launch coroutines (if the coroutine isn't simply continuously active). On the gripping hand, all of this is speculation until I test it out.

MOARdV commented 8 years ago

This fell together fairly easily this morning. I've got JSIVariableAnimator configured so I can switch between modes by using a setting in the config file. Now I just need to find volunteers to try it out to see if it makes a difference performance-wise...

DeputyLOL commented 8 years ago

Volunteers you say... Hmmm.... Want me to help?

MOARdV commented 8 years ago

Volunteers you say... Hmmm.... Want me to help?

If you're up for it... Mwa-ha-ha-haaaa!

Kidding aside: DropBox - first v0.27.1 test build. Install it as-is, try out a complex cockpit (especially one that has a lot of JSIVariableAnimator props). Then, exit, edit JSI/RasterPropMonitor/Plugins/PluginData/rpm-config.cfg, and add

UseNewVariableAnimator = True

And test out the cockpit again. What I'm specifically looking for is A) does one feel laggy compared to the other, and B) with the setting at True, does anything break? Afterwards, you can edit the config to make it False and the animators will work like they do in v0.27.0.

The change extends JSICallbackAnimator capabilities to JSIVariableAnimator, which may make JSIVariableAnimator less computationally expensive when it's not doing anything. Or, maybe it'll just make the whole game laggy and unplayable (doubtful - I should have noticed that locally).

DeputyLOL commented 8 years ago

I'm on it. I think my cockpit should do as it does contain a lot of props.

DeputyLOL commented 8 years ago

First thing to say... without anything edited. Nothing works...

DeputyLOL commented 8 years ago

My log is filled with dis: [EXC 19:31:38.078] MissingFieldException: Field 'FinePrint.WaypointManager.navWaypoint' not found. NavUtilLib.Analog.AnalogHSI.OnUpdate () InternalProp.OnUpdate () InternalModel.OnUpdate () Part.InternalOnUpdate () Part.Update ()

That's a problem with NavUtilities mod.

And everything looks like this: screenshot96

DeputyLOL commented 8 years ago

The lights still work, some switches still work, some animations still work. No monitors work.

MOARdV commented 8 years ago

Try removing the nav utilities mod, since it needs updated. An exception in one mod can screw up everyone else.

DeputyLOL commented 8 years ago

Unedited: Performance = 6/10 (with lag spikes due to crappy computer)

Now to test it with new system.

DeputyLOL commented 8 years ago

With new system Performance = HOLYSHITEVERYTHINGWORKSSOSMOOTHLY!!!INEVERKNEWMYCOCKPITCOULDRUNTHATSMOOTH!ITSSOSMOOTH!!!!WTF!!!!IMAGINESOMETHINGTHATSREALLYSMOOTH!!!THISIS40000000TIMESSMOOTHERTHANTHAT!!!!ITWORKSSOWELL!!!!SMOOOOOOOOOOOOOOOOOOOOOOTH!!!!!!!!!! /10 (with lag spikes)

DeputyLOL commented 8 years ago

one thing I will say is that sounds are playing outside of the cockpit.

MOARdV commented 8 years ago

So... The new performance is good? :)

I realized the sound didn't get sorted out, but I had some work-work stuff I needed to do, so I didn't get around to fixing that problem yet.

DeputyLOL commented 8 years ago

Was I not clear enough? Performance was though the floor.... of the floor above... DECODE THAT!

Simply: PERFORMANCE = AMAZINGLY SMOOTH.

Also I've noticed that there is more of a problem with sound than I first thought. Some sounds play when the ship loads outside of IVA. Some sounds continue to loop outside of IVA. And some sounds won't play at all.

MOARdV commented 8 years ago

Also I've noticed that there is more of a problem with sound than I first thought. Some sounds play when the ship loads outside of IVA. Some sounds continue to loop outside of IVA. And some sounds won't play at all.

Obviously, the solution is "don't use sound". Problem solved.

I will address that, since you are getting extremely good results (I assume you tried flipping it back to False to make sure it was repeatable).

DeputyLOL commented 8 years ago

I haven't done that yet. I'm actually starting to think that the sound itself is not being triggered for some reason. I'm looking into the variables behind the sounds to see if something isn't working.

DeputyLOL commented 8 years ago

I found it. RADARALTVERTSPEED returns as Nan.

PLZ FIX DIS!!! DIS IS VRY IMPOTANT 4 MEH COKEPIT!!!!11!!1111

This wasn't the case when: UseNewVariableAnimator = False

DeputyLOL commented 8 years ago

also. when I say it runs smoothly, I mean that everything using maxRateChange runs smoother. But the cockpit does feel a lot more responsive as well.

DeputyLOL commented 8 years ago

Ok never mind. RADARALTVERTSPEED is returning NAN with it set to false as well. should I start a new issue?

MOARdV commented 8 years ago

I get Infinity when I check it on the MFD. That's pretty impressive for a circular orbit...

MOARdV commented 8 years ago

v0.27.1 dev build was updated with the fix (same link as above)

DeputyLOL commented 8 years ago

thank you. ill take a look.

DeputyLOL commented 8 years ago

Also you might want to remove nav utilities from the list of supported mods until it gets updated.

MOARdV commented 8 years ago

As implemented, it has side-effects on parts that rely on low refresh rates (eg, the JSIMainCompUnit and PSU). IIRC, alexustas was changing those mods to use JSICallbackAnimator with a reduced-frequency update function, anyway, so that may be okay. I should check the JSI stock blinkenlichten, though.