Open Aaron1011 opened 11 years ago
Good thinking. Any idea how we should do this?
@justinclift: On second thought, it will probably need to be done in a jQuery document load handler. Web workers can't manipulate the DOM, and can only communicate with the main thread using strings and JSON. What I'll need to do is move the calls to loadAudio
and loadSprites
in game.js
from the run
method to an onload handler.
@justinclift: Do you know where in the code would be best to add the handler? The Game
instance has to be in scope, because both loadAudio
and loadSprites
mutate it.
Not sure atm. I'm trying to dedicate this weekend to getting a different side project back up to date (GlusterFlow), so I'm trying to keep my head in Python mode. :smile:
@justinclift: Ah, okay :smile:.
Currently, the static assets for BrowserQuest (music and images in this case) are download when the Login button is clicked. If we were to start fetching them once the page had loaded, we could probably increase the speed of logging in. Of course, the risk is that the user decides not to play, meaning we've download the files for nothing.