Davidobot / love.js

LÖVE ported to the web using Emscripten, updated to the latest Emscripten and LÖVE (v11.5)
MIT License
605 stars 27 forks source link

Uncaught RangeError: offset is out of bounds #47

Open lovetocode999 opened 2 years ago

lovetocode999 commented 2 years ago

When running one of my projects in love.js, this error is thrown:

Uncaught RangeError: offset is out of bounds
    at Uint8Array.set (<anonymous>)
    at processPackageData (game.js:231)
    at IDBRequest.putMetadataRequest.onsuccess (game.js:209)

The aforementioned project runs without problems on my local machine.

https://lovetocode999.itch.io/a-solar-disorder https://gitlab.com/lovetocode999/ld49

alexjgriffith commented 2 years ago

There is a default upper limit to the size of the Uint8Array in emscpritpen and that's the error that is thrown when you the size of your game.love file is greater than it.

Step one is to try and decrease the size of your .love file (use compressed sound etc)

If that's not a possibility you can in theory increase the minimum size of a Uint8Array. Since emscripten ~1.3, when compiling you can include the following flags to increase the amount of memory that can be used: ALLOW_MEMORY_GROWTH MAXIMUM_MEMORY=_GB

A minor rewrite of game.js is necessary to use a version of emscripten greater than 2.1. I recommend we add these flags when that rewrite happens.

GameDevPassion commented 2 years ago

Hello alexjgriffith, I'm having the exact same issue, only that it says at putMetadataRequest.onsuccess (game.js:209:11) instead of at IDBRequest.putMetadataRequest.onsuccess (game.js:209)

Where can I include the flags ALLOW_MEMORY_GROWTH MAXIMUM_MEMORY=_GB

Do I include them in the terminal, when creating the javascript file?