Best way to dynamically load assets

#1

Does defold support dynamically loading assets? I intend to use quite a few really hi-res graphics (4k graphics) for my next game (I have to use hi-res since svg isn’t supported), and I would like a better loading system than just a ten-second lag on program launch.
Thanks!

1 Like

#2

Yes! Live update is what you’re looking for:

I used it in an HTML5 game, it worked great. For apps you have to store the content on a server, all explained in the docs above.

3 Likes

#3

Can I self-host instead of using AWS?

0 Likes

#4

Which platform(s) are you targetting?

1 Like

#5

Desktop and mobile (not web, but dealing with large number of massive assets)

0 Likes

#6

For desktop you might be able to store them locally, but not sure if that makes sense. For mobile I believe the only option is AWS.

1 Like

#7

zip isn’t supported on mobile?

0 Likes

#8

You can self host your files on any file server (not just AWS).

Not sure what other users use though. @pkeod @agulev, do you have any suggestions?

1 Like

#9

how do I do that? is there a hidden “other” option in live update?

0 Likes

#10

You export to “.zip” as you mentioned.
Then (regardless of AWS or not), you will need to load these files from a file server. The .zip contains the files that the live update will request later on.

1 Like

#11

You can try it with a local python server, e.g. “python m SimpleHTTPServer”, which will give you a file server (from the current directory), at “http://localhost:8000

1 Like

#12

I think there was a misunderstanding in the original post. @grify is not needing live update features but instead needing to use collection proxies to not load everything at once. https://defold.com/manuals/collection-proxy/

Use Monarch and only reference the atlases you need on the screens they are mentioned on. This makes it easy for general assets, you load between screens.

We have 50+ location backgrounds often in our games, these are loaded and unloaded dynamically with collection proxies too. So max there are 2 loaded at once and they are usually swapped between screens.

What do you mean by 4k graphics? You should know that max texture size matters a lot especially on mobile you should try to keep atlases at least below 2048, but even targeting 1024 is also a good idea. This can be done with texture profiles.

6 Likes