Skip to content

Commit

Permalink
Big Todo
Browse files Browse the repository at this point in the history
  • Loading branch information
Desoroxxx committed Dec 1, 2023
1 parent 0883ac5 commit 5d30bb1
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ private boolean disableVanillaLightUpdates(final Set<BlockPos> instance) {
return;

final Iterator<BlockPos> iterator = setLightUpdates.iterator();
final float lightUpdateLimit = 2048 + ((float) setLightUpdates.size() / 4);
final float lightUpdateLimit = 2048 + ((float) setLightUpdates.size() / 4); // Todo: Rework this once again, this is currently pretty dumb.
// It fixed the issue where the FPS on lower end hardware would plummet for a few seconds.
// But it also reduced how smooth the frame rate was on higher end hardware.
// Updating blocks is costly and will take a long time, this is why lower end hardware plummets for a few seconds.
// Higher end hardware instead has somewhat of a FPS "buffer" which can handle it fine over multiple frames thus reducing frame-time spikes.
// The technically the best way to do this (that I hadn't though of before) was to add current "FPS" to the equation.
// If the FPS is low more updates would be done in one frame if it is high we can afford spreading light updates over multiple frames.

short lightUpdatesProcessed = 0;
while (iterator.hasNext() && lightUpdatesProcessed < lightUpdateLimit) {
Expand Down

0 comments on commit 5d30bb1

Please sign in to comment.