Hey, I have a doubt about my implementation on the SPS in my game.
The problem:
I have a scene, X,Y,Z with blocks.
Client asks Server for chunks (16x16) as they move around the world.
User freezes a second each time a new chunk is built or modified.
Users need to be able to place and remove blocks.
- I use only one material, is an atlas with a bunch of 32x32 pixels textures.
- I decided each chunk to have its own SPS, to avoid rebuilding the entire world mesh on each chunk update. (not sure if ok)
Chunk.SPS:
this._SPS = new SolidParticleSystem(
`sps_${x}_${z}`, this._scene, {
isPickable: true,
expandable: true,
updatable: true
});
material.diffuseTexture = textureAtlas;
SPS.mesh.material = material;
Chunk.Blocks
For each Block in Chunk.blocks, I create a disposable box.
const opts = { faceUV: [Vector4, Vector4, Vector4...])
const box = MeshBuilder.CreateBox(`box`, opts, this.scene);
this.chunk._SPS.addShape(box, 1);
box.dispose();
then I build the mesh once:
this.chunk._SPS.buildMesh();
Is it normal for the scene to freeze entirely during the built?
I dont see it to be happening in this PG here, they all continue to spin.
Is not that the building of the chunk is taking too long, it seems reasonable but id expect the user to be responsive in the meanwhile.
Can’t reproduce in PG, is it a loop-related-thing I ignore?
Thank you.
Edit to add video evidence:
Basically you stop for a second every time you walk over a chunk limit, which is annoyingly noticeable.
(You may recognize a model from orion3dgames/t5c as I needed a quick boilerplate)