Hi everyone!
Quick question; I am trying to optimize my server code once again for cpu usage. It is a bit difficult since with Bun I cannot get a debug inspect mode that I used to rely on with Node. Also JavaScriptCode might behave a bit differently than V8. But anyways…
I am running null engine and the engine instrumentation gives me
Active Meshes Evaluation: 4.60ms
This is not that much, server is running 20tick per second so there is 50ms time to handle the frame. I’m just wondering if this number is correct since my assumption would be that null engine is not checking the active meshes, since pretty much every mesh should be active as the server acts more as an all seeing eye…
But the number still worries me since it might be costly to cpu.
What I would like to be able to do:
- Tell globally to the scene that I want all the meshes to be active OR
- Customize the activity checking so that it is very simple like “mark active if near player” (can frame graph do this?)
I think you can also mark meshes individually as always active, but does this work with hierarchial meshes? Also, my server engine has the performance priority set as aggressive.
Here are things I have done so far & my initialization code:
console.time('server-game-manager: null-engine-booted')
const options: NullEngineOptions = {
renderHeight: 0,
renderWidth: 0,
textureSize: 0,
lockstepMaxSteps: 4,
deterministicLockstep: true,
timeStep: 1 / 20,
}
this.engine = new NullEngine(options)
console.log('server-game-manager: null engine time step', this.engine.getTimeStep())
this.engine.disablePerformanceMonitorInBackground = false
this.scene = new Scene(this.engine)
this.scene.skipPointerMovePicking = true
this.scene.autoClear = false
this.scene.useRightHandedSystem = true
this.scene.performancePriority = ScenePerformancePriority.Aggressive
this.scene.skipFrustumClipping = true // If you don't need precise culling
this.scene.freezeActiveMeshes(true)
// Camera
this.camera = createCamera(this.scene)
console.timeEnd('server-game-manager: null-engine-booted')