Dynamic resource loading (HTML build)

Greetings everyone!
I’ve come up with the problem when trying to implement the following stuff:

A browser game with multiple levels. There is a small menu with the level list. Player chooses the level, the level loads up.

Thus, on the first launch the user loads a minimum amount of data (the menu and the resources it uses). Then we load a level with the necessary resources on a request (the resources load up when it needed).

I used a collection proxy to implement it. But while testing I’ve faced a really long first launch (the levels themselves were loading instantly). I think all data was loaded on the first launch.

Can I make such thing possible with Defold? Am I missing something?

That is exactly what collection proxies are intended to solve. Since all dependencies are static the engine loads only what is in a collection. What does your main collection contain? Do you have a “custom_resources” setting?

Thanks for the quick response. My main collection contains gui, collection proxy and the script that loads the collection itself.


And no, I don’t have “custom resources” setting. As I understand, the file should be specified in it.
Please, can you elaborate what file is it? And what it should contain? Thanks in advance for your help.

You probably should not have any custom resource setting. I asked because I think what’s specified there gets loaded at startup.

I’ll check with the core team about this. It may be something related to HTML5. I’ll get back to you.

Many thanks, I will be eagerly waiting for your answer.

1 Like

Hey! Quick question, are you running on Windows? I suspect this has something to do with this issue, essentially related to bundles from Windows builds.

There is a fix coming for this.

edit: Oooops, my bad! I was a bit trigger happy on this one, I interpreted it as not working at all to load resources on HTML5, but the real problem was the long loading times…

1 Like

This is what’s happening:

  • The engine loads the archives to the local client storage.
  • The proxies load content from “disk” (local storage) into memory.

So this is due to how the engine works on HTML5. There is unfortunately no support at the moment for streaming collections over network.

2 Likes

A pity. Thanks for your help.

1 Like