TerminatorNL / LagGoggles

A minecraft forge mod which visualises lag in the world
GNU General Public License v3.0
54 stars 20 forks source link

Timing non entities (?) #7

Closed TerminatorNL closed 6 years ago

TerminatorNL commented 6 years ago

Zygus42 #21:

Would it be possible to add an option to include blocks as well as / instead of entities ? Often it's a block added by some mod that I have doubts about, especially items such as flowing liquid blocks and leaf blocks.

I will look into this, I'm currently working on another project so it could be a while before I get to this.

Side note: Liquids do not update after they're done flowing, (At least: lava and water do not, this is part of the BlockDynamicLiquid class. 👍) Rather: They check their surroundings if a neighbouring block sends an update; or when initially placed.

If you have some examples for me to test on, that would be nice.

Zygus42 commented 6 years ago

Specifically I started thinking about this from 2 issues - the pseudo-flowing water blocks that Streams adds and the lag we've gotten in the past of Forestry leaf blocks. Would love to be able to see what kind of lag they're producing.

But as I've built quite a few modpacks, I've also rejected mods in the past because all kinds of blocks were clearly adding to lag either fps or tps, even ones that were just decorative - you never can tell what is going to stuff up your server, which is where this tool would be invaluable.

We had to stop playing our last world, as something(s) was/were causing way too much lag but because we were running so many mods, we just weren't able to pinpoint exactly what was doing it, and it was probable that it was a bunch of stuff from different mods. Got to the point where the chunks were getting corrupted because their save information was too large for the game to handle - first time I've seen that happen.

TerminatorNL commented 6 years ago

Hrhmm...

I looked at the forestry source, and traced the update method for the leaves back to forge. It's inside WorldServer.java in the tick() method. I completely missed this, being focused on entities alone.

I will definitely support this!

Zygus42 commented 6 years ago

Another type of "item" that I always wondered about were the multiblocks like Forestry's Alveary - they constantly update when you remove or add a block to them, so they must be checking for their state all the time. How well has that been done ? This is different from the approach to multiblocks in Immersive Engineering where you have to do something specific to create the multiblock and it therefore presumably doesn't check the state of all the blocks all the time.

TerminatorNL commented 6 years ago

I did some digging, and to give you a quick rundown:

  1. The alveary registers itself as multiblock inside forestry
  2. Forestry registers itself on the world to run every tick
  3. Whenever it receives a tick, all the multiblocks are checked.

Not quite elegant, but it works

Zygus42 commented 6 years ago

It does work, but how much is it slowing down our servers - is having 10 of them a critical drain ? what about 100 ? Those are the kind of issues every server organiser would love an answer to, particularly if you can supply it in a nice visual online format.

TerminatorNL commented 6 years ago

I can't tell at the moment, but I guess we'll find out when I add support for it!

Zygus42 commented 6 years ago

Some more ideas that popped into my head today: (1) it would be good to be able to adjust the distance you're scanning at to be more or less than the default. (2) an option to only do the block / item you're pointing at.

TerminatorNL commented 6 years ago

Option 1 is included in version 3.0! This is only for non-operators, however.