Rigor Module


New type of module: Rigor modules. Rigor modules increase the probability of a recipe returning its most valuable product.

Content
3 days ago
2.0
8.22K
Manufacturing

b Lag when placeing entities

5 days ago

Hello. Your mod is one of four mods in my list that create a significant amount of lag under certain conditions. I have linked an example video where I am standing on Muluna and placing ghost belts on top of ghost belts. The net result is no change. However, holding the mouse button down and dragging the mouse around causes a SIGNIFICANT increase in processing time. It's effectively possible to denial-of-service the server by placing ghost belts on top of themselves.

I do not know if your mod is specifically responsible at current time, but yours stands out as one of four contributors to this problem.

https://youtu.be/zToIFnLUa1U

5 days ago

Thanks for reporting this! Would you be able to share the save file?

5 days ago

Tracking issue here

5 days ago
(updated 5 days ago)

Okay I happened to notice that all four of these mods list bplib as a dependency, and one of the functionalities of bplib is to be able to execute some logic on entities when blueprints are placed. In particular, it has logic for finding all existing entities that had a blueprint entity pasted on top of it (this is surprisingly difficult to do, which is why mods use bplib). I'm pretty confident the lag for all these mods is caused by doing that relatively expensive logic each time a blueprint is placed.

5 days ago

Seems a likely culprit! The discovery on this came about from someone else observing a significant CPU increase whenever they placed something. I think the game they're in is borderline overwhelming their computer. After some diagnostics, we landed on four potential culprits and ran out of time to diagnose further. A couple things I find interesting - that it doesn't care if there is no change when the blueprint is applied, and that it's affecting vanilla items.

Would you still like the save file? https://drive.google.com/file/d/1-j-Ep95yHfKcIw0MMyos4_r1JIXzqWDr/view?usp=drive_link

5 days ago
(updated 5 days ago)

Yes, thanks for the save file!

It makes sense that the lag would happen irrespective of any entities changing or of whether they're vanilla entities. The event data for a blueprint being placed doesn't contain information about entities; instead, to find any potentially affected entities, the code needs to search the full area over which the blueprint was placed. It also indexes these entities against their respective blueprint entities by position. So the only way for the mod code to know if an entity it cares about was affected is to go through that relatively expensive search process.

I expect this will be basically unfixable. There might be some possible optimizations, but a bigger blueprint is probably all it would take to negate any improvements. And it can even happen in vanilla, e.g. when placing those crazy overlapping rail blueprints (assuming that trick still works in 2.0).

Hello -- I am in the process of adding some mitigations to BPlib that will improve this situation: https://github.com/project-cybersyn/bplib/issues/7#issuecomment-4620926788

As you say, it will never be perfect; unfortunately calculating geometry is not free. But it can be improved. Let me know if you're willing to help test before I release the new API to the portal.

3 days ago

I've updated Rigor Module to use bplib 2.0, so this should be fixed in the next release.

New response