Jump to content

Safari issue - game crashes after preload, first time


Interactive Monster
 Share

Recommended Posts

I'm having an issue with my game, specifically on Safari (desktop).  The game is built for desktop only, so this isn't an issue with iOS.  After my game complete's it's preloading, I get a "beachball"/spinning wheel, which never stops - there are no errors thrown to the console.  When I refresh the browser, the game plays as expected after preload, without any issues.  

I've read a lot of posts regarding CORS, so I've set my game.load.crossOrigin to "anonymous".  I've also read posts regarding audio issues with Safari, but upon removing all audio from my game, the same error occurs.  

Here's a link to the build in question:
interactivemonster.com/clients/cartoonNetwork/d2/v34

I apologize for the load time - this is currently being optimized.  

As you can tell, this is for a fairly large client, who we've been pushing strongly towards Phaser, and unfortunately, this issue is now shaking some confidence in Phaser (which I don't agree with).  

If anyone has encountered similar issues with Safari, please let me know!  I'm absolutely in love with Phaser and would love to use it for all future games with this client!

 

Link to comment
Share on other sites

OK - sorry to bother everyone, but I resolved this issue and it had nothing to do with Phaser.  

For anyone interested, the issue was with Safari storing the map data.  Apparently there are limits to how much data you can save at once via localStorage.  When the map is built the first time, it writes the entire matrix to local storage, so when you play again all your "dig" data is stored.  This project grew in scope during production, and the map ended up being hundreds of rows tall, with each row being stored as it's own array via:

localStorage.setItem('row-'+i, JSON.stringify( tileMatrix ));

If I try to store more than 200 rows at once, Safari crashes.  If I group those calls into batches of 50, with a 1 second delay between them, no issues.  

I know I know... storing hundreds of individual arrays... maddening!  

 

Link to comment
Share on other sites

Ahh good old localStorage. Not only does each browser have its own limits, but some let you increase them, others lock them out, and some will use twice as much data when storing a UTF16 string compared to a UTF8. It's a bloody minefield :(

Still, at least you got it sorted.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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