Super Circuit Maker

Super Circuit Maker

14M Downloads

Lag caused by render

KindarConrath opened this issue ยท 4 comments

commented

Minecraft: 1.18.1
Forge: 39.0.8
SCM2: 0.0.3
Tested with other mods: just JEI

2021-12-23_20 17 46

commented

Yep. This is a thing. Not really a bug, but circuit rendering is "just working" for the time being.

I plan on investing a lot more time into testing and optimizing to try to get the rendering code to be as efficient as possible in the near future, but for now it's bundled with chunk rendering, so any updates to the chunk the circuit is in will trigger the whole circuit to re-render and vice versa, which understandably can be a bit heavy.

I'll keep this issue open to log development progress around this topic.

commented

I have encountered this issue as well, though I am very confident that the cause is a completely different one:
2021-12-24_21 14 02
Putting the circuit in the screenshot together with a running piston clock in the same chunk doesn't influence my frame rate at all.
But as soon as my crosshair enters the block space of the circuit (even the empty area), my FPS crash from 120 down to 1.
The most likely cause of this is here: https://github.com/TechnicalitiesMC/SuperCircuitMaker/blob/main/src/main/java/com/technicalitiesmc/scm/block/CircuitBlock.java#L163-L194. Calculating a VoxelShape is a really expensive operation and you are building the shape from scratch multiple times per frame due to the many things that call Block#getShape().

The versions are exactly the same as OP's, with the only difference being that I don't have JEI installed.

commented

That is a very good point.
It's an optimization I was planning to make soon-ish, but I'll push it up the priority list.