love.js icon indicating copy to clipboard operation
love.js copied to clipboard

Uncaught RangeError: offset is out of bounds

Open lovetocode999 opened this issue 4 years ago • 2 comments

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

lovetocode999 avatar Oct 04 '21 00:10 lovetocode999

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.

alexjgriffith avatar Mar 25 '22 20:03 alexjgriffith

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?

GameDevPassion avatar Jul 31 '22 22:07 GameDevPassion