Port Centipede Meta to Pokitto?


#1

Hey guys, the creator is fine with porting. Would it be hard to port it over if I wanted to do it myself?


#2

Probably not so hard

What toolset will you use?


#3

Porting the game shouldn’t be too hard, it’s mostly a matter of replacing calls to the Gamebuino Meta library with calls to the Pokitto library. I took a quick look at the code, and it looks like it isn’t too complicated, so this game specifically should be fairly easy to port. However, there are a few challenges you might encounter.

  • The way images are encoded I think might be different, so you would need to convert the game images so that the Pokitto’s draw functions understand them.
  • The Gamebuino Meta is designed to be programmed for using the Arduino IDE, which accepts .ino files (basically C++ with an extra preprocessing step intended to hide some complexity from beginners). The Pokitto is designed to be programmed in C++, which means you need to convert the .ino file to a .cpp file. This isn’t too hard, and there might be some examples on this forum somewhere on what the difference is.
  • The screen sizes are different, so you’ll need to adjust for that.

I think something like this is a good first project for someone who knows programming and is trying to learn how to make a Pokitto game, but depending on your experience it might be helpful to make a little test game on the Pokitto first.


#4

It might be worth asking if the author is going to put a licence on it.
If it’s got a proper open source licence then it’s easier to know what you’re allowed to do with it.

E.g. if it’s MIT you can do pretty much anything as long as you retain the copyright notice,
but with Apache 2.0 you’d have to clear state that you’ve changed the code,
and with the GPL you’d also have to date your changes and there would be a few other complications


A non-exhaustive list of differences:

  • .ino files always have #include <Arduino.h> prepended to them,
    for a .h/.cpp file, this would have to be manually added

  • .ino files automatically include other .ino files in the correct order as determined by the compiler,
    for a .h/.cpp file, all includes must be added manually

  • .ino files automatically predeclare every function so the programmer doesn’t need to declare a function before it is used,
    for a .h/.cpp file, functions must be declared and/or defined before they are used

Something else that’s very significant: the Arduino IDE uses the -std=gnu++11 and -fpermissive flags

  • gnu++11 allows non-standard compiler-specific code.
    Hopefully nobody is doing this, but I know some people who do,
    so here’s the documentation for those extensions

  • -fpermissive is an evil, evil flag.
    It allows various violations of C++ rules to be permitted,
    and often those violations lead to hard to find bugs.

I somewhat agree with this. You need to understand C++ a fair bit before you can start porting things.
Fortunately you don’t have to understand the whole program, you only have to understand the Gamebuino and Pokitto APIs so you know what functions are equivalent to what.


@Beau, if you have any trouble trying to replace something that’s coming from the Arduino or avr-libc libraries rather than the Gamebuino library, have a look at these parts of my (still unfinished*) Arduboy2 library port:

If there’s anything missing that you need, let me know,
I intend to eventually publish these separately at some point anyway,
so it makes sense to try and make them complete as possible.

* I will get back to it, I’m just unexpectedly busy at the moment


@jonne, I notice that neither @Beau or @wuuff’s icons are showing up, and there are quite a lot of other users in the same predicament.
I had a look and it seems that all the default letter icons are 404-ing,
which would explain why it seems to only affect users who haven’t set a custom icon.
I’m guessing the letter images either got accidentally moved or deleted during one of the server updates.


#5

I’ve never Ported a game before haha. But this is something I can try! Would it be best to wait until the game is somewhat finished before porting?


#6

Yup I’d wait until the game is complete, unless you don’t mind redoing it all at each version the original author may release lol