Ruins (Structure Spawning System)

Ruins (Structure Spawning System)

23M Downloads

[Dynamic Lights] Significant FPS drop when in the Nether

Luke616 opened this issue ยท 24 comments

commented

I've been experiencing a significant FPS drop when in the nether I will go from a steady 100~ FPS in the overworld to 1-2 FPS in the nether, but as soon as I hit the key to disable dynamic lights, the FPS shoots back up to 100 or so.

I have tried to disable anything not related to the player in the configs (so, no mob lights, entity lights, dropped item lights) and I am still having this issue. Any help would be appreciated.

Minecraft 1.12.2
Forge 14.23.2.2624
Dynamic Lights 1.12.1

Thanks!

commented

The "optimization" for light in minecraft revolve around sunlight, blocks being visible to the sky, and caching. In the nether, none of these really work. It's possible Dynamic Lights causes some kind of cascading light update across half the map. There's not really anything i could do about it. Does Optifine still support Dynamic Lights? Try that?

commented

Perhaps an option to dynamically disable the mod when in the nether dimension / enable it when leaving?

I'll try optifines feature when I get home but I would really like to use this in my pack, and unfortunately optifine is not curse distributable. Your mod is also much more configurable in terms of which items/situations cause light, which is a big plus.

commented

Thanks for investigating this. It seems like it only affects certain people. Here is a link to the most recent version of my pack which still has the mod. I've since removed it due to multiple players complaining that the nether was unplayable (it affects me as well)

However, I have other users who say they have not encountered the issue at all (like you), so it seems like it does not affect everyone equally. Perhaps it's a GPU / CPU specific issue?

It's worth noting that I also have this issue when Dynamic Lights is the only mod in the pack.

https://minecraft.curseforge.com/projects/magiculture-2/files/2541616

commented

Looks like some other people have reported a similar issue - here is a link to a comment on curseforge of someone else requesting the ability to disable dynamic lights in certain dimensions via config. Definitely not just me but it doesn't seem to affect anyone.
https://minecraft.curseforge.com/projects/dynamic-lights#c41

commented

I don't really think it is a CPU/GPU issue as it would affect me atleast SOME. 120 fps to 2 is not something i would miss, even it if was reduced on my PC. I glanced at your files but that doesn't appear to be an extract-and-run modpack, and i am definitely not bothering with research on how to setup these modpack installers.
If you wish to research this, google on how to use Java VisualVM, connect that to your running/lagging mc instance, and check out the methods abusing your CPU. It should be fairly obvious where the problem is.

commented

Actually i just checked on my client and i could use Dynamic Lights just fine in the Nether. 120fps. Whatever problem you have must be on your end.

commented

OK there's definitely some kind of bug happening. To work correctly (or rather, prevent crashes), Dynamic Lights needs to replace a collection in the MC render engine which holds the "blocks to update light next for". This collection has to be replaced every time the player world changes (overworld, nether, dimensions basically) as MC resets it.

For the "hack" method to show up in CPU usage at all - it should only run ONCE - there's something causing your "world" to change rapidly, atleast as far Dynamic Lights can tell. I will see if i can make an attempt at a fix when im home later today.

commented

Alright, downloaded Java VisualVM and read up a bit how to use it. Profiled my CPU usage for 30 seconds of flying straight forward generating new chunks in both the overworld and in the nether. The ONLY mod installed was dynamic lights, and the version of forge used was 14.23.2.2624. Here's what I came up with:

This is the nether test - you can see that the overwhelming amount of CPU usage was from this method called by dynamic lights

nether 1
nether 2

This is the overworld test - the same method which was hogging all of the memory before is now only using a modest amount.

overworld 1
overworld 2

Am I interpreting this right? It certainly seems like this issue only affects some players but it is game breaking and it absolutely seems to be caused by dynamic lights.

commented

Thank you very much! It's still very odd that only some people encounter this. Feel free to send test builds my way and I'll let you know if I experience the issue on them.

commented

Indeed - the line does appear, and only once, when a world is started for the first time. I recorded a quick screen capture of the issue, so you can see what it looks like when it occurs.

Here is the link: https://youtu.be/LhBxzpx68-4
Here is the log file that corresponds with this test: https://pastebin.com/3Nthn6uQ

An interesting thing to note from the video is that sometimes, after a lot of initial slowdown, the framerate stabilizes and the nether seems to be working fine - but sometimes the slowdown does not seem to end and sometimes it comes back randomly. When playing with lots of other mods, the slowdown rarely ever seems to end.

Thank you again for taking the time to investigate this in detail

commented

42449cb

I've pushed Dynamic Lights 1.4.7 which should fix this particular problem or atleast make it less visible, if it does happen again. Give it a try.

commented

Unfortunately I'm still having this issue with 1.4.7. EDIT: my framerate when holding a torch is fine, ignore previous comment. Here are some visualVM reports using 1.4.7:

Fly forward for 30 sec in the nether, no torch in hand (incredibly poor fps)
30 sec fly in nether no torch

Fly forward for 30 sec in overworld, no torch in hand (framerate fine)
30 sec fly without torch in hand

Fly forward for 30 sec in overworld, with torch in hand (slightly choppy)
30 sec fly with torch in hand

commented

Can you check your logfile / console immediatly after loading the savefile for the first time? I susped you have (a lot) of Dynamic Lights stacktraces in there showing some kind of issue

See if the following line appears:
Dynamic Lights successfully hacked Set RenderGlobal.setLightUpdates and replaced it with a ConcurrentSkipListSet

commented

No, there's nothing of interest in that file sadly. I have actually experienced a huge stutter when entering the Nether ... for a couple of seconds the game basically freezes ... but the problem your VisualVM screenshots show would not "go away". I will have to think on this.

commented

Still no chance you could add a config option that when =true disables dynamic lights whenever the player enters the nether and re-enables it when they leave? Would function as a sort of patchwork fix for the issue.

commented

Yes. I've pushed Dynamic Lights 1.4.8 which implements a global dimension id list, in which you can ban dimension IDs from being used for dynamic lights. I've added the Nether (-1) to the default.

commented

Try this one. It's officially the last thing i could think of.

https://github.com/AtomicStryker/github.io/blob/master/files/1.12.1/DynamicLights-1.12.1.jar

commented

The link doesn't seem to work for me, just redirects to pages.github.com - thank you again for continuing to search for a fix.

commented

Was able to find it by looking at your github profile (link is https://github.com/AtomicStryker/github.io/blob/master/files/1.12.1/DynamicLights-1.12.1.jar for anyone else watching this thread)

Whatever you did this time has absolutely fixed it for me! Thank you so much!

commented

Fantastic, thank you for this.

commented

Still having the issue with the latest update. With dimension -1 banned in the configs, the frame drops are still occuring for me in the nether. However, pressing the "dynamic lights globally off" hotkey does still fix the issue. So whatever method the hotkey uses to disable the lights seems to fix things, but not the banned dimension setting.

commented

As of v1.12.2 i notice and are impacted by this quite significantly to the point if playing in SSP my FPS tanks to 1-2 and standing still i can get at least into the 50+ range. SMP it causes movement and flying to be very very chunky and jittery with almost spikes of lag when trying to move.

commented

Have you tried using the version linked above? I know it isn't uploaded to curse yet but it fixed the issue for me.

commented

Well thats where im unsure as that came out around the same time as 1.12.2, so i not sure if its in the same codebase or was added afterwards and unf i need a curse version, but i will test it none the less.