Hi everyone!
Quick question! I’m running NullEngine server side with Bun, and I’m trying to optimize my CPU usage, since servers cost money ![]()
I’m struggling to understand how to run the render loop correctly with lower fps. Usually the loop target I guess is 60fps, but I would like to try it 20fps so I guess the cpu time would be less.
Here is the basic initialization code I use now to try and get things 20fps:
const options: NullEngineOptions = {
renderHeight: 0,
renderWidth: 0,
textureSize: 0,
lockstepMaxSteps: 4,
deterministicLockstep: true,
timeStep: 1 / 20,
}
this.engine = new NullEngine(options)
this.scene.executeWhenReady(async () => {
this.engine.runRenderLoop(() => {
// Run logic systems here
// This prints ~30-34
console.log(this.engine.getFps().toFixed())
// Render
this.scene.render(false, false)
})
})
Can someone instruct how I would manage to do this, would be fun to try something like running the server 10fps and see what happens
I am also using physics and recast navigation on server side.
It seems that whatever I now do, the engine.getFps() seems unchanged… Also, is the this.engine.maxFPS = 20 not usable in the null engine?
Thanks in advance ![]()