Hi I have a dictionary called saved_tile which store the position as key and the tiles is ,atlas cord ,flip_h etc as it's data like this
{"tile_id": 31, "atlas_cord": (0, 0), "flip_h": false }, (-2764, 4108): { "tile_id": 31, "atlas_cord": (11, 9), "flip_h": false }, (-2763, 4111): { "tile_id": 31, "atlas_cord": (17, 6), "flip_h": false }, (-2764, 4114):
This dictionary is very very large and is growing as the player is exploring the world whi I save this dictionary which happens every 30 second there is a huge lag spike this is the func I use to save the var
func save_binary_file(data: Dictionary, path: String) -> void:
var file = FileAccess.open(path, FileAccess.WRITE)
if file:
file.store_var(data) # Save dictionary in binary format
file.close()
#print("Binary save successful:", path)
else:
print("Failed to save binary data to:", path)
Is there any different way of saving the var with less lag JSON lags a lot binary also stops the game for like a second