raymario

Last year I was in quite a Super Mario phase. Played the old games and finished them for the first time! Always wanted to write a similar game. My plan was to find an existing clone and play a bit with its code. After some googling I found a video on Youtube.

raylib

Raylib was the game library used by raymario. It didn’t have a package for openSUSE (or any other Linux distro for that matter) yet, I decided to start with creating one.

The first error I got when building the package was:

raylib no-rpm-opt-flags <cmdline>:rlgl.c, core.c, audio.c, shapes.c, models.c, textures.c, text.c, utils.c, external/stb_vorbis.c

Looking at their Makefile I saw that they overwrite the CFLAGS and don’t just append them. Pull Request changed that.

Furthermore their make install doesn’t seem to work. But honestly that Makefile is a bit of a mess. They have paths (/usr/local/include for example) hardcoded in their Makefile. They also don’t use library versioning.

After trying to figure things out I decided that it will be easier to write a new meson file. I intended to learn/use meson for something anyways so that was the chance ;)

Commit 9c524ee adds a basic meson file. Much shorter, much cleaner to read. Later I added several other things to it.

This was nice for me to get some experience with meson and quickly create a package. Later however raylib added CMake support and I recommended to remove meson, since having 3 build systems just will lead to very different results depending on which build system people use. After having library versioning and everything important to me in CMake, plus some additional stuff that was in the Makefile but not in the meson file there was no reason to keep the meson build files around.

Package

The raylib package lives now in the devel:libraries:c_c++/raylib devel project and is part of openSUSE Tumbleweed and future stable releases (Leap 15).

Install instructions were added to the raylib wiki.

So package of raylib 1.7.0 was available for openSUSE in May 2017 and version 1.8.0 was part of the official distribution in October 2017.

Again we were the first distro to have it. In June 2017 raylib was added to the Arch AUR, but they used the Makefiles to build it and thus didn’t have library versioning.

Now in February 2018, people are working on a FreeBSD port.

raymario

I emailed Víctor Fisac and asked him if he could send me the source code of raymario and whether I can publish it. He agreed. I cleaned up the code a bit, adapted to the newest version of raylib, wrote a meson build file for it and put it on GitHub.

raymario

Shortly after I started using meson gnome-builder added support for it. So now a nice side effect of using meson as a build system for raymario was that I could comfortable use Builder. It’s a very nice IDE. Honestly I always used vim and meson build; cd build; ninja; cp raymario ..; cd ..; ./raymario to develop.

This was because raymario looked in the relative folder /resources for its images and sound files.

Only yesterday I learned how to do it properly. Actually meson should install the resource files. And one should run ninja install to then have the raymario binary and all the resource files installed.

Now Builder can be used very comfortable.

The End

raylib was developed by raysan who, as far as I know uses it to teach videogames programming in Barcelona. raymario was a student project of Víctor Fisac.

I think what I described above is now a very nice base for students who want to experiment with games development.

openSUSE is a great distro. It offers everything one needs and is very stable, even in the rolling release variant Tumbleweed. Raylib is now easily installable via YaST or a simple zypper in raylib on the commandline.

Then they can use Builder and meson to comfortably write their own projects.

Or start off by cloning raymario and editing the source code to their liking. Builder makes cloning easy too, for students who are yet afraid of using git on the commandline:

builder

They can build the whole thing with a click of a button and debug through the code to see what it does.

In the raylib community I saw that many uses Microsoft Windows because it is allegedly easier. Now I have to say, using openSUSE to start developing your games, sounds much easier to me!

Why

I got some feedback from people who don’t see why it’s easier. I try to list some more things just to give hints:

This means you can get started with writing your game in probably 2 minutes (depending on how fast your internet is).