if you want to update something 60 times a second, then it’s trivial to do so. This is why people are telling you that it’s basic java and that your argument is moot.
float delay = 1f / 60f;
float currentDelay = 0f;
@Override
public void update(float tpf) {
currentDelay += tpf;
if (currentDelay < delay) {
return;
}
currentDelay = 0f;
// anything past here is run once every 60th of a second, or at 60fps if you want to call it that.
doSomethingAt60fps();
}
Regarding the Panda Task that you specified - it pretty much describes an AppState with a choosable update period. The “Task Manager” that you speak of is the AppStateManager.
So let’s digress, for the sake of sanity itself. There are two objects below. An UpdateSpeed Enum and an UpdateMonitor class.
public enum UpdateSpeed {
FPS_120(1f / 120f),
FPS_60(1f / 60f),
FPS_30(1f / 30f),
FPS_20(1f / 20f),
FPS_10(1f / 10f),
FPS_5(1f / 5f),
FPS_2(1f / 2f);
private final float delay;
UpdateSpeed(float delay) {
this.delay = delay;
}
public float getDelay() {
return this.delay;
}
}
public class UpdateMonitor {
private UpdateSpeed speed;
private float currentDelay;
public UpdateMonitor(UpdateSpeed speed) {
this.speed = speed;
}
public boolean update(float time) {
this.currentDelay += time;
if (this.currentDelay >= speed.getDelay()) {
this.currentDelay = 0f;
return true;
}
return false;
}
public UpdateSpeed getSpeed() {
return this.speed;
}
public void setSpeed(UpdateSpeed speed) {
this.speed = speed;
}
}
Useage:
private UpdateMonitor updateMonitor = new UpdateMonitor(UpdateSpeed.FPS_60);
@Override
public void update(float tpf) {
if (!updateMonitor.update(tpf)) {
return;
}
doSomething();
}
This does exactly as you want. It updates at whatever speed you choose in the UpdateMonitor constructor. I use this myself to limit GUI updates. Sometimes the GUI only needs to be updated 5 times a second, and not at the current frame rate.
But to get back on point - this is not the Panda engine. Different engines work in different ways - but they are essentially the same in design, it’s just done differently. People are sugguesting you read the tutorials - not because you are an idiot - but so that you understand how this engine works.