Wednesday, October 28, 2009

Frets on Fire for Maemo - Update

Back in March, when Fremantle SDK was released, I had ported Frets on Fire to it. Subsequent discussion made it clear that modifications were required to actually make it run on the device. I created a stripped down version which could run without the OpenGL code. This made it suitable for n900 (and even n810). But due to lack of actual device, I couldn't test it.

Fast forward 7 months. Now I have access to actual n900, so recently I went back to the FoF code. After couple weeks of getting re-acquainted with the code, I have it satisfactorily running on the n900.

Frets-On-Fire code primarily has three parts -
  • playing the song (loading song, computing notes, etc. uses pygame for audio),
  • showing the visuals (PyOpenGL+pygame code) and
  • handling input.
All these components are pretty involved and hard to rewrite - especially so with the audio part (I hardly have any experience in musical notes and midi files). So my priority was to get almost all of the audio code as it is. It was easy to tweak the input code - to make it suite the n900 keyboard. I bypassed the visual part completely - replaced OpenGL with simple pygame sprites. (You may get disappointed by the stark looks).

I have created a project on googlecode to host the code - maemofof. It shows all the changes I had to make, starting from the base Frets-on-Fire code from v1.3.110.

The next step is to package it nicely and push to extras-devel. There are few problems with packaging though.

I couldn't get ogg files to play through pygame. I installed the ogg-support package, but for pygame/sdl to work with it, something more is required - which wouldn't install due to broken dependencies (libsdl-mixeroggwav1.2-dev). So for now I converted all ogg files to wav. But the wav files are huge (~80MB if a single song is included as sample). That makes them inconvenient to package and they also take a long time to load (~90 seconds).

But good news is, the ball got rolling again. I hope to make some progress in coming days. If you have any suggestions, feel free to chime in comments.

4 comments:

Mikko said...

libsdl-mixeroggwav1.2-dev is not broken, it's just not meant for what you were trying to achieve.

You would need sdl and pygame compiled with ogg support, but it's not going to happen with Nokia supplied sdl.

Jayesh said...

Thank for the info.

>libsdl-mixeroggwav1.2-dev is not broken, it's just not meant for what you were trying to achieve.

I didn't say it's broken. I said it has broken dependencies. I get errors in apt-get install.

> You would need sdl and pygame compiled with ogg support, but it's not going to happen with Nokia supplied sdl.

That's like good news and bad news. Let me see if building my own sdl/pygame with ogg support is a feasible solution or not.

Omer said...

Hi!
Thank you for your hard work!

Has there been any progress since October?

Jayesh said...

> Has there been any progress since October?

Sadly no. The modified lite version runs satisfactorily on n900 - the catch is I did it by converting all sound files to .wav format. I assumed it will be trivial to somehow get .ogg files running through SDL later on. But that turned out to be wrong. Check out the discussion on this bug:

https://bugs.maemo.org/show_bug.cgi?id=176#c131

AFAIU after many requests ogg is now playable on maemo. However, it's still not playable through SDL - at least not through the SDL library that ships in fremantle.

Without Ogg, packaging of the game is impractical. The .wav files are huge in size (IIRC total size of minimum required files exceeds 50MB at least).

Maemo lacks SDL+OpenGL support, so I worked around that and created graphically lite version. However my coding experience with linux audio and codec has been a failure mostly. So I don't know how to deal with this lack of SDL+Ogg support.

As I mentioned in the blog post, the working version is available in the googlecode project I've setup. I will be glad to accept patches.