williambl / EssentialFeatures

🎮 A Minecraft Forge Mod for 1.10 to 1.16.5, adding assorted features.
MIT License
4 stars 1 forks source link

1.12 lag on Viewed Block #40

Closed Zygus42 closed 6 years ago

Zygus42 commented 6 years ago

Description:

I'm using a mod called LagGoggles to profile items and blocks from mods I'm adding to a new modpack, and your block "Viewed Block" is giving off quite a lot of lag - about as much as having 50 chickens in the area. I'm guessing that you're probably just checking too often to see if someone is looking at it.

Info:

williambl commented 6 years ago

I can think of a few things that I could do to speed it up: it's currently checking every tick, but I could make that configurable.

What CPU do you have?

For now, you could try reducing the viewed block range in the mod options. This will reduce the range that the viewed block checks for players in.

Thanks for adding Essential Features to your modpack!

Zygus42 commented 6 years ago

I have a high end gaming computer, but not everyone who plays in my worlds does. After some issues in the past, I'm optimizing this modpack for lack of lag and max fps, and LagGoggles has helped a lot with that. Some mods have made changes to their block management after reports of lag, and some are beyond hope. I'll have a look at the config for that - may turn it way down.

And yes, many mod items/blocks check stuff way more than they need to - fine in singleplayer and with few mods on, but when you pile on the mods and go multiplayer server over what may not be ideal internet connections with possibly crappy old computers, really need to check everything as little as you can get away with.

williambl commented 6 years ago

Attached is an experimental build with two optimisations:

  1. The Viewed Block now only checks for players on the server side, as it should have been before.
  2. The Viewed Block only updates every other tick. This is customisable in the settings.

Does this work better?

2.0.1-optimised.zip

Zygus42 commented 6 years ago

It's a lot better - about a quarter of what it was, so about 12 chickens worth :) Should try LagGoggles - great testing and development tool.

Zygus42 commented 6 years ago

If I set the delay to 10, it's almost no lag, so fantastic !

williambl commented 6 years ago

Thanks for helping me debug this :)