Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add --force-try-crdt to try to download main crdts from optimiz… #517

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions godot/src/logic/scene_fetcher.gd
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const ASSET_OPTIMIZED_BASE_URL: String = "https://storage.kuruk.net"
#const ASSET_OPTIMIZED_BASE_URL: String = "http://localhost:3232"

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 @@ -60,6 +61,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 @@ -380,6 +384,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

var scene_hash_zip: String = "%s.zip" % scene_entity_id
var asset_url: String = "%s/%s.zip" % [ASSET_OPTIMIZED_BASE_URL, scene_entity_id]
var download_promise: Promise = Global.content_provider.fetch_file_by_url(
Expand Down
Loading