When creating a terrain of feature using randomness, we need a way to ensure online players see the same terrain.
For example, in the floor is lava demo, the islands are generated randomly during loading time, using Math.random().
for(let i=0; i<35; i++) {
let position = new THREE.Vector3(Math.random() * 800 - 400, 0, Math.random() * 1000);
virtualEnvironment.newSolidGeometriesFromSource('../../../resources/objects/rock_platform.glb', position.x, position.y, position.z, Math.random() * 20 + 4);
}
The problem with this generation technique: every user gets a different world since the randomness is not seeded.
To solve this, we need a seedable random number generator so we can insure that every users get the same result when entering a world with randomness features.
When creating a terrain of feature using randomness, we need a way to ensure online players see the same terrain.
For example, in the floor is lava demo, the islands are generated randomly during loading time, using
Math.random()
.The problem with this generation technique: every user gets a different world since the randomness is not seeded.
To solve this, we need a seedable random number generator so we can insure that every users get the same result when entering a world with randomness features.