I’m trying to isolate a memory issue with my latest extension, which creates random mazes.
The code I’m using is available in the following image:
(Load it in beta; the extension doesn’t work on 0.8.11.)
The version of the extension contained in custom.ts uses a common drawing canvas to limit the amount of memory needed. That’s the private static _img: Image property in the Grid class.
The game also removes the breadcrumb sprites in a further attempt to lessen the memory burden.
If I run this program on my BrainPad Arcade, I get a 021 error when I press A (which generates the maze). If, then, I reset the device twice to re-run the game, I get a 022 error instead when I press A. In the error codes page for MakeCode (below), I don’t see a description for the 022 error code. What causes that error code?
(I would imagine this might come up if you index into an array with an arbitrarily large digit (e.g. arr[1000000000]) as it will have to allocate index * size memory, but I haven’t looked at the code yet / actually tested that though)
Ooh … good thought, @jwunderl . Hardware definitely doesn’t like my inefficient indexing in the Cell.getDistances method. I’ve trimmed that a bit. Running into a problem in Distances.getPath, but you have me on the right track.
I have the memory inefficiencies in the extension reduced well enough without completely changing the data structures. Hardware can now handle mazes up to roughly 16x16, which should be more than large enough for most applications.
I’ll clean up the code and release a sample game after the production version of Arcade gets bumped to a version that can handle this code. For now, though, this only runs in beta. Feel free to play around with it!