peteletroll

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

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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Status report: no serious bugs, but no clear result on performance increase yet. Parts with PrunePhysics activated appear actually physicsless (no Rigidbody, no joints), I'll keep experimenting.

Share this post


Link to post
Share on other sites

New release, with more tools in the debug dll.

 

32 minutes ago, hypervelocity said:

I will deffintely try it out!

Keep in mind this is highly experimental, backup your saves! It didn't corrupt any of my current saves, but you never know...

Share this post


Link to post
Share on other sites
Posted (edited)

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

Share this post


Link to post
Share on other sites

@Gotmachine, thanks for testing and reporting. I am a little baffled by my test results too. Since Squad itself added physicsless parts as a performance hack, I expected to see some measurable FPS increase. I'll keep on trying. I want to build big things.

Share this post


Link to post
Share on other sites
Posted (edited)

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

Share this post


Link to post
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.

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.