When I first think of which game I would make on my Arduboy, I looked at the screen resolution, and those tiny pixels, remember me those pixels I was fighting in my Lemmings gaming session during the last century… Then I thought, yeah Lemmings might be a good choice
Well, I guess there’s no real reason. I started with the Arduboy 1 library, then complete most of the game when I started to do optimization.
However, I distorded quite a lot of original function of the library to make it more specific to my project. For example in the drawBitmap() function, I removed the vertical iteration because all the bitmaps that I need to draw are only 8 pixels high.
However, there’s still some valid optimization that I’ve done in that function, that could still be applied in the Arduboy2 lib (I’ve just checked and the drawBitmap function didn’t changed between version 1 and 2).
For example caching the variable instead of copy/pasting for the 3 colors, or computing a start and end value for the for loop instead of testing and break the loop both increase the speed and decrease the progmem size (according to my test).
Also I’ve added a mirror flag (on X) to that drawBitmap() function, which is quite free I guess on the performance side, and could be very handy to many developpers, because you often want to play a character walking to the right of the screen, then mirror the animation to make it walk to the left. This would be a cool and legid parameter to add to the lib, I guess.
The mask parameter that I added, is too specific to my game, and I think should not go in the lib.
A mirror on Y would be also a nice addition, even if it would be more costy, as you would have to write the bits in reverse order.
Anyway, I think I will start my next game from Arduboy2 (and hopefully won’t need to change it).
If you’re only modifying a few library functions, in many cases it’s better to just make local versions of these functions instead of copying the entire library. This way you can easily take advantage of any optimisations, enhancements or additions made in areas that you haven’t customised.
You’re saving game data at offset 10 in EEPROM. The first 16 bytes of EEPROM is reserved for system use. Your sketch should only use EEPROM from defined offset EEPROM_STORAGE_SPACE_START and above.
Also, it’s better to use EEPROM.update() instead of EEPROM.write() to prevent unnecessary writes to EEPROM.
I’ve uploaded a .arduboy file in the Release folder of my repo. I could import it in ArduboyManager, however, I couldn’t test the transfert, since all the game I tried to transfert to my Arduboy with the ArduboyManager was not successful (just freezing the ArduboyManager).
Please let me know if you try it, and if it works for you.
Also I’ve added a compiled version of the Editor (should run directly on Windows, and on linux/Mac you can run mono in command line giving the exe file in parameter).