From 83b4071fe5b65d3a117c51c061c6def997b0e5b1 Mon Sep 17 00:00:00 2001 From: "Mateo \"Kuruk\" Miccino" Date: Sun, 1 Dec 2024 10:04:51 -0300 Subject: [PATCH] feat: add --force-try-crdt to try to download main crdts from optimized database --- godot/src/logic/scene_fetcher.gd | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/godot/src/logic/scene_fetcher.gd b/godot/src/logic/scene_fetcher.gd index 3f293f4e..b49d7795 100644 --- a/godot/src/logic/scene_fetcher.gd +++ b/godot/src/logic/scene_fetcher.gd @@ -21,6 +21,7 @@ const EMPTY_SCENES = [ ] const ADAPTATION_LAYER_URL: String = "https://renderer-artifacts.decentraland.org/sdk6-adaption-layer/main/index.min.js" +const CRDT_DATABASE_BASE_URL: String = "https://psquad.kuruk.net/localstack/crdts/" const FIXED_LOCAL_ADAPTATION_LAYER: String = "" @@ -57,6 +58,9 @@ var _debugging_js_scene_id: String = "" var _bypass_loading_check: bool = false +# try optimized main crdt +var _force_try_crdt = OS.get_cmdline_args().has("--force-try-crdt") + func _ready(): Global.realm.realm_changed.connect(self._on_realm_changed) @@ -377,6 +381,20 @@ func async_load_scene( ) return PromiseUtils.resolved(false) + # try optimized main crdt + if _force_try_crdt: + var main_crdt_hash = scene_entity_id + ".crdt" + var url = CRDT_DATABASE_BASE_URL + main_crdt_hash + var promise: Promise = Global.content_provider.fetch_file_by_url(main_crdt_hash, url) + + var res = await PromiseUtils.async_awaiter(promise) + if res is PromiseError: + prints("No CRDT found in the optimized database url =", url) + else: + prints("CRDT found in the optimized database! url =", url) + main_crdt_file_hash = main_crdt_hash + local_main_crdt_path = "user://content/" + main_crdt_file_hash + # the scene was removed while it was loading... if not loaded_scenes.has(scene_entity_id): printerr("the scene was removed while was loading ", scene_entity_id)