Building Virtual Worlds on the #N900
You are in a maze of twisty little packages, all alike.
This is a long article about attempting to build virtual worlds on cellphones. It starts off with some general thoughts and history that I encourage everyone to read. It then goes into some technological details more applicable to geeks. If you are an impatient geek, please skip to the technical discussion.
Perhaps I played too much Adventure when I was young. Perhaps somewhere along the way constructivist theories of permeated my approaches to learning and entertainment. Perhaps my rules about computer games for my children wore of on me. Whatever the cause, I’ve been spending a bit of time trying to build various virtual world tools for my Nokia N900 cellphone.
When my eldest daughters were in elementary school, I told them they could play an computer game that they could write. They played in Logo, they wrote MOOCode, and I hope they learned the joy of creating and of understanding what makes things work the way they do.
As I thought about what to get for a smartphone, I wanted a device that reflected this. I wanted a device that I could get in and write my own programs for. Yes, I could have chosen to become an iPhone developer. Friends have done that. But the iPhone needs to be jailbroken if you want to really have fun with it. Android looked like a much better platform, and I almost went that way. Yet many Androids are also locked down pretty tightly. So, when Nokia came out with a linux based cellphone that is about as open as you can make a cellphone, with some pretty nice features as well, it became a clear choice for me.
One of my early projects was to install Squeak on my N900. Squeak is a Smalltalk programming environment that is particularly popular amongst constructivist oriented elementary school educators interested in teach children to program games. It is also the basis for some interesting virtual worlds projects. Unfortunately, the font was too small and I hadn’t gotten reading glasses yet, so I put it aside for the time being. One of these days, I’ll come back to it and figure out how to resize fonts and objects.
As I watched the Olympics last winter, I thought further about virtual worlds on the N900. What I would really like to tackle is building a Bobsled in an Open Source Mobile Virtual World Experience on the Nokia N900. At that point, I considered trying to build the Naali viewer to connect to OpenSim virtual worlds.
There were various N900 programmers interested in this, but it also got put on the back burner.
Yesterday, in response to recent developments in virtual world education, I wrote about Running OpenSim on a SliceHost VPS. John Lester, commonly known as Pathfinder in the virtual world communities went one step further and wrote a great blog post about Running OpenSim and Imprudence on a USB Key. He spoke about having a virtual world in his hands, a world of his own creation, using pieces that he had built or borrowed from other virtual worlds.
Two days earlier, he had written a great blog post about the current turmoil in virtual world education, With every Exodus comes Expansion. His efforts to hold a virtual world in a USB key in the palm of his hand, I believe, is simply a starting point for this great new exploration. With the USB key as a guidepost and previous experience to build upon, I felt it was time to start exploring a world within my N900.
At this point, I will move from narrative to a hacker-adventurers log. If you are less geeky, you may want to skim over this section. It documents my exploration of the maze of twisty little packages I have just started exploring. I realize I may lose a bunch of people at this point, and may have already lost quite a few. However, I encourage you to read this to get an insight into what can be the joys of exploring computers and virtual worlds on mobile devices.
Mono for Maemo
As I entered the maze, the first path I decided to pursue was getting OpenSim up and running on my cellphone. Opensim runs on Mono, a cross platform, open source .NET environment. So, the first step was to try and find Mono on the N900.
As is often the case, other people have gone down this path before and left markers. In the discussion, Mono 2.4.3 on Maemo, I found a debian repository with Mono for Maemo. I added it to my list of repositories in /etc/apt/sources.d/, ran an apt-get update, and then tried to find what to install. It looked like the package I wanted was mono-runtime, yet I couldn’t find it in the cache. In the end, I grabbed the package from the repository with wget and used dpkg --install to install it.
It installed without a problem. However, it didn’t bring in any of the related packages and was for all practical purposes useless. Using apt-cache search, I found all bunch of mono libraries and installed them. At this point, Mono started working on the N900.
ASP.NET and Lighttpd on the N900
As a brief diversion, I thought I would explore another path briefly. A couple months ago, I installed Lighttpd on my Nokia N900. Lighttpd is a light weight, but powerful webserver. I got it running nicely on my N900, and made it available over IPv6. During my testing, I configured it to support PHP, Perl, Ruby and Python. I wondered if I could get it to support asp pages as well.
There are various , which allows for asp pages on Apache servers, not working nicely with php. So, I’ve held off on experimenting with that on my linux servers. That is another path to explore later on. Yet could I use mono to make asp pages work on my lighttpd server on my N900?
The FastCGI Lighttpd configuration page talks a little bit about how to do this, but I wasn’t finding the pieces I needed from my N900 install, so I’ve set this aside as another path to explore at a later day.
Starting Opensim on the N900
Well, with Mono now running on my N900, I figured it was time to try and fire up OpenSim. The easiest way, it seemed, would be to use sshfs to mount the Opensim directory from my Linux server as a subdirectory on my N900. I’ve often done this and highly recommend it as an easy way to do some testing.
At a command prompt in the mounted OpenSim directory, I typed mono OpenSim.exe. Low and behold, it started running through the startup process. Since I had run OpenSim in this directory on my Linux server, it started up nicely, recognizing the configuration and database I had already created. However, it crashed when it got to loading the OpenDynamicsEngine physics. Note to self: Change the physics to basicphysics and come back later to see if I can figure out how to get ODE physics running on the N900.
With this, I got much further. It loaded assets and started setting up the region. Then I got the error:
22:48:51 - [MODULES]: Loading Region's modules (old style)
22:49:03 - [MODULES]: Could not load types for [MySql.Data, Version=220.127.116.11, Culture=neutral, PublicKeyToken=c5687fc88969c44d]. Exception System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at System.Reflection.Assembly.GetTypes () [0x00000]
at OpenSim.Region.Framework.ModuleLoader.LoadModules (System.String dllName) [0x00000]
Hmm. Mono on the N900 seems to support sqlite3, which is what I’ve been using for my database in these OpenSim instances, but it doesn’t support MySql. Yet it looks like somewhere buried in the modules, is some sort of dependency on MySql. I looked around for a little while to see if I could find some configuration option to get around that. No luck.
So, now I need to either get MySql working in Mono or find someway of getting OpenSim not to require that.
Virtual World Viewers
Being stuck at this road block, I thought the next step would be to see if I could get a workable virtual world viewer running on my N900. After all, as much fun as it would be to have my own world stored on my N900, some of the real bang for the buck comes when you participate in a virtual world with a bunch of friends. Back to the bobsled run, I want to be able to be a pilot, breakman, pusher or fan along with my friends taking similar roles from their mobile phones.
The first viewer I attempted was the Hippo OpenSim Viewer. Hippo seems to be fairly popular and stable. However, there is a big warning about Hippo:
PLEASE DO NOT LOOK AT THIS SOURCE CODE IF YOU WISH TO CONTRIBUTE TO THE OPENSIMULATOR MAIN PROJECT.
This project is based on the original source code released by Linden Labs under GPL.
On top of that, unless you read closely the comment about what to use for a userid and password for anonymous access, you get what you want.
I ended up downloading the whole system using my sourceforge userid and password. I figured I can try building it. If it works, great. If not, I’ll move on and not look at the source code.
The documentation said to try build.sh, but that didn’t work for me. I got closer by running develop.py in the indra directory.
I figured I’d try compiling the trunk version. It failed saying that I needed version 4.3 of g++. I tried v0.6.2_LL1.23.5. It failed saying I need 4.1 of g++. The Linden release got much further. I managed to get into the build process. It wrote out the cmake command it was trying to process and gave a message about building with OpenAL support. It pegged the CPU for a while, and then stopped doing anything. After killing and restarting it, I made it through much further, ending up with
[ 0%] Building CXX object llcharacter/CMakeFiles/llcharacter.dir/llcharacter.o
In file included from /home/aldon/opensim-viewer/linden_release/linden/indra/llcommon/llthread.h:35,
/home/aldon/opensim-viewer/linden_release/linden/indra/llcommon/llapr.h:43:29: error: apr_thread_proc.h: No such file or directory
The next viewer I tried to build was Imprudence. A lot of people have said good things about this, and it looks very promising. I repeated processes very similar to what I tried with Hippo and ended up with very similar results, a make process that went idle and never completed.
A particularly interesting viewer, and one that I was thinking about when I wrote about bobsleds is Naali. It is also worth noting that Naali is written in Qt, which a lot of N900 apps are written in. My attempts at building Naali haven’t been much more successful than my attempts at Imprudence or Hippo. Naali depends on Boost. I built boost in my sandbox, and it looked like it ran properly. However, I can’t find Boost, and more importantly, neither can the Naali build process.
So, there we have it, a long exploration of twisty little packages. Today’s adventure didn’t end up getting anywhere special. Time to put these projects aside for a little bit, and focus on a few different projects. Hopefully, I will find some clues to help me next time I play this game and get a little bit further. If you are on a similar quest, or have suggestions, let me know.