Port games from Classic to META

Creations

Aurélien Rodot

6 years ago

The old Gamebuino Classic has plenty of games. Good news, it's super easy to port them on the new Gamebuino META!

Install the libraries

First, do the Gamebuino META Setup tutorial to install the META board and library. You DO NOT need the Gamebuino Classic library.

Now you have to install these two libraries to be able to compile the Classic's games for the META.

Download the *.zip files for each, then in Arduino click on "Sketch/Include Library/Add .ZIP Library".

Edit the classic game

No you can open a Gamebuino Classic Game and do the following modifications

A the top of the game you will find something like this (use CTRL+F to search).

Replace

#include <Gamebuino.h>
Gamebuino gb;

With

#include <Gamebuino-Compat.h>


Replace (if present)

#include <EEPROM.h>

With

#include <Gamebuino-EEPROM.h>


Remove (if present)

#include <SPI.h>

Compile for the META

  • Click on "Tools/Boards/Gamebuino META" (at the bottom of the list) to select the right device.
  • Click on "Sketch/Upload" or press "Ctrl + U" to compile and upload the program to the Gamebuino META.

Fix errors

If you get a whole bunch of error messages, don't panic. Some games might require a few more adjustments. Scroll up to find the first one and try to resolve it, then compile again. Repeat until there is no error. If you can't solve one, please post it here so we can help :)

Share the result

Now that you've been through this, you should make a new Creation. This way others can play it directly and give you some delicious upvotes :)

View full creation

STUDIOCRAFTapps

NEW 6 years ago

Studio's Advices:
While porting my project to meta, I found some problems that really slowed the process. I don't want anyone else to deal with them

- Make sure you don't use the INVERT color because it doesn't work anymore (Not sure if it works with the special library but it doesn't when 100% porting the game)
- Replace all your "int" with "uint32_t or int32_t",  "short" with "uint16_t or int16_t" and "char" (used as number) with "int8_t"
- Sometimes the conversion between floats and other number type compiles but gives an error when trying out the game

When fully porting:
- All sound related stuff don't work anymore the same way
- EEPROM has been removed
- gb.titleScreen has been removed
- You don't need to initialize gb with "Gamebuino gb;"
- ...

To find out anymore problems, simply disable all your code and enable one part of the code at the time to find out which one doesn't work.


(Those are all stupid advices) Suggest more problem that you found to help others :D

maxxcan

5 years ago

I am new user of Gamebuino and I am learning to program in this platform and I don't know if I prefer to try port games to META o program a new games based in them. 

For now I find many problems but I hope fix them. 

DFX2KX

NEW 6 years ago

I'm currently going through all of my old Arduino stuff preparing to build a (mostly) new PC, and if I find the source to Missile Command, I might try that. I was going to just rewrite it from scratch XD.

jicehel

NEW 6 years ago

You have to convert constantes like: gb.display.setColor(INVERT); 

I have replaced INVERT by WHITE

Sorunome

6 years ago

I didn't do that as color INVERT doesn't exist on the META, so it might not yield wanted results.

So, with the error, people can take a closer look at what is going on.

Sorunome

NEW 6 years ago

jicehel jicehel

I didn't do that as color INVERT doesn't exist on the META, so it might not yield wanted results.

So, with the error, people can take a closer look at what is going on.

jicehel

NEW 6 years ago

yes, but here, i think we could write all error finded (error finded is not necessary something to solve in auto with the library...  ;) ) and how to correct it. All things who was existing in classic that need be corrected by progrmmer. I had see something else but i haven't written.It was gb.popup(F("Slave paused"),2); which now if i don't mitake can be written  gb.popup("Slave paused",2); but correct me if i make error.


Sorunome

6 years ago

Yeah, that is correct .

We literally have #define F(x) x

Sorunome

NEW 6 years ago

jicehel jicehel

Yeah, that is correct .

We literally have #define F(x) x

makerSquirrel

NEW 5 years ago

Hiho,


I am putting this question here instead of to a new discussion, since it might be interesting for people in a similar situation when porting a game to META.

I am currently porting my Snake 5110 game to META and after following the steps mentioned here, it compiles without errors. The only warning that comes is:

Bootloader file specified but missing: C:\Users\jkl\AppData\Local\Arduino15\packages\gamebuino\hardware\samd\1.2.1\bootloaders\gamebuino_meta\samd21_sam_ba.bin

When starting the game on the META it crashes right after entering the main menu. Since that part of the game is pretty straight-forward and working without complaints on the Classic, I was hoping that you recognize this as a common issue, where there is a workaround I simply do not know yet.

The only guess I can make is that there could be a problem with the eeprom-part of the code, since the first time it crashed immediately after leaving the classic titlescreen/loop, the second time after drawing the menu for a few frames (the first time it typically tries to load the savegames from an empty eeprom and therefore creates dummy entries instead, the code is from R0d0ts Crabator Highscore part).

For those who might want to try to test that themselves, here the code version used for compiling.

https://github.com/makerSquirrel/Gamebuino-META-Snake-5110


any suggestions are highly welcome,


cheers,

makerSquirrel


Sorunome

5 years ago

First off, that warning is totally unrelated to cross-compiling and should be fixed in the newest version of the gamebuino meta boards (i think).

Second off, when first running it was there a rather long "Loading..." screen? (Or if you delete the SAVE.SAV in that folder)

And Third off, what do you mean with crash? What are the symptoms? Would you mind pointing to the part of the code (in your game) you think causes the issue?

Sorunome

NEW 5 years ago

makerSquirrel makerSquirrel

First off, that warning is totally unrelated to cross-compiling and should be fixed in the newest version of the gamebuino meta boards (i think).

Second off, when first running it was there a rather long "Loading..." screen? (Or if you delete the SAVE.SAV in that folder)

And Third off, what do you mean with crash? What are the symptoms? Would you mind pointing to the part of the code (in your game) you think causes the issue?

makerSquirrel

NEW 5 years ago

@ 1: ok, np

@ 2: yes, long loading screen, but only the first time. now it's rather short...

@ 3: it writes: OOPS, ERROR 2, hard fault, Ram overflow? Memory alignment, undefined instruc? exec xn address?


makerSquirrel

NEW 5 years ago

@Sorunome: I have stopped trying to use the compat-port, but started working on a direct port instead (thanks for trying to help me out, though). That way seemed to be less problematic (whyever ;) ). The only suspect I had in the end was the clear()-call to the display which I did not do in the menu, could that be it?

maxxcan

NEW 5 years ago

STUDIOCRAFTapps STUDIOCRAFTapps

I am new user of Gamebuino and I am learning to program in this platform and I don't know if I prefer to try port games to META o program a new games based in them. 

For now I find many problems but I hope fix them. 

jicehel

NEW 5 years ago

You can try to port a game, but i think that it's better to follow tuto first and making your first games and adjust them with infos of the tutos, then make one or two port and then think about your own game and begin to create it.

maxxcan

5 years ago

I made my first game follow the tutorials, maybe I try to make one or two port. Thanks

maxxcan

NEW 5 years ago

jicehel jicehel

I made my first game follow the tutorials, maybe I try to make one or two port. Thanks

maxxcan

NEW 5 years ago

Finally I can't to port any game from Classic to Meta. The last chance I try to port a simple "hello world" make for Classic and the error is always the same. 


This is the code, that I try  to port to META:

//imports the Gamebuino library

#include <Gamebuino-Compat.h>

// the setup routine runs once when Gamebuino starts up
void setup(){
  // initialize the Gamebuino object
  gb.begin();
  //display the main menu:
  gb.titleScreen(F("My first game"));
  gb.popup("Let's go!", 100);
}

// the loop routine runs over and over again forever
void loop(){
  //updates the gamebuino (the display, the sound, the auto backlight... everything)
  //returns true when it's time to render a new frame (20 times/second)
  if(gb.update()){
    //prints Hello World! on the screen
    gb.display.println(F("Hello World!"));
  }
}


And this is the error in the Gamebuino META

makerSquirrel

5 years ago

Since I stopped working on the port-approach, I do not know for sure, but I think, one has to clear the Display regularily:

// the loop routine runs over and over again forever
void loop(){
  //updates the gamebuino (the display, the sound, the auto backlight... everything)
  //returns true when it's time to render a new frame (20 times/second)
  if(gb.update()){
    //prints Hello World! on the screen
    gb.display.clear(); /// this one I think is important
    gb.display.println(F("Hello World!"));
  }
}


makerSquirrel

NEW 5 years ago

maxxcan maxxcan

Since I stopped working on the port-approach, I do not know for sure, but I think, one has to clear the Display regularily:

// the loop routine runs over and over again forever
void loop(){
  //updates the gamebuino (the display, the sound, the auto backlight... everything)
  //returns true when it's time to render a new frame (20 times/second)
  if(gb.update()){
    //prints Hello World! on the screen
    gb.display.clear(); /// this one I think is important
    gb.display.println(F("Hello World!"));
  }
}