Jump to content

[Solved] Removing ModuleGimbal lag in 1.4.5


Recommended Posts

Gentlemen, my old nemesis is haunting me again after a couple of KSP patches.

ModuleGimbal was tap-delayed in KSP at least as long as I can remember. That happens because it is a separate module and not part of the ModuleEngine(FX).

Standard situation for engines: physx update -> user alters joystick position -> vessel control state updated -> engines FixedUpdate() (thrust applied) -> gimbal FixedUpdate() (here thrust is rotated, but it's too late, so it goes to the next frame) -> physx update
Compare it to control surfaces that do not suffer from this: physx update -> user alters joystick position -> vessel control state updated -> controlSurface FixedUpdate() that first reacts to control state and then applies aero forces -> physx update

Thanks to the advice of The One I circumvented this in previous versions of KSP by moving ModuleGimbal to the very beginning of part config node. This way gimbal's FixedUpdate was called before engine's. How exactly did that work is still unknown to me, but it worked.

Old code that did reordering: https://github.com/Boris-Barboris/AtmosphereAutopilot/blob/master/AtmosphereAutopilot/GimbalRearranger.cs#L52

Now it does not. Rearrangement of nodes does complete, but it is not reflected in the actual module instantiation order or module node order in save or craft files. I can only assume that the config I'm modifying is no longer the source of truth.

I am once again seeking public council. Remember that the end goal is to make ModuleGimbal FixedUpdate be called strictly before ModuleEngine. I would gladly throw config node manipulation out of the window if there is a more elegant way.

Edited by Boris-Barboris
Link to comment
Share on other sites

  • 1 month later...
On 8/18/2018 at 11:47 PM, Boris-Barboris said:

Ok, solved it. DLC added new LoadingSystem - Expansions.ExpansionsLoader.

That's why I had to properly inject my loaders right before PartLoader, and not in the second from the tail position in loader list.

Could you please provide a link to the source code containing the fix?

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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.

×
×
  • Create New...