Sharing User Modified Scenes

I’m working on a prototype of a “world-building” type game where players can build a small park to include trees, rocks, bridges, etc. I would also like to have the ability to share these “levels” with others.

Is there a way to export out a version of a scene and use that within a more generic Babylon “template” that takes in a scene to load? Not just the meshes/textures, but anything else that may include logic such as areas that detect mesh intersections, or 3d audio (like birds or water). Is this possible with BabylonJS?

JavaScript provides a built-in JSON object for parsing and serializing JSON data. You can use the JSON.stringify() method to convert your JSON objects into their string representation, and then use the file system fs module to write it to a file.
To retrieve and parse JSON data from a file back to a JSON object, you can us the fs.readFile() method along with JSON.parse for deserialization.
Basically, you need to define which objects you will allow to save within a given template. Then serialize them to JSON to save. For external files reference use their URLs.

1 Like

Thanks! I ended up finding this when searching for serialization in BabylonJS: Save Your Scene or Meshes | Babylon.js Documentation