Electroblob77 / Wizardry

Source code for Electroblob's Wizardry, a Minecraft mod about magic, exploration and adventure. Open-source so other aspiring wizards (a.k.a. programmers 😎) can see the real magic! ✨ Just want to download and play? Head over to the CurseForge page via the link below:
https://minecraft.curseforge.com/projects/electroblobs-wizardry
Other
193 stars 103 forks source link

Performance issues when rendering player model likely due to RenderPlayerEvent #669

Open laundmo opened 3 years ago

laundmo commented 3 years ago

Minecraft version: 1.12.2 Wizardry version: 4.3.2 Environment: Server

Issue details: When looking at other Players (or rendering the own player model in the inventory) in multiplayer, there are very noticeable performance drops. The other player did not seem to have anything wizardry related equipped or applied to them. It seems this issue only appears after a while, though we have not yet figured out what the conditions are.

the same issue also happens when looking at the own character in the inventory screen, making just opening the inventory lag a lot.

Note: i have not tested on newer versions, as this is the version included in the modpack. The issue appears with or without optifine.

the following is a screenshot of the LagGoggles result when profiling FPS: image

https://user-images.githubusercontent.com/24855949/121601201-e9dc1180-ca45-11eb-9eca-acf72ca29b5c.mp4

Other mods involved: modpack curseforge, modpack index (searchable)

laundmo commented 3 years ago

I used Jprofiler to see what exactly the issue is, it seems to be PlayerAnimator.onRenderPlayerPostEvent image image

laundmo commented 3 years ago

I seem to have found a workaround, you can set B:spellcastingAnimations=true to false in the ebwizardry.cfg Client section. This disables the animations that are causing the issues.

Electroblob77 commented 3 years ago

Yes, disabling that option would be my suggestion for now, but obviously you'll lose the animations feature.

I'm guessing one (or more) of the other mods you have installed is adding a lot of player models or layers. Could you post a mod list?

laundmo commented 3 years ago

@Electroblob77 i already linked a mod list at the bottom of my original post, but here you go again: https://www.modpackindex.com/modpack/6258/all-the-mods-3-remix-atm3r

Electroblob77 commented 3 years ago

Oh my apologies, I didn't see that. Thanks anyway!

laundmo commented 3 years ago

regarding #648

there does not seem to be a noticeable memory leak, even with the spellcast animations enabled. I would have noticed if there was one during profiling.

Electroblob77 commented 3 years ago

Are you sure? The reason I ask is that there really isn't anything else in that method that could cause it to take up all that processing time:

https://github.com/Electroblob77/Wizardry/blob/3f06d2fea45b0d8a1c840e8ef87ffa14804afe90/src/main/java/electroblob/wizardry/client/animation/PlayerAnimator.java#L235-L253

Unless the JProfiler readout is including time spent in any methods called within PlayerAnimator#onRenderPlayerPostEvent, in which case can you expand the first entry so I can see what's going on inside?

laundmo commented 3 years ago

I'm sorry, i made the mistake of not saving the snapshot. And making a new one is going to be hard since i had to disable this mod entirely due to a server crash related to EntityRemnant causing ticks longer than 60 seconds.

All i can say is that i was keeping an eye on the memory usage due to prior issues with my jvm GC arguments, and it did not reach the allocation or the InitiatingHeapOccupancyPercent of 70%.

Electroblob77 commented 3 years ago

Okay, what I'll do for now is fix issue 648, then when I release the fix you can test it and see if your issue still occurs.

Any chance you could report the EntityRemnant crash as a separate issue if you still have it? I can take a look at that as well while I'm at it.