Zylann / voxelgame

Voxel world prototype made with Godot Engine
Other
512 stars 83 forks source link

How do saving works? #85

Open Favkis opened 3 years ago

Favkis commented 3 years ago

Can't seem to find how it works and how do I reset save?

Zylann commented 3 years ago

This relates to VoxelStream, which is a part of the voxel engine that remains to be documented.

Currently in the blocky_game, the terrain is continuously streamed block by block (where "block" is a 16x16x16 chunk) and saved to files under a folder. Currently it uses VoxelStreamRegionFiles so the format is similar to Minecraft: a bunch of region files, where each contains a bunch of blocks. The path to this directory is set in the editor, but could be set at runtime if necessary (as long as it's done before the scene runs). Depending on the settings, blocks get saved:

To reset a save, deleting the contents of the folder or changing the path to another folder will make it go back from scratch.

LVLRGames commented 1 year ago

where might one find more detailed instructions on how to set up a voxelStreamSqlite? I've been at it for 3 days and cant get voxel tools to locate the database file. What would a correct example of a database path look like?
What is it relative to? What file extension should the database file be saved in ?

Zylann commented 1 year ago

The path must be a file inside an existing directory. The file will be created if it does not exist. The path must not be relative to res://, and currently doesnt support user:// (though there might be a way to convert). I think file extension doesn't matter, but I've been using .sqlite.

This is indicated in the doc https://voxel-tools.readthedocs.io/en/latest/api/VoxelStreamSQLite/#i_database_path

The schema of the database itself is documented here: https://voxel-tools.readthedocs.io/en/latest/specs/sqlite_format/ But it is generated automatically when the file is created.

WithinAmnesia commented 4 months ago

This relates to VoxelStream, which is a part of the voxel engine that remains to be documented.

Currently in the blocky_game, the terrain is continuously streamed block by block (where "block" is a 16x16x16 chunk) and saved to files under a folder. Currently it uses VoxelStreamRegionFiles so the format is similar to Minecraft: a bunch of region files, where each contains a bunch of blocks. The path to this directory is set in the editor, but could be set at runtime if necessary (as long as it's done before the scene runs). Depending on the settings, blocks get saved:

* Straight after being generated, if `save_generator_output` is enabled on the stream

* They get out of range and had changes

* `VoxelTerrain.save_modified_blocks()` is called, typically used before quitting the game

To reset a save, deleting the contents of the folder or changing the path to another folder will make it go back from scratch.

How do we make multiplayer saves happen?

How does the chunk data get saved and how can the server get and save and access the chunk data / big array of chunks?

How can this be simplified if its top down 2D as in just tiles? This is the only working multiple client voxel multiplayer game with Godot engine example. I have tested hundreds of demos and projects.

Is there documentation / where should one look? Where does one find or how to make multiplayer saving work and get it working with an example to learn from?https://voxel-tools.readthedocs.io/en/latest/overview/#saving-voxels-to-disk or https://voxel-tools.readthedocs.io/en/latest/api/VoxelStreamSQLite/#i_database_path or https://voxel-tools.readthedocs.io/en/latest/search.html?q=save what are the data saving options and what are your thoughts and suggestions? What would work well for a 2D array for example and or ~2K-16K players in a simplified top down open-world on the same server? What are multiplayer and server save game data options? What should be done?

This would help myself and others and the entire community make massive multiplayer games with a working multiple client multiplayer seamless chunk system that can work in all cases from 2D, 2.5D, 3D and static and dynamic for this project is a 3D dynamic open-world. If we can get the multiplayer saving to hard-drive / folder and then to have the server load up the same saved dynamic world chunk data just like Minecraft then we are have a massive success.

What are your thoughts and suggestions? What should be done to solve this puzzle? All feedback is welcome.

WithinAmnesia commented 4 months ago

https://github.com/Zylann/voxelgame/issues/100#issuecomment-1955712346 This can solve this issue and it can be close for we figured out how to do a somple but sure fire way for multiplayer saving.