Music Stops/HTML5 Version/Switching Collection Proxy(NOT SOLVED)

Hi,

We built an HTML5 version of our current Defold game project.
We ran the HTML5 version on Microsoft Windows 10 Pro 64Bit.

We tried Edge, Firefox, Chrome, & Opera Internet browsers.
While the HTML5 version ran on all 4 above Internet browsers we have audio issues:
When switching scenes, the music stops for about 1/2 a second?

Any ideas on how to solve above audio issue on HTML5 version on Windows 10?
Our working Frames Per Second counter shows the game running full speed (60 FPS).
Let us know, thanks!

You can visit below URL link to run the HTML5 version in your Internet browser:
http://fallenangelsoftware.com/stuff/files/RedLightRacer/HTML5/js-web/RedLightRacer/index.html

PS - Game is open-source, if you would like to download the full project then visit below URL link:

Jesse

EDIT #1:
I Google’d and found:
(async_load)

I tried above and the music still stops between scene changes?
Hope we can fix this?


Music is in OGG file format…

Scene changing code is below:

function on_message(self, message_id, message, sender)
    if message_id == hash("ScreenFaded") then
        msg.post("#proxy_level_" .. CurrentScreen, "disable")
        msg.post("#proxy_level_" .. CurrentScreen, "final")
        msg.post("#proxy_level_" .. CurrentScreen, "unload")
        print(CurrentScreen .. " unload")
    elseif message_id == hash("proxy_unloaded") then
        msg.post("#proxy_level_" .. NextScreen, "async_load")
        print(NextScreen .. " load")
    elseif message_id == hash("proxy_loaded") then
        msg.post(sender, "init")
        msg.post(sender, "enable")
        NextProxyLoaded = true
        print("proxy_loaded")
    end
end

HTML5 builds are single threaded due to Meltdown and Spectre CPU vulnerabilities. Nothing we nor Defold devs can do about it. A solution is to keep everything loaded at once. Or fade out all audio before doing a load screen when the next things load.

Hi,

Thanks for the reply…

Does:

msg.post("#proxy_level_" .. NextScreen, "async_load")

do anything different than “load”?

How would I load everything at game start?
Link to project on GitHub is above.
Some help would be appreciated…

Jesse

How would I load everything at game start?

Instead of loading/unloading everything between screens you either load it all at the start and enable/disable as needed, or add everything to your initial collection.

I don’t recommend you spend your time doing either of these for your test project though just for HTML5 but keep it in mind if you want to make HTML5 focused games in the future with this limitation in mind.

Thanks for the help!
This is a significant limitation on HTML5 version.
Tired, will hit the source code with a big hammer in the afternoon…

Jesse

Again, it’s something which impacts all HTML5 games including ones made in other engines like Unity.

Something easy you can try is putting a reference to all of your .sound components and add .sprite components which have a copy of all of the texture atlases you use in your main collection so that the amount of resources you load between screens is reduced.

2 Likes