Port Centipede Meta to Pokitto?

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

1 Like

Probably not so hard

What toolset will you use?

2 Likes

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.

1 Like

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.

2 Likes

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?

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

1 Like

Would Millipe be much easier to port you guys?

I know Dreamer2345, I helped him out a bit with RogueBoy.

If you don’t mind not having sound then you can use this to help with the port:

(I need to get back to working on this some time.)

You won’t be able to use the mbed online compiler though,
you’d need one of the IDEs that can support C++11, like Embitz or VSCode.

Are you planning to do this yourself as a project or do you just want the game ported?

Yes indeed you need to get back to it… :wink:

2 Likes

I ported it.

If you want to port it yourself then I won’t publish my port,
but if you just wanted a port of it then I’ll publish my port.

It took all of about 5-10 minutes to port it…
and then my compulsions got the better of me and I spent about 1-2 hours cleaning up the source code.
(It was probably a waste of time, but seeing the code cleaned up made me feel better at least.)

(Don’t let that sway your decision though, I’ve got projects I’ve poured more time into than that which have never seen the light of day.)

4 Likes

@Beau, if you haven’t responded by tomorrow I’m going to assume it’s ok to publish what I’ve got.

I’ve already discussed it with @Dreamer2345 (the author of Millipe) and he’s going to accept my code reformatting changes into the original repo either way.

@pharap- go ahead and publish it please!! I’m a busy guy, but is there tutorials yet on how to port games? Mainly from Arduboy?

Would the Meta always be hard? The games they have over there are pretty awesome, but they have so little compared to us.

@Dreamer2345
We need to get you a Pokitto!

I’ll probably publish it sometime today.
Just waiting on some info from @Dreamer2345.

Not as far as I know.
The porting process would be different for each platform.

Generally porting is just a matter of finding or writing functions that match the behaviour and interface of the fuctions provided by the other platform.

Porting from Arduboy can be really easy depending on how the game is structured.

The biggest obstacles are:

  • Games that are reliant on the special .ino processing
  • Games that use sound
  • Games that rely on external libraries
  • Games that rely on compiler extensions

If a game has sound you have to either comment out or conditionally compile the lines that use a sound library.

If a game has an external library then it depends on whether that library will work on Pokitto.
(Thankfully the most common cases (the font libraries and fixed points) are easy enough to get working on Pokitto.)

If a game relies on Arduino’s weird .ino file behaviour,
that can sometimes mean the code needs quite a bit of rewriting.

And if a game relies on compiler extensions,
I think both the Pokitto and the Arduboy use GCC,
so theoretically the supported compiler extensions should be the same,
but it might be better to rewrite the code to not rely on the extensions anyway.

I don’t know much about the Meta myself.
If I did I’d consider doing something similar to what I’ve been doing for Arduboy2.

If this had come up a week or two sooner then one or both of us could have entered the Python competition to win him one.

2 Likes
1 Like