Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HarmonyPatch causing game stutters #63

Open
dommrogers opened this issue Feb 9, 2023 · 0 comments
Open

HarmonyPatch causing game stutters #63

dommrogers opened this issue Feb 9, 2023 · 0 comments

Comments

@dommrogers
Copy link

MelonLoader v0.6.0 ALPHA Pre-Release
Unity Version : 2021.3.6f1
Il2CppInterop Version : 1.4.3-ci.244
HarmonyX : 2.10.1

Hi All,

With the recent changes to The Long Dark some methods are being called multiple times per frame and when you attempt to patch one of these methods the game starts having intermittent stuttering.

This happens for both Prefix and Postfix regardless if any logic is being run inside the patch or not.

From testing it appears to be multiplying the overhead of the patched method by at least x5 which if being called 50+ times per frame soon starts to stack up the overhead (in miliseconds) and causing the stutter.

[HarmonyPatch(typeof(GearItem), nameof(GearItem.GetItemWeightKG), new Type[] { typeof(bool) })]
internal class GearItem_GetItemWeightKG_Prefix

The base game code seems to handle this quantity of calls and many more no problem, It's only once you add a harmony patch you start to get (stuttering).

Bit of an edge case I know but I can see how this may evolve to be a bigger problem and thought I would mention it.

Happy to provide more info or do tests if required.

STBlade
(TLD Modder)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant