9 years ago by zachstronaut
Levels may not load because pre-rendering chunks freezes Chrome.
If you have a pixel art game and are setting the scale factor when you call ig.main() so that your pixel art is upscaled by the engine's internal nearest neighbor algorithm, and you are also pre-rendering your map layers into chunks, then your game may no longer be loading levels in Chrome.
Chrome has developed a bug where drawing from one off screen tilemap canvas into many off screen chunk canvases becomes extremely slow.
The simplest fix is to just turn off pre-rendering on your level map chunks. However, this may not be ideal for obvious performance reasons.
I have developed another fix that works consistently for me and is still pretty simple. Add this to your main.js BEFORE you call ig.main()
This bug seems to have arrived in Chrome 49.0.2623.110 (or possibly the public release just before it). It occurs on Mac OSX 10.11.4. Firefox and Safari are not effected. I have not confirmed the bug occurs on Windows, but I have confirmed that the fix causes no problems on Windows.
If you have a pixel art game and are setting the scale factor when you call ig.main() so that your pixel art is upscaled by the engine's internal nearest neighbor algorithm, and you are also pre-rendering your map layers into chunks, then your game may no longer be loading levels in Chrome.
Chrome has developed a bug where drawing from one off screen tilemap canvas into many off screen chunk canvases becomes extremely slow.
The simplest fix is to just turn off pre-rendering on your level map chunks. However, this may not be ideal for obvious performance reasons.
I have developed another fix that works consistently for me and is still pretty simple. Add this to your main.js BEFORE you call ig.main()
// Fix Chrome 49 bug during map chunks pre-render step // Creating pre-rendered chunks from an Image is very fast, // but creating them from an off screen canvas is extremely slow. // So simply convert the upscaled canvas back to an image. ig.Image.inject({ resize: function resize() { this.parent.apply(this, arguments); var img = new Image(); img.src = this.data.toDataURL(); this.data = img; } // resize() });
This bug seems to have arrived in Chrome 49.0.2623.110 (or possibly the public release just before it). It occurs on Mac OSX 10.11.4. Firefox and Safari are not effected. I have not confirmed the bug occurs on Windows, but I have confirmed that the fix causes no problems on Windows.