Skip to content
Daan van Yperen edited this page Aug 10, 2015 · 5 revisions

TimeboxedProcessingSystem

Processes entities until time runs out. Continues where it left off next invocation.

Usage

Drop in replacement for EntityProcessingSystem.

Best used to time constrain and spread out high numbers of small or predictable entity operations, while maximizing throughput.

System runtime can overrun by (at most) one full entity operation.

Example

public class MyExpensiveSystem extends TimeboxedProcessingSystem {

	@Override
	protected void process(Entity e) {
		doAction(e);
	}

	@Override
	protected float getAllottedTime() {
		return 0.005f; // run for 5ms
	}

}