Jump to content

[WIP] PrunePhysics - turn parts to physicsless for better performance with large ships


peteletroll

Recommended Posts

6 hours ago, peteletroll said:

On the launch pad: you can't activate PrunePhysics on the antenna because it's already physicsless

Aha, I guess I don't have a good understanding of which parts are already physics-less.

20 minutes ago, peteletroll said:

- go to a big ship, and start activating PrunePhysics where you want;

I don't use many stock parts. Most everything is either a Nertea part or SSTU. Most of these parts have custom modules that I guess I'll need to whitelist manually in order to prune their physics, correct?

Link to comment
Share on other sites

Yes @leatherneck6017. You can put your own *.ppwl file in GameData.

If you use the debug dll as described in a previous comment, you can reload your whitelist with a PAW button. You have to create the file before starting KSP: the "ResetWhiteList" button only reloads files, it doesn't check for new ones. Also, the debug dll has a "DumpPartPhysics" button that dumps all the module names to the log, and helps you find the modules and resources that fail the whitelist check.

Link to comment
Share on other sites

I highly doubt this could bring any performance improvement, but would love to be proved wrong.
So I did a silly test : added ".*" to the whitelist, loaded a 500 parts ship, saved, edited the save to change all 500 instances of "ModulePrunePhysics.PrunePhysics" to "True", reloaded the save.
Tested in a fresh sandbox save, no mods, mid range hardware, in sun orbit, no celestial body in the screen

Got a couple of unity "A joint can't connect the body to itself" errors on load, and the vessel indeed dislocated in a few places.
But my point is : 25 fps with PrunePhsyics, 25 fps without.

So I'm quite skeptical disabling a couple joints on the few parts that will end up whitelisted is gonna make any difference.
And on the other hand, unless I'm mistaken, turning parts to physicless will have a significant impact on drag calcs accuracy.

Edited by Gotmachine
Link to comment
Share on other sites

Well, something to point out : the "part physics is the major performance hit" statement is mostly a myth.
This is the unity profiler results for a single frame for that 500+ parts vessel (without PrunePhysics) :

9pGMaLF.png

(20 ms / 47.45ms ) * 60 fps = 25.28 fps
Physics processing is in orange, we have :
-
Physics.SyncColliderTransform : 2.73 ms
- Physics.Processing : 4.10 ms
For a total of 6.83 ms, so less than 15 % of the total.

In comparison :
- FixedUpdate : 23.18 ms (48%)
- Update : 7.17 ms (15%)

Details of fixedupdate :
Tlc49Yu.png

Granted, that vessel has a lot of radiators used as decoration (grabbed a random craft from kerbalx).
But the point is : the performance hit comes in large proportion from non-physics related things.

Edited by Gotmachine
Link to comment
Share on other sites

New release: some bugs fixed.

It looks like @Gotmachine is right: the mod works, parts go physicsless as expected, nothing breaks, Kraken doesn't show up, and yet there's no significant performance increase. Bummer...

If anybody's interested, that's how this mod works.

At OnStart(), all parts in a craft have full physics. PrunePhysics' OnStart() changes the part's PhysicsSignificance, then KSP proceeds to remove physics where needed as usual.

Link to comment
Share on other sites

  • 1 year later...

Sorry for necroing the thread, just wanted to say "thank you". It doesn't help with performance, but it surely helps with building atmospheric landers, making some surface attachments physicsless. Curious if it is possible to make parts shielded in the same convenient way, because cargo bays are known for their buggyness.

Link to comment
Share on other sites

  • 1 month later...
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...