Zylann / godot_voxel

Voxel module for Godot Engine
MIT License
2.71k stars 251 forks source link

Save the world #625

Open JekSun97 opened 7 months ago

JekSun97 commented 7 months ago

I'm writing a game where you can move from one planet to another, but the movement occurs instantly, since there are no functions for generating planets in a spherical shape. How can I save the generated world with all the buildings and changes, I’m new to Godot 3D functions, but not 2D, how can I save the world so that when I return to the planet everything will be the same?

Zylann commented 7 months ago

there are no functions for generating planets in a spherical shape.

This demo was made with this module: https://www.youtube.com/watch?v=uzjHcIbDXJQ Generators can fill voxel chunks they are given in any way they like, including the use of a spherical SDF shape. Now obviously that might not work well for cubic voxels, but smooth voxels can handle that just fine (though that's still a non-negligible amount of work to get something like this going). If you are using cubic, then yeah, there is no magic to somehow project them spherically.

How can I save the generated world with all the buildings and changes

You attach a stream resource to the terrain and it will save asynchronously: https://voxel-tools.readthedocs.io/en/latest/streams/

I’m new to Godot 3D functions

Note that this module is a lot more complex than the average Godot 3D functions, so if you're new to Godot or even programming you might want to get some more experience before diving into it. Asynchronous processing, streaming and threads are involved.

JekSun97 commented 7 months ago

@Zylann Thanks for the information, no, I’m not new to programming, I have a good 2D/3D engine written in C++ and OpenGL 3+, but I haven’t studied Godot’s 3D functions yet, I only started thanks to your plugin :)

My world is cubic, but if I manage to do something, I will definitely share, you may have to use a matrix with shaders.

JekSun97 commented 7 months ago

And as for the demonstration of a spherical planet, it’s just super!

We need at least a similar example of such capabilities, this will open up a full-fledged new genre of games for such an engine as the Godot Engine!

Zylann commented 7 months ago

There is already an issue open for navigation: https://github.com/Zylann/godot_voxel/issues/610#issuecomment-2067153475