jabelar / MovingLightSource-1.12

Jabelar's Moving Light Sources Mod
https://minecraft.curseforge.com/projects/jabelars-moving-light-sources
4 stars 2 forks source link

Massive frame rate drop while walking when holding torch #18

Open Rimevel opened 6 years ago

Rimevel commented 6 years ago

When I hold a torch and walk I drop from 60 to 20 fps until I stop.

jabelar commented 6 years ago

Do you mind posting the specifications for your computer? I don't seem to have noticeable performance hit, but I admit I'm usually running on a fairly high performance computer.

jabelar commented 6 years ago

Okay, so I tried testing FPS and I don't see a noticeable drop really. Hard to really tell as Minecraft FPS (like many large-world games) the FPS varies a lot as you move (chunks load, etc.) but in the video (https://youtu.be/PWI_e5KQaxQ) you can see that moving generally creates a bit of a drop and it is about the same holding the bone and the torch.

A couple things you should try. In your video settings try changing the max frame rate to "infinite" and turn off VSYNC.

Minecraft FPS is weird because if you set VSYNC on you'll see that sometimes the FPS drops lower. but if you set VSYNC off with higher FPS limit you'll see that it stays above 60. No matter what limit you set, drops will happen which is kinda weird cause you'd think that if it can handle 230 it should be able to lock to 60.

Anyway, I do see a slight effect on fps with torch but not something as bad as you're seeing. Let me know if you can figure out why your experience might be different.

Rimevel commented 6 years ago

I'm running on one of the more powerful i7s, 16GB of ram, the latest model of SSD and a GTX 1080. So specs should not be a problem. I tried what you suggested above and there was no change. I forgot to mention I was running this with a couple other mods. By itself your mod work fine. A slight drop as you said.

After much trial and error removing and adding mods back it seems like the mod Dynamic Trees might be what is causing the problems. Not sure why but any time I bring out a torch near a bunch of those trees I lose about 2/3 of my frames, capped or unlimited.

Laike-Endaril commented 5 years ago

I've run into this as well. Flying in small circles (no chunk loads)... ...with only moving light installed ...when not holding torch: average ~400 FPS ...when holding torch: average ~170 FPS ...on my modpack ...when not holding torch: average ~100 FPS ...when holding torch: average ~20 FPS

Unlimited, no vsync. Optifine is not installed in either case (and ofc in the dedicated test, literally no other mods are coming into play). Forge stable (14.23.5.2768). Nothing in the log file.

rvveber commented 4 years ago

From 400 fps down to 8fps absolutely uplayable, you have some dirty code somewhere.

you execute processLightPlacementForEntities(theWorld); at every. single. tick.

And your method of creating light is too complex aswell

jabelar commented 4 years ago

As mentioned, I have no problems with fps on my computer and you can see the videos I've posted and such. https://youtu.be/O2dPV7yQiQg. I feel it is playable.

However, I agree it IS very processor intensive and that is not my code's fault it is Minecraft code problem. There is a reason Minecraft didn't do their own moving lights -- their lighting update code is extremely inefficient (and I guess uses CPU instead of GPU).

But if you have a moving light source, you have to call their code to process the light placement otherwise there can't be moving light. if you try to skip updates then the lighting effect gets really bad if you're moving because it doesn't catch up properly.

To improve the performance you'd probably need to do a core mod on their lighting update engine. Or better yet get raytraced proper lighting engine when that is available.

rvveber commented 4 years ago

I have a fairly high end PC and only get 8 fps, not to mention the insane flickers that appear all the time. Maybe it's architecturally specific or different when Optifine is active?