Skip to content

Commit

Permalink
New patch : DragCubeGeneration (#139)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gotmachine authored May 6, 2023
2 parents 2f9c07e + 0b9c8e2 commit 5d85327
Show file tree
Hide file tree
Showing 7 changed files with 1,508 additions and 1 deletion.
8 changes: 8 additions & 0 deletions GameData/KSPCommunityFixes/Settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,14 @@ KSP_COMMUNITY_FIXES
// Prevent performance drops when there are in-progress comet sample or rover construction contracts
ContractProgressEnumCache = true
// 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.
DragCubeGeneration = true
// Faster and minimal-allocation replacements for the Localizer.Format() methods, can provide
// significant speedup for GUI-heavy mods using localized strings.
LocalizerPerf = true
Expand Down
2 changes: 1 addition & 1 deletion KSPCommunityFixes/BugFixes/LadderToggleableLight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// This patch is mainly intended as a fix for the stock "Kelus-LV Bay Mobility Enhancer" light being always active,
// even when the ladder is retracted.
// But this also provide a generalized way of linking a RetractableLadder module to a ModuleLight module, see comments
// in the module for how to use it.
// in the RetractableLadderLightController module (further in this file) for how to use it.

namespace KSPCommunityFixes.BugFixes
{
Expand Down
3 changes: 3 additions & 0 deletions KSPCommunityFixes/KSPCommunityFixes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<RootNamespace>KSPCommunityFixes</RootNamespace>
<AssemblyName>KSPCommunityFixes</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<LangVersion>8.0</LangVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<PlatformTarget>x64</PlatformTarget>
Expand Down Expand Up @@ -110,6 +111,7 @@
<Compile Include="BugFixes\EnginePlateAirstreamShieldedTopPart.cs" />
<Compile Include="BugFixes\StrategyDuration.cs" />
<Compile Include="Library\Collections\Deque.cs" />
<Compile Include="Library\Extensions.cs" />
<Compile Include="Library\LocalizationUtils.cs" />
<Compile Include="Modding\ModUpgradePipeline.cs" />
<Compile Include="Performance\AsteroidAndCometDrillCache.cs" />
Expand All @@ -119,6 +121,7 @@
<Compile Include="Performance\ContractProgressEnumCache.cs" />
<Compile Include="Performance\DisableHiddenPortraits.cs" />
<Compile Include="Performance\DisableMapUpdateInFlight.cs" />
<Compile Include="Performance\DragCubeGeneration.cs" />
<Compile Include="Performance\FastLoader.cs" />
<Compile Include="Performance\LocalizerPerf.cs" />
<Compile Include="Performance\MemoryLeaks.cs" />
Expand Down
23 changes: 23 additions & 0 deletions KSPCommunityFixes/Library/Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace KSPCommunityFixes
{
static class Extensions
{
/// <summary>
/// Transforms a direction by this matrix.
/// </summary>
public static Vector3 MultiplyVector(this Matrix4x4 m, float x, float y, float z)
{
return new Vector3(
m.m00 * x + m.m01 * y + m.m02 * z,
m.m10 * x + m.m11 * y + m.m12 * z,
m.m20 * x + m.m21 * y + m.m22 * z);
}
}
}
Loading

0 comments on commit 5d85327

Please sign in to comment.