How to make the HTML5 loader more resilient on slower connections?

#1

A sample from @dev-masih he said he tested in incognito mode right after, which means it’s probably not only a problem with our CDN.

What do I need to change in the project to make the loader try more times / try longer when it is having trouble loading the project file segments?

1 Like

#2

And an error message for when something goes wrong with loading process is necessary.

1 Like

#3

A sample from @Dragosha

This is the link for testing

0 Likes

#4

From `dmloader.js?:

    * 'extra_params' is an optional object that can have the following fields:
    *
    *     'archive_location_filter':
    *         Filter function that will run for each archive path.
    *
    *     'unsupported_webgl_callback':
    *         Function that is called if WebGL is not supported.
    *
    *     'engine_arguments':
    *         List of arguments (strings) that will be passed to the engine.
    *
    *     'persistent_storage':
    *         Boolean toggling the usage of persistent storage.
    *
    *     'custom_heap_size':
    *         Number of bytes specifying the memory heap size.
    *
    *     'disable_context_menu':
    *         Disables the right-click context menu on the canvas element if true.
    *
    *     'retry_time':
    *         Pause before retry file loading after error.
    *
    *     'retry_count':
    *         How many attempts we do when trying to download a file.
    *
    *     'can_not_download_file_callback':
    *         Function that is called if you can't download file after 'retry_count' attempts.

and, in your engine_template.html, modify this section to add your extra params:

	var extra_params = {
		archive_location_filter: function( path ) {
			return ("{{DEFOLD_ARCHIVE_LOCATION_PREFIX}}" + path + "{{DEFOLD_ARCHIVE_LOCATION_SUFFIX}}");
		},
		engine_arguments: [{{#DEFOLD_ENGINE_ARGUMENTS}}"{{.}}",{{/DEFOLD_ENGINE_ARGUMENTS}}],
		custom_heap_size: {{DEFOLD_HEAP_SIZE}},
		disable_context_menu: true
	}
1 Like

#5

Please, pay attention to this section of HTML5 manual: https://defold.com/manuals/html5/#extra-parameters
retry_time and retry_count parameters

2 Likes

#6

Do you have a suggestion for these setting values? What are the defaults? What is the retry time in? Seconds?

Looks like these are the default values?

            retry_time: 1, 
            retry_count: 10,

Also retry_time is multiplied by 1000 so probably seconds?

I’m going to try

		retry_time: 3,
		retry_count: 20
1 Like

#7

Please repor with results! We’re happy to update the defaults if it helps. Also if anyone want to take a stab at the loader code itself we can integrate the changes as well.

2 Likes

#8

Previous numbers did not seem high enough, next build I will test

		retry_time: 6,
		retry_count: 25

If this does not help probably something else needs to change too.

0 Likes