Jump to content

Simulate slow download for preloader developing


tackle
 Share

Recommended Posts

It depends how you have your preloader setup, and it seems obvious, but I usually just decouple the preloader from any content loading and just update it manually.

 

So for instance if your preloader updates based on a loader event, I would remove the event and update the preloader at a timed interval with a set progress amount. It won't simulate the 'chunkiness' of downloading but it works for getting the logic and design worked out.

Link to comment
Share on other sites

To avoid without mucking about with servers, try add something like this code at the top of your JS:

 

Phaser.Loader.prototype.originalNextFile = Phaser.Loader.prototype.nextFile;Phaser.Loader.prototype.nextFile = function(previousIndex, success) {    var self = this;      window.setTimeout(function() {        Phaser.Loader.prototype.originalNextFile.call(self, previousIndex, success);    }, 100 /* milliseconds */);}; 
(note: totally untested)
Link to comment
Share on other sites

It's somethinf different to have some latency in the server response (server waiting before responding, but then responding as fast as usual) and to have a poor bandwith (low speed). Maybe this difference doesn't make sense in the player experience, I don't know.

 

If you are running an Apache 2.5 web server (even locally), you can set up the bandwith with the ratelimit module : https://httpd.apache.org/docs/trunk/mod/mod_ratelimit.html

Link to comment
Share on other sites

I can fill in that besides Apache you can also limit very easily with nginx.

 

I'm trying local development with WPN-XM and I prefer nginx over Apache. I remember trying limiting locally with Apache before but I never got it working - hopefully it should work now.

 

With nginx it's as easy as setting a "limit_rate" directive. Very useful.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...