
In two separate projects I've used fetch() to grab a secondary map file, and then used mset/mget to get/set tiles on that file and the default 0.map file, which has caused the graphics and map data to corrupt permanently in some way.
1. Short Circuit
I used Picotron to make a game for the GMTK Game Jam called Short Circuit. In it, I draw walls in the map editor with a basic sprite and then use a function during runtime to replace these sprites with ones that are shifted upward to look 3D:
Multiple times during this jam I would suddenly get an "Out of Memory" error when trying to run my cart even though it was fine for the past couple hours. I would reset Picotron, and suddenly all my sprite data for the cart would be empty (even if I opened it externally), and my map files would be empty and broken. Upon trying to launch the game I would get this error:

I made new map files and redrew my sprites, and then I set up version control. This happened around 4-5 times during my 4 day development period, so I knew something was seriously wrong with my cart, but I didn't have time to diagnose it. I am now a bit more certain that the culprit is my use of MSET and MGET (or its Picotron equivalents) because of my other project.
2. Roguelike Map Generator
Currently I am working on a randomized map generator for a roguelike. I created two carts:
- One that generates a layout of connected rooms, storing their positions, height, and width.
- Another that takes that list of parameters and generates each room by taking pre-made layouts from an atlas map file (TILES.map) with MGET, and then using MSET to put them onto the main map file (0.map).
Each of these carts work on their own individually, but when I integrated them together into the same cart and ran it a couple times, it corrupted something so that Picotron crashes when I open the Map workspace:

I investigated a bit and this is what I found:
- Loading the cart, closing the Map workspace, reopening it, and then opening JUST 0.map will NOT crash Picotron.
- Starting a new cart and then opening TILES.map by navigating to it through the file explorer will NOT crash Picotron (and the file is intact, all of the tiles are there).
- Loading the cart, closing the Map workspace, reopening it, and then opening TILES.map DOES crash Picotron.
This would suggest that doing fetch("TILES.MAP") and then using MGET on that file is messing it up somehow. HOWEVER, there's a wrench this theory. Remember I said that the two halves of this Map generator worked on their own individual carts. I am using the EXACT same code to copy and paste tiles in both carts, and only one of them crashes. The only difference is that in the one that works, 0.map is set to 100x100 tiles so that I could test generating rooms of different sizes, whereas the other cart has the default 32x32 map size (and I accidentally tried to generate a map that was too big for that). THAT would suggest that trying to MSET tiles out of bounds is the issue instead. Although maybe that's just jumping to conclusions.
Between that info and what happened with Short Circuit, I don't have much of a clue what's happening. All I know is that my use of MSET/MGET seems to be corrupting the graphics data of my cart somehow. It was suggested to me that the problem could be related to the known problem with FETCH/STORE in this version so I wanted to make sure to mention my use of it here, although I am not using STORE at all. Only FETCH.
I can provide the corrupted roguelike cart if that is of interest. I don't have a corrupted version of Short Circuit since I kept reverting due to the deadline, but I could provide the working version if it would help.
[Please log in to post a comment]