Gamebuino Library for Arduboy



Arduboy can play Gamebuino. But probably all game don’t work.
It support Gamebuino library.
unsupport is SD card Library and etc.


I tested few games. thank you awesome game! :slight_smile:

  • 101 STARSHIPS by zoglu(sketch size is too big. I del sound. sry.)
  • CRABATOR by rodot
  • UFO-RACE by rodot
  • INVADERS by yoda
  • PAQMAN by yoda
  • WHG by sorunome


Gamebuino exist C Button. C Button of Arduboy is Left + Right.

Technical information

Game source code change #include.


#include <Gamebuino.h>


#include "Gamebuino/Gamebuino.h"

probably it can running.


compiler : windows Arduino IDE 1.6.9

Picovaders - a space invaders-like shooting game
(Olikraus) #2

Nice, so even more games are available for Arduboy. And one more option for the game lib :slight_smile:



yes. arduboy added new one library. :grin:
good function is menu, messagebox.

I will steal it. and add my original library.

(Josh Goebel) #4

I wonder why. You’d think the compile size shouldn’t be much bigger than for the Gamebuino… was it CLOSE?


Gamebuino of Max Flash Size is 32256. Arduboy is 28672.

I tried compile.(Windows Arduino IDE 1.8.0)
_101starships + my library : 28910. bit over.:confounded:

by the way…
I deled game logo(title image). result : 28638

oops. sound can play game.
It was impossible in the past. probably…

I changed github. Thank you for talking about library.

(Phil Graham) #6

Would Gambuino games work on the Arduboy or would they have to coded for it to work on the Arduboy?

(Josh Goebel) #7

They’d need to at the very least be recompiled with a library such as this one, etc.

(Erwin) #8

Oh wow! I was not aware of this. So awesome!

I can add at least 20 more games to :smiley:

Thanks @akkera102

(Erwin) #9

Hey @akkera102 2 questions:

  1. Why uint8_t _displayBuffer[512]; in lib_Display.cpp is not uint8_t _displayBuffer[504];?
  2. How can I expand the display area? for example to improve some Gameduino games to use the whole screen?

(Pharap) #10

Just a heads up: the aspect ratio of the gamebuino is different, so attempting to increase the amount of screen it uses will mean some pixels will end up taking up more screen space than others.

Arduino: 128x64 = 2:1 = 2
Gamebuino: 84x48 = 16:9 (roughly) = 1.75

You could move it to the centre of the screen though, instead of it being shoved to the top-left of the screen.

(Erwin) #11

Sure, I do not want an automatic improvement but edit the original game to adapt everything to a bigger screen. In some cases it is quite easy, for example Digger (check it -> ) uses only 1 function to draw the game :smiley:

(Pharap) #12

Oh, I thought you meant trying to scale the contents of the buffer to fit the 84x48 resolution on a 128x64 screen.

Editing the game behaviour to target a larger screen makes much more sense :P.

(This is why when I write games I try to make my drawing calculations relative to screen width/height, so that if the screen resolution changes, my drawing code adapts.)


@eried, @Pharap
thank you for comment. im glad. :wink:

yes! 512 is bad number. I think 504 is correct too. 84*48 / 8 = 504.
original gamebuino library use 512.
For that reason, i copyed my library from original. i will fix my library.

It is a difficult problem. plan is…

  1. library use Arduboy and gamebuino display buffer.
    but very big size!(504 + 1024). Gamebuino games almost use memory.

  2. library use only gamebuino display buffer + rewrite display SPI function code.
    I think fps don’t keep 30fps. but It does not have to try.

  3. library use only Arduboy display buffer + All draw function rewrite Arduboy version.
    It’s too much bother to do the rewrite.
    I think code size is too big.

  4. Gamebuino games rewrite Arduboy version.
    no comment.

my library looked like the current situation.
It may be possible if a new Arduboy(fast cpu and big memory) comes out.

aspect ratio. not simple.:sob:

(Erwin) #14

Yes, I understand. I have only 1 question, how to increase the HEIGHT?

I am trying to adapt

With few changes, it works really well. For example after increasing the buffer to 124 as WIDTH, the game is much wider with small changes as:

uint8_t _displayBuffer[(LCDWIDTH*LCDHEIGHT)/8];

void Display::update(void)

	for(uint8_t page=0; page<6; page++)

		SPI.transfer(1 + page);

		SPI.transfer(((128 - LCDWIDTH) / 2) - 1); // based on WIDTH


		for(uint8_t col=0; col<=LCDWIDTH-1; col++)
			SPI.transfer(_displayBuffer[(LCDWIDTH * page) + col]);

However, if I increase the HEIGHT, everything is messed (even the Gamebuino bootscreen that should be resized properly). I am sure that is something related with SPI commands but with a hint I could save the time required reading the full display controller documentation.

Basically I want to draw vertically more pixels than 48. I need a hint where that happens, or which command is related with that.

(Simon) #15

I know nothing about the Gamebuino library but shouldn’t this line>

for(uint8_t page=0; page<6; page++)


for(uint8_t page=0; page<8; page++)

to account for the difference between 48 pixels versus 64?

Also, what’s this line doing ((128 - 128) / 2) - 1) always equals -1. What did the original line do / say?

(Simon) #16

I have pulled these lines from the Arduboy library …

#define COLUMN_ADDRESS_END (WIDTH - 1) & 127   // 128 pixels wide
#define PAGE_ADDRESS_END ((HEIGHT/8)-1) & 7    // 8 pages high

// set col address range
// 0x21, 0x00, COLUMN_ADDRESS_END,

// set page address range
// 0x22, 0x00, PAGE_ADDRESS_END

In which case, should your code be:

SPI.transfer(0x22);  // Set page address

SPI.transfer(0x21);  // Set column address

Its also clear I know nothing about the SSD1306 as well :astonished:

(Erwin) #17

Perfect, conversion is almost done, thanks a lot @filmote, I played with those values but it makes more sense after your post about the pages

(Simon) #18

Ah good. As I said, I am just guessing how the SSD1306 works.

What settings did you end up with?

(Erwin) #19

Several changes (basically making the screen size determine everything, the buffer, drawing, etc), I will post it in github or something later. The game is looking awesome, so much screen now compared to the Gamebuino.

But… I cannot draw a big rectangle now :confused: 128 as width fails, but 127 works well… there is a visible line at the end:

There is something wrong with the fillRectangle, or drawFastHLine or drawPixel when x is near the right side of the screen, maybe @akkera102 has a hint?


Your challenge is very very interesting.

The max and min value of coordinate are
0-63 in the height. 0-127 in the width.

void Display::drawFastHLine(int8_t x, int8_t y, int8_t w)
	for(int8_t i=0; i<w; i++)

it use int8_t (“char” variable). this variable use only -128 - 127.
128 is not made to be usable.