Skip to content

In-Game: [HTML5] RNG-related changes in 2024.14.4.265 RTs eventually cause crash when approx 15,000 numbers have been generated #14435

@hr-oss

Description

@hr-oss

Description

I discovered a flaw with the HTML5 runtime's random number generator--

When using built-in functions such as irandom(), random_range, etc, the game will eventually crash.

Looking in to the JavaScript with obfuscation turned off (thank you for that feature by the way!) I think I know what's going on:

The JavaScript runtime uses BigInt for the 64bit seed multiplication -- the runner does not truncate the seed after each generation, however.

Instead of staying as a 64-bit integer, it grows by 64 bits with every call...eventually, BigInt is larger than JavaScript's maximum size, the game crashes, with the following console message: RangeError: Out of memory: BigInt generated from this operation is too big

Intriguingly, this issue is not present on the prior runtime (v2024.14.3.260).

- Henry

Steps To Reproduce

  • Run the project in the HTML5 target (any browser)
  • Wait until the game crashes (~15,000 randomly generated numbers)

Which version of GameMaker are you reporting this issue for?

IDE v2024.14.4.221 Runtime v2024.14.4.265

Which operating system(s) are you seeing the problem on?

Mac 26.3.1

Which platform(s) are you seeing the problem on?

HTML5

3d8afb83-36b6-48e8-af5f-03890cb17471

Metadata

Metadata

Assignees

Labels

gms2-bugIn-game bugs with the "GameMaker Studio 2" runtimesprojectThis issue has a sample project attached
No fields configured for In-Game Bug.

Projects

Status

Verified

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions