Not logged inGosu Forums
Forum back to Help Search Register Login
Up Topic Gosu / Gosu Exchange / Gosu on Raspberry Pi?
- - By mpthompson Date 2012-03-02 03:28
So the Raspberry Pi is finally on sale (well sorta) and I've got one on pre-order.  My hope is to use the Raspberry Pi for it's intended use, as an fun, inexpensive, and lean educational environment my son and other kids can "own" and experiment with without worries of messing it up.  If things do get hosed, just re-flash the SD card and keep going.

Therefore, my next question is, what is the possibility of Gosu running on the Raspberry Pi with a Debian distribution.  I presume it all comes down to getting the following hardware dependent packages working not only under Arm, but also with the Raspberry Pi GPU and sound hardware.


Hopefully, at least a handful of these packages might already be ported and will install with just "apt-get".  However, I'm more worried about the SDL packages which might be more PC centric and the OpenGL related packages.  The Raspberry Pi should support OpenGL ES 2.0 with a number of extensions as well as OpenVG, but it looks like the freeglut3-dev and libgl1-mesa-dev packages could be more problematic.

Any insight into whether getting Gosu going on the Raspberry Pi is likely to work?  And if not, what the effort might be to get it running? I do know that KidsRuby has been demonstrated to be running on the Raspberry Pi and KidsRuby normally does include Gosu, but I haven't seen any proof that Gosu is actually being used by KidsRuby on the Raspberry Pi.
Parent - - By jlnr (dev) Date 2012-03-02 04:56
Gosu supports OpenGL ES, it is #ifdef'd for iOS so far.

sdl-ttf is used when referencing TTF filenames, pango/freetype for system fonts, so you could get rid of either of them too by just using the other.

I have thought about getting one too, but I guess shipping would take forever. :| Is there a "default" OS that everybody is going to run on it? Debian? Ubuntu? That would make porting to it more rewarding.

Patches are accepted either way, it should be mostly #ifdef work :)
Parent - - By mpthompson Date 2012-03-02 07:25
That is good news about OpenGL ES already being supported in Gosu.  That should go a long ways towards making the port easier.  Also, I've found messages from people with the alpha boards that SDL apps run without modification on the RPi.  Perhaps a port to the Raspberry Pi won't be such a big deal.

The RPi I have on order is not scheduled to ship until the middle of May so it's not something I can work on for a while.  I suspect most other people who have ordered an RPi will have a similar wait.  In the meantime I do have a Debian Armel with the RPi filesystem running under QEMU which may at least help with getting an initial compilation going even if the compiled binaries couldn't be tested without actual RPi hardware.

For the Education Market, the Raspberry Pi Foundation is recommending a Fedora Remix which it will supply as an image for SD cards, but Debian looks as if it will be equally well supported on the RPi.  I presume that Gosu is pretty much agnostic as to whatever Linux distribution it's compiled on as long as the prerequisite libraries are present.  Correct?

BTW, I've seen foundation members mention that they intend for Pygame to be bundled with the Raspberry Pi and a number of games have already been tested to be working reasonably well.  Python looks like it will be the primary programming environment the foundation intends for students, but they are very supportive the KidsRuby distribution.  It would certainly be nice to see Ruby gaming be represented on the system as well with Gosu.
Parent - - By jlnr (dev) Date 2012-03-02 13:26

> I presume that Gosu is pretty much agnostic as to whatever Linux distribution it's compiled on as long as the prerequisite libraries are present.  Correct?

Right. Debian would be easier because you can just copy the apt-get command, given all dependencies of course.

KidsRuby has some Gosu in there, doesn't it? I have a note on my list to check it out!
Parent - By mpthompson Date 2012-03-02 17:05
The basic distribution of KidsRuby does indeed include Gosu as part of the installation (at least on Windows).  That's actually how I came across Gosu. 

I've dabbled with Ruby for the last 10 years and always thought it would be a great learning language.  Now that my 10 year old son is expressing an interest in learning to program I picked up the "Learn to Program" book by Chris Pine and KidsRuby and have been working with him and an older kid in our neighborhood.  Now that they have the fundamentals of Ruby down, I'm introducing them to creating very simple things in Gosu.  What I really like about Gosu is that it's simple and very easy to get things moving about on the screen under keyboard/gamepad control.  I've recently been showing them how to create a simple Breakout game, but they can eventually learn to create very sophisticated games if they are so motivated.

I taught my older daughter Scratch a few years ago, but she so quickly ran into the limitations of the environment that she lost interest.  I'm hoping that with Ruby/Gosu that will be less of an issue, even though the initial steps of actually writing code are harder in Ruby than the simplicity of the Drag and Drop environment of Scratch.  I believe Scratch is brilliant, but the folks at MIT need to evolve it much, much further than they have.

What would be ideal for me would be a "Learn to Program Games" book that is very similar in style to Chris Pine's "Learn to Program" book, but more oriented towards applying what is learned about the Ruby language directly towards game programming.  For now, I have to show the kids how to make that leap from learning the Ruby language to using what they learn to create a game.  I'm an engineer rather than a teacher by profession, but I hope I can get the kids hooked enough on creating programs before they loose interest.

That's also my interest in the Raspberry Pi.  The coolness of the device could help keep the attraction long enough to help kids make the transition to programmers.

Sorry to ramble, but the bottom line is do check out KidsRuby.  The environment is a bit rough around the edges and I'm certain they could use feedback from someone who's very experienced with Ruby and game programming.
Parent - - By jlnr (dev) Date 2012-03-02 13:29
Another thought: Both SDL and pygame only provide bitmap-based 2D graphics, not 3D-accelerated ones. Maybe Gosu could even be the first accelerated framework to be fun on the Pi! Aaah, days are too short!
Parent - By mpthompson Date 2012-03-02 17:30
Things are looking a little more promising towards getting Gosu running on the RPi.  Using the Debian SD Card Image provided by the RPi Foundation and the QEMU emulating a generic Arm environment (the right CPU is emulated, but none of the RPi specific hardware is available) I verified that that each of the prerequisite packages are available using apt-get.  I presume this should mean Gosu should at least compile cleanly even if it won't run because of a lack of OpenGL hardware.  Perhaps it is just twiddling some #includes, #defines and #ifdefs for OpenGL ES. 

On the disk image, the RPi foundation provided the following header and library files which I presume includes everything that would be needed to compile against.



Unfortunately, the SD image is only 2GB is size and I ran out of filesystem space installing all the dependent libraries and compiling Ruby 1.9.2.  I'll need to figure out how to create a larger filesystem before seeing if I can get a clean compilation of Gosu.
Parent - - By mpthompson Date 2012-03-02 20:56
With the Raspberry Pi SD image and the QEMU emulator, I was able to get a clean build of Gosu as a Ruby Gem.  On a whim, I tried to run the 'Tutorial.rb' example under the emulators X Windows environment and I received the following error:

$ ruby Tutorial.rb
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  1 (X_CreateWindow)
  Serial number of failed request:  47
  Current serial number in output stream:  48

I presume the X request failed because certain features of the X server are not present as required by Gosu.  With a clean build of the existing source code I'm very eager to get my hands on some real Raspberry Pi hardware to see what minimal changes to the Gosu Gem might be needed to get it running.
Parent - - By jlnr (dev) Date 2012-03-03 07:51
Thanks, awesome news all around. :) My only worry is that X11 API calls are hell to debug. Not yet sure what could go wrong there...I guess I can should add more error checking to WindowX.cpp next time I touch it. (Even better would be to finally use GLFW, I hope somebody patches GLFW to work on RPi!)
Parent - - By mpthompson Date 2012-03-03 19:37
I'm going to leave it here until I get my hands on the actual RPi hardware.  The X server under QEMU only supports 16 bit color and almost certainly has many other weaknesses that may be getting in the way.  What's nice is that soon as I get the RPi hardware I can burn the filesystem I'm using under QEMU to an SD card and work out whatever final tweaks are needed to get it running.

BTW, the error is the same one described by others using Gosu on Debian in the links below.  Was there ever a resolution to these:
Parent - - By jlnr (dev) Date 2012-03-04 07:42
Those are quite a bit ago...I *think* kyonides ended up figuring it out, but even then I'd have no idea how.

Probably best to move Gosu over to glfw and blame everything onto them *cough* :)
Parent - - By Jamer Date 2012-03-07 07:53
Hmm. Maybe I will try to take another look at doing that during my summer break this year.
Parent - By jlnr (dev) Date 2012-03-07 08:38
In addition to Gosu's official glfw fork, Hanmac on IRC has been trying to push the GLFW guys forward so he can finish his own glfw fork of Gosu... happily it seems like glfw is inevitable already :)
Parent - By Jamer Date 2012-03-07 07:47
Can you run other GL apps, or use PyGame successfully in your emulator?

Is this Gosu specific?
Parent - - By mpthompson Date 2012-07-15 03:39
It's been a few months since I asked about getting Gosu to run on the Raspberry Pi.  Since then, I've created the Raspbian operating system ( which is essentially a full recompile of Debian Wheezy (35,000+ binary packages) optimized to support the armv6 and hard floating point instructions of the Raspberry Pi CPU.  The rebuilt operating system has been so well received that it is becoming the default operating system image distributed by the Raspberry Pi Foundation.

So, this brings me all the way back to getting Gosu building on the Raspberry Pi.  Now that I have Raspberry Pi hardware, I've discovered the Raspberry Pi only supports a simple frame buffer for the X windows environment.  There is no hardware acceleration and there probably won't be a quite a long time.  This is one of the sore points of the Raspberry Pi as it limits what can be done in X a great deal.  It is also fairly sad because the Raspbery Pi actually has a rather powerful GPU.  However, OpenGL ES is fully supported by the GPU outside of X windows and it seems that it should be possible to get Gosu building and running under OpenGL ES.

It is my goal in the short term to get Gosu and the Ruby bindings running under the OpenGL ES libraries outside of X.  With hard floating point operations for physics modeling, GPU support for fast accelerated graphics and the ease of Ruby programing, Gosu/Ruby could potentially be a powerful educational gaming environment on $35 hardware.  The folks at the Raspberry Pi Foundation are looking at Python/Pygame on the Raspberry Pi to teach kids programming, but I'm hoping I could make a compelling case for Ruby/Gosu as viable alternative.

In any case, now that I have Raspbian under my belt and I'm in contact with a lot of enthusiastic Raspberry Pi developers, we'll see where this effort goes.
Parent - - By jlnr (dev) Date 2012-07-15 07:06
You can easily find the bits that are OpenGL ES specific by grepping for the GOSU_IS_IPHONE macro in the Graphics/ source. In retrospect, that macro is not very sensitively named. :D

How would you open a "window" without X though? Sounds exciting in any case!
Parent - - By misbehavens Date 2013-08-26 20:57
Now that Raspbian is the default OS on Raspberry Pi, many people are starting to learn Python instead of Ruby since Python and pygame are installed by default. I have been very interested in getting Gosu running on the Raspberry Pi ever since mine arrived at my door earlier this year. I would really like to see Ruby as a viable language for programming things on the RPi. I found a repo of OpenGL examples in Ruby here: I was able to get the examples running without starting X and running Ruby 2.0, both good things! I'm not sure what's involved in updating Gosu to run on the Raspberry Pi but I would like to help in any way that I can.
Parent - By jlnr (dev) Date 2013-09-01 10:37
As a complete outsider, I am still not sure if using X11 is the right way or not … :) Maybe it would be a good stop-gap measure so that input works right away?

What is needed for an X11 OpenGL port is probably only some #ifdef magic in WindowX11.cpp (not the prettiest part of Gosu…) to create an OpenGL ES context instead of 'desktop' OpenGL, and a lot of #ifdef refactoring to check for a (new) GOSU_IS_OPENGL_ES define instead of GOSU_IS_IPHONE; the latter is what enables OpenGL ES in Gosu's graphics system.

See also
Parent - - By Jamer Date 2012-03-07 07:46
Didn't Gosu switch from SDL_mixer to libsndfile on Linux?
Parent - By jlnr (dev) Date 2012-03-07 08:39
Good point. I have no idea why SDL_mixer is still in the list of requirements in the wiki... o_O ...*makes a note to investigate*
Up Topic Gosu / Gosu Exchange / Gosu on Raspberry Pi?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill