Arduboy crosscompiling -- By Sorunome

Arduboy Crosscompiling

Author :  Sorunome

So, some time ago I worked on cross-compilation of Arduboy games.

For those of you who don't know, Arduboy is an Arduino-based gaming system, similar to the Gamebuino Classic but with a different screen and with a different MCU. You can find their website here: https://arduboy.com/


Anyhow, here is a screenshot of cross-compiled Mystic Balloon:

And the settings page:

There are two display modes: fast and recordable. In fast display mode games should actually run at 60FPS.

Frameskip happens automatically if CPU usage goes up, and gets disabled again automatically if enough CPU time is free.


To cross-compile your own games you need to replace the Arduboy includes with the correct cross-compile library ones:

You will also need to remove everything that has to do with Serial.

If a game defines its own main function, comment that out / remove it.


On that note, use this at your own risk, some games may work better than others.

Author :  STUDIOCRAFTapps

Nice! I would still prefer porting 100% the game and adapt the screen size to the gamebuino meta's one but this does it for now.

Author :  Sorunome

Of course! Porting a game is prefered!

Author :  deeph

I missed that but this is really awesome and you certainly spent a lot of time on this ! Well done :)

Will you spread compiled binaries ? (with the original author's agreement if needed ?) It would greatly expand the Meta game collection !

Author :  Sorunome

I do not plan on spreading compiled binaries, it should however be very easy to cross-compile games yourself ;)

Author :  NightWolf

I'd like to see Arduman and Squario cross-compiled. I'll see if I can figure out how to do that. 

Author :  geed

I tried to convert MicroCity and Evade2 but it wrote "compilation error". I must compile for "GBMeta" or something other ?

Author :  Sorunome

Yeah, you have to select "Gamebuino Meta" as board

Author :  Blixten

I just tried to cross-compile Mystic Balloon, but I get:
undefined reference to `Gamebuino_Meta::transfer_is_done'
undefined reference to `Gamebuino_Meta::myDMA'
in  ...\libraries\gamebuino-arduboy2\src/Gamebuino-Arduboy-Compat.cpp

The only changes I did in Mystic Balloon was in globals.h, where I replaced:
  #include <Arduboy2.h>
  #include <ArduboyTones.h>
with:
  #include <Gamebuino-Arduboy2.h>
  #include <Gamebuino-ArduboyTones.h>

Any suggestions?

Author :  Sorunome

You need to make sure both your gamebuino library and the cross-compile library are at the latest version

Author :  Blixten

I'm using the latest from the master branch of:

https://git.sorunome.de/Sorunome/Gamebuino-Arduboy2
https://git.sorunome.de/Sorunome/Gamebuino-ArduboyTones
https://git.sorunome.de/Sorunome/Gamebuino-ArduboyPlaytune

and release 1.1.0 of:
https://github.com/Gamebuino/Gamebuino-META/

Isn't that correct?


Author :  Sorunome

The repos moved to github, sorry! The only one that needs updating is https://github.com/Sorunome/Gamebuino-Arduboy2

I'll go right ahead and edit the top post with the new repo URLs

Author :  Blixten

Thanks!

I did find out that if I used release 1.0.6 of https://github.com/Gamebuino/Gamebuino-META/ then it worked, but now I changed to the latest and using the moved cross-compile library, and that also works.
It always feels best using the latest revision.
Thanks again for you help!

Author :  jicehel

Please when you succed cross compile a game (from Arduboy or other port), please share it in a creation to let other profit of your works. ;)

Author :  Juice_Lizard

Hello, I try to port my Arduboy game "Cutie E" but I have this message: Gamebuino-EEPROM.h: No such file or directory. Do you know what I need to do?

Author :  Sorunome

You need to install the Gamebuino-EEPROM emulation library, you can find it here: https://github.com/Gamebuino/Gamebuino-EEPROM

Author :  Juice_Lizard

Thank you! That works much better. I can now "play" (read) "The guy who never complains" on my Gamebuino Meta. It is a little bit slower than on Arduboy but it works. (I have to press the buttons longer.) I can also display the title screen from my other game "Cutie E", but it happens nothing when I press some buttons.

Author :  jicehel

I hope you'll have answer, i have never try yet but i read your try and i hope you'll succeed. Of course, a port on Meta let's optimise game with color and good use of curent buttons of the META but to it's fun and quick to cross compile a game and it's can be a good way to see if you want make a Meta version of it.

Author :  Juice_Lizard

Hi Sorunome! Your cross-compiling library is great, but it would be even better if players could choose the background screen color in the settings and if text is shown or not ("Arduboy Game" and "c Settings"). And if game makers could choose those preferences when they code, for the game not begins necessarily on green background with not very useful text.

I tried it in my last game (coming soon on Arduboy and Gamebuino Meta) and I find it much better with total black background screen.

If you don't change your code, I advice the game makers to see in your file "Gamebuino-Arduboy-Compat.ccp" and to change by themselves the colors in "void Gamebuino_Arduboy::drawScreenBackground()". Then, create a binarie file to share the game.

Author :  jicehel

Nice news Juice Lizard for the cross compilation, the new game and the tips. Thanks for these informations. 

A good tools to create could be a code transformator to change a arduboy source into meta prepared source where you should just have to transform, remove or add some things to have an optimized META game from an Arduboy game (Color, sound, adjustement of the resolution or in Hi or Low resolution depending of the game). Maybe not easy to do, but it's could be cool too but the cross comilation is a fantastic tool too.