New patch : DragCubeGeneration#139
Merged
Merged
Conversation
Faster and more reliable implementation of drag cube generation. Improves overall loading times (both game load and scene/vessel/ship load times), prevent occasional lag spikes (in the editor mostly) and fix some issues causing incorrect drag cubes to be generated (notable examples are the stock inflatable heat shield, the 1.25m and 2.5m nose cones and the Mainsail shroud). Note that by design, this patch results in a small deviation from the stock behavior for buyoancy, aerodynamics and thermodynamics, as the generated drag cubes will be slightly different.
…while the generation for the previous part isn't finished during part compilation due to missing integration with the "framerate unlocked" part compilation of the FastLoader patch.
… when called on a part set to translucent (ie, detached part in the editor)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
So after much fiddling around, I got a prototype re-implementation working.
This is intended to address issue #137
Here is a preview release :
KSPCommunityFixes_DragCubeGeneration_RC3.zip
Some profiling stats, for loading a stock + DLCs install :
So KSPCF drag cube generation is taking ~2.5s instead of ~10s. This was tested with a 6700XT GPU, it's probable the gains won't be as good with a low end GPU where the bulk of the time is spent doing the render and texture readback.
Aside from loading time (which are only relevant when the part database is regenerated), this also provide a significant in-game speedup for everything that generate drag cubes on the fly. In stock, this only affect fairings, but there are many mods making heavy use of runtime drag cube generation (either manually, or by using the stock "procedural" drag cubes system). Popular examples include B9PartSwitch, SimpleAdjustableFairings, SSTU, Procedural Parts, ProceduralWings, DecouplerShroud...
All optimizations are done by avoiding some pointless CPU overhead, and massively reducing GC allocations :
IMultipleDragCubemoduleIMultipleDragCubemodule is present :Camera.Render()call from doing useless things on unused renderers)Camera.Render()callsDragCubeSystem.CalculateAerodynamics())As of now, the KSPCF implementation has a few differences with the stock one, resulting in different drag cube values :
DragCubeSystem.CalculateAerodynamics()re-implementation is more precise when computing the drag coefficient, so the final value will always be slightly different.The patch also fix two stock issues :
As a bonus feature, the patch also implements a visual "drag cube debugger" available from the "physics" tab of the stock debug window.