Skip to content

Commit

Permalink
feat: add --force-try-crdt to try to download main crdts from optimiz…
Browse files Browse the repository at this point in the history
…ed database
  • Loading branch information
kuruk-mm committed Dec 1, 2024
1 parent fed6167 commit 83b4071
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions godot/src/logic/scene_fetcher.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""


Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 83b4071

Please sign in to comment.