Mindoth / fabledweaponry

1 stars 0 forks source link

Scythe causing infinite loop crash #1

Closed Joyg63tk closed 4 months ago

Joyg63tk commented 4 months ago

Looks like an infinite loop of damage calculations until the game crashed, likely a mod incompatibility issue but maybe the damage source can be changed to fix it IDK. The log and debug are massive 85mb so if you need those let me know how you want them since pastebin and github don't like the size.

crash-2024-03-22_16.00.25-server.txt

Joyg63tk commented 4 months ago

After some testing its definitely the AoE damage from the Scythe causing an infinite loop of reapplying potion effects and damage when there is any type of additional damage effect from Apotheosis or similar combat altering mods that activate from source entity damage. And there are 2 or more enemies that live long enough for the effect and damage to "bounce" until it crashes the game.

Edit: forgot to mention key information, the main cause is removal of i-frames from iron-rpg tweaks mod, but still this only happens with the scythe because AoE effects will loop infinitely unless the trigger is conditional. Adding a config to turn off the effect would be the easiest fix to make this mod compatible eve though it would be a shame to do so.

Mindoth commented 4 months ago

Thanks for bringing this to attention. I'll be taking a look at it.

Mindoth commented 4 months ago

I have uploaded an update for the 1.20.1 branch in CurseForge that might have fixed your problem. I'm still not fully sure what this issue actually is and I have not been able to replicate it. I however found some parts of the Scythe's code that I have changed so let me know whether or not the issue has been fixed in the newest version. I will keep this issue open for now.

Joyg63tk commented 4 months ago

Cool I will test is as soon as I can, but to be more precise, the bug occurs when using certain Apotheosis affixes and is made worse by any mod that lowers the i-frame duration or removes them. From testing it seems like it's because sweeping attacks deal the AoE damage for each enemy hit effectively making it multiply exponentially per enemy. I tested this with no other mods by hitting with a crit and then with a sweeping attack to a group of no ai zombies and starting at around 5 you can see the noticeable lag when you sweep and hit them all. Epic fight makes weapon hitboxes much larger depending on the type of weapon. This makes the problem much worse but still doesn't alone crash the game, just has a very slight impact on performance during combat with multiple enemies. Apotheosis can add effects that trigger on direct hit from the player, this is where it can crash with just 2 enemies. Because the AoE triggers from all direct damage from the player and it is also itself a direct hit, even if the damage source is different so it wont trigger itself in vanilla, any damaging effect that is then added from Apotheosis will also trigger the AoE and be triggered by the AoE causing an infinite loop that will crash the game. Immunity ticks being lowered or removed in turn makes that loop faster so it crashes the game more often.

The main culprits in this case I think are Apotheosis with weapon affixes that apply potion effects on hit or trigger another AoE hit, and Iron's RPG Tweaks, for removing the immunity ticks.

Restoring the immunity ticks to vanilla did reduce a great deal the problem, and made it much harder to naturally encounter a situation that would cause a crash.

Things like the Cleaving affix from apotheosis will always cause a recurring loop if the enemy has enough health to crash the game before it dies. 2024-03-24 11_43_52-Minecraft Forge_ 1 20 1 - Singleplayer Bleeding potion effect from Apotheosis (apothic attributes) is also a main culprit, likely because its considered damage from the source entity so it will also cause an AoE per tick that then reapplies itself in a loop.

Joyg63tk commented 4 months ago

Tested the update, and it did fix performance quite a bit actually but the infinite damage bug still happens. I did a quick test and uploaded the video for you here. https://streamable.com/0vwblp

and appended the crash log crash-2024-03-24_11.58.20-server.txt

Its very unlikely it will cause a crash when hitting normal mobs since they just get insta nuked lol but the bug is still there. For now I disabled the 2 main affixes from Apotheosis that cause it.

I'm sorry if I can't help come up with a solution, my knowledge is limited since I just make modpacks and datapacks I don't want to speak out of my ass but this might just be an incompatibility issue and the best work around would be to add the option to disable the effect or change it to trigger on crits instead. But it's not my place to tell you what to do, it's a great mod and I really like the unique aspects every weapon has so I would rather disable the affixes than the weapon effect.

Mindoth commented 4 months ago

I also found out that if you have a line of enemies then your scythe AOE will hit EVERYONE since the extra mobs hit by your Scythe's sweep will create a new AOE for some reason. This does not happen in the 1.16 version of the mod so something has changed with Forge updates in the 1.20 era. I need to change the code a bit it seems...

Mindoth commented 4 months ago

Okay. I've learned a bit more about DamageSource in modern Forge and will upload another version that is more like the 1.16 version in terms of functionality. It could even work with your setup. Let me know if it works.

Joyg63tk commented 4 months ago

Its fixed! great work, it works with Cleaving from apotheosis now. Thanks for looking into it.