I just tried using the https://arcade.makecode.com/54804-11250-44382-90046 link from your post, and it loads fine onto my PyGamer, though compilation took a bit longer than usual. Do other game downloads work for you?
The game looks great! Unfortunately Iām not very good at it:
Thanks for getting back to me on this. I can download other games. I was also able to download previous versions, so I was starting to think maybe there is a limitation to how big the game can be. Do you have any other modifications? Does the pygamer take an extra memory card? If so, do you happen to know what the maximum size might be? I read somewhere that you cannot load more than one Arcade game at a time, so Iām not sure what the memory card would be used for. Perhaps you can use it for other platforms that can load on to it. I have also tried so many different USB cables, but it doesnāt make any difference. I would als think so long as the computer sees the device on the computer, that even manually copying the file to the drive should work as well.
Which operating system do you have? Windows, Mac, etc.
Make sure the PyGamer is in bootloader mode. If the PyGamer is connected to a computer while being restarted, it should automatically switch to bootloader mode.
@AlexK
I am not sure whether this code is causing my issue, whether it is my computer/usb cable being the issue, but after I commented all references to the transformSprites extension, I could upload the game. I saw this issue: https://forums.adafruit.com/viewtopic.php?f=64&t=164807&p=810471&hilit=pygamer#p810471 and thought maybe this might be the issue. Iām not convinced. I will keep trying with/without the code to see if it works.
I uploaded it from a Linux laptop, copying the arcade-Frogging-Fun-100.utf2 file onto the PYGAMERBOOT drive. The file size was 682.5 kB, and it surprised me that this worked since I thought there was a smaller size limit for Arcade games.
If I reboot the PyGamer, the PYGAMERBOOT drive shows CURRENT.UF2 with a file size of 1.0 MB.
According to MeowBit Sd Card Slot the SD card slot isnāt currently supported for storing games, and I donāt have an SD card installed in mine. If I understand it right, the issue with that seems to be that the PyGamer only provides very low-level access to the SD card controller, and since the protocol is quite complicated it would be challenging to provide a driver to make it usable in the Arcade environment.
Is it possible that itās only actually storing 512 kB of the full 682.5 kB UF2 file, and that it may partially work depending on which bits of it are stored successfully?
I was able to upload the game, this time via MakeCode. There have been so many times when it hasnāt worked, but now it is working.
I have exactly the same bootloader version:
UF2 Bootloader v3.10.0 SFHWRO
Model: PyGamer
Board-ID: SAMD51J19A-PyGamer-M4
I suspect that either something is wrong with my computer, or USB cable, or my browser (iāve used Microsoft Edge and Chrome), or maybe the capacity of the device:
The PyGamer is powered by our favorite chip, the ATSAMD51, with 512KB of flash and 192KB of RAM. We add 8 MB of QSPI flash for file storage, handy for images, fonts, sounds, or game assets.
@richard
Do know if there is a limitation of how big Arcade games can be when uploading to a adafruit PYGAMER? The version I was eventually able to upload is 708KB.
I am not aware of using a full screen image. Is there something in the code that suggests otherwise?
Also based on my previous reply, and the way I have coded the game, is there anything I should change? I know I have a lot of functions, probably too many, and have also defined many variables (sometimes just to make debugging the game easier). So if you have any suggestions, I would love to hear from you. I want to make the game āleanerā, and I know I can do with a few less sprites. I look forward to your advice.
I was doing both. I read at adafruit that Chrome works better (webusb). The weird thing is, is that it works now. The entire day, not at all. So maybe itās a combination of things, Iām not sure.
We do tree shaking on the compiled code, so the only code included in the binary is code that is actually referenced. Itās possible that the extension references you mentioned removed from the code were bringing in a lot of code. Other than that, I dunno. If you have a version of the project that does not download I might be able to poke around when I have some free time.
I only have the .uf2 files, but I canāt upload them. I could share them if you like. I guess itās not a problem now, but if it happens again, can I send you another post here?
@AlexK
I apologize for jumping to conclusions. It was after a commented out parts of the code using the image transform extension, that it worked again. Shortly after, I put the code back, and I was still able to upload the game. So I am completely out of wits what was causing the problem, except that it must be my computer, the usb cable or the Arcade gods playing tricks on me. Sorry.
I have a few thoughts, some related to the memory concerns raised, and some related to your specific issue.
Regarding the Rotate Sprites extension: I do not believe I have tested it on hardware, so I do not know how it performs. It takes for granted the amount of memory in a browser, so it may exceed the RAM available on the hardware platform.
Along those lines, static images that are included with your project do not occupy space in RAM. So, if youāre running into the memory limit, Iād create the images in blocks and store the images in arrays, and then select the appropriate image from the arrays as needed. As @richard mentioned, dynamic images can quickly use up the available RAM on these hardware devices.
I donāt have a hardware device on hand at the moment. I probably should have one on-hand here in my remote office, now that Iām spending more time here. Anyway, if you continue to have difficulties, let us know what error messages you are getting.
@AlexK I was talking about the code size, not the RAM usage. RAM usage is for sure the much more common issue but I have seen 1 or 2 games that hit the flash limit.
Like Alex mentioned, if you hit an issue with memory usage youāll get an error code on the device