Improve how quickly world generation responds to changed location

This commit is contained in:
James Seibel
2023-05-21 18:41:34 -05:00
parent 041c2ad5d7
commit c539a3f3be
@@ -47,6 +47,15 @@ public class BatchGenerator implements IDhApiWorldGenerator
private static final IWrapperFactory FACTORY = SingletonInjector.INSTANCE.get(IWrapperFactory.class);
private static final Logger LOGGER = DhLoggerBuilder.getLogger();
/**
* Defines how many tasks can be queued per thread. <br><br>
*
* TODO the multiplier here should change dynamically based on how fast the generator is vs the queuing thread,
* if this is too high it may cause issues when moving,
* but if it is too low the generator threads won't have enough tasks to work on
*/
private static final int MAX_QUEUED_TASKS = 5;
public AbstractBatchGenerationEnvironmentWrapper generationGroup;
public IDhLevel targetDhLevel;
@@ -136,7 +145,7 @@ public class BatchGenerator implements IDhApiWorldGenerator
@Override
public boolean isBusy()
{
return this.generationGroup.getEventCount() > Math.max(Config.Client.Advanced.Threading.numberOfWorldGenerationThreads.get().intValue(), 1) * 40; // TODO the multiplier here should change dynamically based on how fast the generator is vs the queuing thread, if this is too high it may cause issues when moving, but if it is too low the generator threads won't have enough tasks to work on
return this.generationGroup.getEventCount() > Math.max(Config.Client.Advanced.Threading.numberOfWorldGenerationThreads.get().intValue(), 1) * MAX_QUEUED_TASKS;
}