Is it feasible to load external assets (I.E. custom zones) while the game runs?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By iao

Hey, I was wondering if it’s currently conventionally feasible to pull off the following idea.

A game and an accompanying app, both Godot-powered, that allow you to load zones from external files.
The accompanying app would be the zone editor (akin to the Warcraft III World Editor), allowing users to design and export zone files.
The game, while running, loads a zone from a file, verifies that it is compatible, generates the zone if it is, the player goes into it to complete the zone’s included objectives, and the player leaves it to go another zone when finished.

The most basic version of this could be say, a 2D game with custom zones utilizing assets included within the core game client, generated and shared as text files.
A more advanced version could be a 3D game with custom zones made up of internal and custom assets and scripting, generated and shared as compressed archive files (if necessary).
Is either infeasible, and if so, where in the spectrum between the two does it become infeasible?

Keep in mind I’m not talking about the standard usage of PCK files, but I’d be interested if they can be used in a nonstandard way to achieve the aforementioned functionality.

:bust_in_silhouette: Reply From: Yuminous

You can theoretically load anything you want with scripts as long as you have a "res://" or "user://" path and Godot accepts that file format. Like for example:

The user picks an option from a Control menu to load a new level scene CustomZone1.tscn from a file — (but that file could also get downloaded from a server first) then with some function in the main scene you can run:

var loaded_scene = load("user://downloads/CustomZone1.tscn").instance()
add_child(loaded_scene)

Or say a PNG image sprite_image.png (convoluted example):

var a = "png"
var b = "sprite_image"
var c = "res://" + a + "." + b
var abc = load(c)

Now naturally with servers / downloaded files your end result will be both much more complex and also very abstract. Your end solution has to be very adaptable and very secure because of how networking is.

But to the question “Is it feasible?”

Yes!

Thanks, Yuminous. Now for me to find out exactly how complex I want to get with it.

iao | 2021-07-15 14:31