Just a quick question about the best way to determine NullEngine fps. I just would like to assure that the engine runs in a stable fps all the time… Not sure if the best way is to console log the engine.getFps().toFixed() what I tried to do just a few minutes ago … Any tips for this?
Also a continuation why I’m asking; getting a fluctuating NullEngine fps of ~40, even though it is supposed to run at 60 fps…
Hmmm, it is a bit hard pickle. I do have a lot of instanced meshes in the scene, but somehow I thought that not actually rendering would not eat my performance so much… Here is even bigger picture:
at least in node you could freezeActiveMeshes() on the scene to bypass your biggest cost. Babylon is actually CPU bound so I am not surprised your frames are pretty similar.
Now the bottleneck seems to be the Recast blackbox. I guess the animation section might be in relation with this as well, as I should have disabled all the animations in the server side I’m kind of curious how much power the crowd calculation is taking since there is just one agent standing, not doing anything
^ That is the idle animation of my main character… Is there a global way to destroy/stop all animations in the scene? Currently trying to do this in every turn and it is not doing the trick:
let animations: AnimationGroup[] = task.loadedAnimationGroups
if (animations && animations.length > 0) {
animations.forEach((animationGroup: AnimationGroup) => {
animationGroup.stop()
})
}
Seems as if the initial animations cannot be stopped… Weird.
But yeah there is also the Recast thing I would like to get some insight on
Do you think the newer Recast version could help with performance?
Also I noticed that I should probably strip the models off their materials… Don’t really need the PBR calculations on the server side, right? Is there some global way to do this, or do I have to tinker with the models by hand?
All in all this was a pretty cool investigation. If someone stumbles here trying to debug the NullEngine, some tips:
Use the engine.getFps().toFixed() to get the fps
Use the node --inspect handle to start Node.js in debug mode, then you can use the Chrome devtools to debug your Babylon stuff.
Do not use actual models/meshes in server side / NullEngine unless it is needed for some reason, for example I have map tiles that are shaped in certain way and cannot be substituted with placeholder meshes.
Stop the animations of the loaded models and make sure they are stopped. No need to animate models server side, but they might auto-play when imported.
Remove expensive materials (pbr in my case) from loaded models.
Try to think if you can freezeActiveMeshes on the server side. For example, my game map is composed of a lot of instanced meshes, so I could easily freeze them after creation.
Also use the latest package versions at all times
Thank you @sebavan and @Cedric for your time and help as well!