VoxelStreamSQLite

Inherits: VoxelStream

Saves voxel data into a single SQLite database file.

Properties:

Type Name Default
String database_path ""
CoordinateFormat preferred_coordinate_format COORDINATE_FORMAT_STRING_CSD (2)

Methods:

Return Signature
bool is_key_cache_enabled ( ) const
void set_key_cache_enabled ( bool enabled )

Enumerations:

enum CoordinateFormat:

  • COORDINATE_FORMAT_INT64_X16_Y16_Z16_L16 = 0 --- Coordinates are stored in a 64-bit integer key, where X, Y, Z and LOD are 16-bit signed integers.
  • COORDINATE_FORMAT_INT64_X19_Y19_Z19_L7 = 1 --- Coordinates are stored in a 64-bit integer key, where X, Y and Z are 19-bit signed integers, and LOD is a 7-bit unsigned integer.
  • COORDINATE_FORMAT_STRING_CSD = 2 --- Coordinates are stored in strings of comma-separated base 10 numbers "X,Y,Z,LOD".
  • COORDINATE_FORMAT_BLOB80_X25_Y25_Z25_L5 = 3 --- Coordinates are stored in 80-bit blobs, where X, Y and Z are 25-bit signed integers and LOD is a 5-bit unsigned integer.
  • COORDINATE_FORMAT_COUNT = 4

Property Descriptions

String database_path = ""

Path to the database file. res:// and user:// should work, however res:// will not work after export (see why here). The path can be relative to the game's executable. Directories in the path must exist. If the file does not exist, it will be created.

CoordinateFormat preferred_coordinate_format = COORDINATE_FORMAT_STRING_CSD (2)

Sets which block coordinate format will be used when creating new databases. This affects the range of supported coordinates and how quickly SQLite can execute queries (to a minor extent). When opening existing databases, this setting will be ignored, and the format of the database will be used instead. Changing the format of an existing database is currently not possible, and may require using a script to load individual blocks from one stream and save them to a new one.

Method Descriptions

bool is_key_cache_enabled( )

(This method has no documentation)

void set_key_cache_enabled( bool enabled )

Enables caching keys of the database to speed up loading queries in terrains that only save sparse edited blocks. This won't provide any benefit if your terrain saves all its blocks (for example if the output of the generator is saved).

This must be called before any call to load_voxel_block (before the terrain starts using it), otherwise it won't work properly. You may use a script to do this.

Generated on Jan 26, 2026