Tuesday, October 11, 2011

Time again for Tux4Kids

I haven't had much time for Tux4Kids over the last few months.  We didn't participate in GSoC this year, and I have been very busy with my "real life".  I traveled to Korea for three weeks last summer for professional reasons, and I trained for and completed the 2011 Chicago Marathon on October 9 as a fund raiser for the American Liver Foundation.

However, with those things out of the way, I should have time to get back to some hacking for the next few months.  I hope to get both Tux Math and Tux Typing moving forward nicely.

Thursday, May 12, 2011

Tux4Kids on MacPorts; Google's text-to-speech

TuxMath-2.0.3 on MacPorts

As of last week, users of  MacPorts now have access to the latest TuxMath (version 2.0.3) with a simple "sudo port install tuxmath".  For those unfamiliar with MacPorts, it is a project reminiscent of the FreeBSD Ports Collection that aims to bring thousands of Free/Open Source applications to the Mac OS-X desktop.  TuxMath and Tux Typing have been in MacPorts since early 2008.  I have long been a big fan of package management as epitomized by Debian's Apt system, and felt that Windows and OS-X users have never known what they were missing.  It seems sad and ironic that with the general public, Apple is widely credited with the idea of having a platform provide a centralized source for it's users' software.  I'd love to see Debian come up with the guts to call its repositories "The Apt Store".  Anyway, Mac users with MacPorts can now test out the latest new features of TuxMath on their favorite platform.

There are two known bugs with TuxMath-2.0.3 on the Mac, AFAIK.  First, there is a display problem when the program is run in windowed mode ("tuxmath -w" on the command line) that causes scaled SVG images to be translucent and purple-tinged, very likely some sort of transposition of the RGBA values of the pixels.  The relevant code lives in src/t4k_loaders.c in t4k_common.  Second, the network game has one serious glitch - if the Mac client is connected to a tuxmath server on another machine, it does not remove the comets from the screen when another player answers the question correctly.  The causes of these bugs aren't yet clear - hopefully someone will have time to get to the bottom of this before too long.

Text-To-Speech in Tux Typing?


For some time, I've wanted to add TTS support to Tux Typing, having the program "say" each word when it is correctly typed.  This would be great for younger kids who are just learning to read, making Tux Typing into a "learn to read" program as well as a "learn to type" program.  In the past, we considered trying to do this using the FOSS Festival package, but decided it would add too much complexity and "bloat" to the program, and also that too many languages in Tux Typing lacked Festival voices.

I recently came across the TTS aspect of Google Translate, which provides not only machine translation but decent speech synthesis for the large majority of languages supported by Tux Typing.  It turns out that it is quite a simple matter to send the text to Google Translate using wget as the "browser", and save the returned mp3 file for local playback.  Importantly, the current locale selection can be followed to provide pronunciation in an appropriate voice for most of tuxtype's language-specific "themes".  It took me less than an hour of Googling and hacking to put together a "proof-of-concept" modification to Tux Typing that works exactly as intended.

Unfortunately, my proposed use of the TTS feature of Google Translate isn't actually allowed under Google's terms of service.  I don't think Google would really care, but it isn't a supported API, and thus could break at any time, which might make our users mad at us and at Google.  So, I was strongly discouraged from putting this into a public release of Tux Typing as an official feature.  I asked if it Google would consider making TTS an official API, and was told that my suggestion would be passed along to the relevant folks.  I'm not holding my breath, but I would not be shocked if Google TTS eventually becomes officially usable by apps such as ours.

Of course, there are drawbacks - this would make our Free program dependent for this one feature on a cloud service that is merely gratis, rather than libre.  Depending on how we implemented it, the feature also might require an internet connection to work, which would be less than ideal.  However, it was a good illustration of the power of the cloud model - I was able to add TTS support to tuxtype with one line of C code and a tiny BASH script, plus the freely available wget and mplayer.

For anyone who is interested, this hack is in the "origin/origin/google_tts" branch of our git repository at Alioth.  If Google makes TTS officially available as an API, I will put some variant of this feature into future public releases of Tux Typing.

Wednesday, April 27, 2011

TuxMath 2.0.0, 2.0.1, 2.0.2...

TuxMath got a lot of attention during Google Code-In 2010, with literally dozens of enhancements submitted by the 13-18 year-old contestants from Nov. 2010 to Jan 2011.  In particular, Aviral Dasgupta and Johndhel Maceda contributed valuable patches, with Aviral earning enough points to become one of the grand prize winners for the overall contest.  Unlike many of our Google Summer of Code projects, which have often focused on infrastructure not readily visible to the user, the GCI stuff was mostly highly visible.

The "Factoroids" minigame got a heavy makeover.  In its original conception, the player had to type in the answer while steering the ship, an awkward experience akin to texting while driving, with a similar risk of crashing into the asteroids while distracted.  The new gameplay instead lets the player toggle between "prime number guns" (an idea suggested by SDL leader Sam Lantinga, btw), with a new prime factor added for each level.  Also, the player can now control the ship with the mouse, using the scroll wheel to select the "weapon", and there are three different power-ups to be earned.

The main comet game had lesser changes.  At the suggestion of a user, we decided to change the decade-old behavior by having comets with the same answer all get zapped simultaneously.  The comet game also has a new power-up, with special horizontal comets earning a single-use "smart bomb" that zaps everything on the screen.

We also added new game music as well as "tool tips" for the menu system.

Under the hood, more code has been moved from TuxMath proper into the t4k_common library, which will also be used for the next release of Tux Typing.

So, with all this exciting new stuff, I was quite eager to get a new release out to our users.  By early April, it seemed that all the tough issues were resolved, and a release would be "just around the corner".  As our last release was 1.9.0, and our audience might not "get" a release numbered 1.10.0, we decided to make this version 2.0.0, the "version 2" release.  I posted a "2.0.0-pre1" release for a few days, didn't hear any negative feedback, and decided to go ahead.

Unfortunately, it is hard to resist slipping in one last feature, optimization, or other enhancement, and in doing so I managed to put an important bug into the "final" 2.0.0 release.  Most of the program worked fine, but the asteroid numbers didn't get drawn in Factoroids because the font size got left at zero.  Embarassingly, that wasn't detected until after 2.0.0 was posted.  So, I decided to create a 2.0.1 release during a two-hour airport layover with my trusty Dell Mini 9 Ubuntu netbook.  That was also a problem - I could create the win32 crossbuild, but didn't have access to a Windows machine to test it on.  It turns out that the version of NSIS in Ubuntu Jaunty on the netbook creates broken installer files.  Since I didn't know that, I posted a broken 2.0.1 build.  I wasn't able to do much about it until I returned from vacation, and today I posted TuxMath-2.0.2, which AFAICT fixes these problems.

So - I guess it shows that I don't do this stuff for a living.  But that's the beauty of the Free Software world - all these releases are free, and if something is broken, users can look forward to the next one, or contribute to fixing it themselves.  If my volunteer efforts aren't perfect, I don't have to feel like I have taken advantage of my "customers", and they have little reason to be upset with me.

Which leads me to an article in the latest FSF Bulletin (issue 17), "When Free Software Sucks", by Benjamin Mako Hill.  The basic point of the article is that Free Software is useful and valuable even in an immature or incomplete state, because there is nothing to prevent anyone from correcting the deficiencies.  So, while I still feel rather bad that I rushed out a couple of basically broken releases, it is all done in a good-faith effort to create useful software for children, which is nothing to be ashamed of.

"We claim not perfection, but progress"

Monday, April 18, 2011

Start of Tux4Kids Blog

I am starting this on the heels of the release of TuxMath-2.0.0, which I believe is the most important upgrade since I became the maintainer of TuxMath five years ago.

The purpose of this blog is to share some of the visions and goals for Tux4Kids.  Our software is acceptably well-known within the Free Software, a.k.a. "Open Source", a.k.a. "Linux" community, but it could be a much bigger thing than it has been so far.  We remain quite a small project.  I probably account for 75% of the commits to our SCM most of the time, with periods of enhanced participation from others, mainly due to Google Summer of Code or Google Code-In.

For now, I intend to write something on perhaps a weekly basis, a "Tux4Kids Weekly News", if you will.