Tuesday, November 9, 2010

Let's Forget about UIs For Now -- Opensim

I was going to post about Java Swing as a UI frame work but I got bored with that. Instead I worked on getting an instance of OpenSimulator running on my Mac Pro.

I used use Secondlife, the virtual world developed by Linden Research, a good bit. I am not particularly interested in online role playing in any form, although I used to do table top, and buying tons of virtual clothes doesn't interest me that much, though I admire the artistry behind them.

I enjoyed the surrealism of SL and wanted to find out what went on behind the scenes to make a virtual world work. I quickly learned the basic techniques for building objects out of secondlife primitives and perused the SL Wiki to learn about the basic structure of Linden Scripting Language (LSL) scripts.

I then hit a bit of a wall. To make good looking content you have to be able to upload your own textures and animations into Second Life. Doing this requires making a micropayment to Linden Labs, something I didn't want to do. Also, my children, God bless them, discovered how to use my account to buy virtual goods, something I didn't want.

I probably could have come with a better use of my time, but to be able to privately develop Secondlife content, I decided to load OpenSimulator, an open source package providing similar functionality on to my machine. The first problem with this was that OpenSimulator is written in C# a Microsoft developed language not native to the Macintosh. Now, C#, like Java, compiles not to native machine code, but instead to code for a virtual machine that runs on top of the native hardware.

To run this on a Macintosh, the OpenSimulator web site suggested, you need a program called mono to act as an interpreter for the compiled C# code. I downloaded and installed this and then downloaded an OpenSimulator tar ball. Once I extracted OpenSimulator from the tar ball and tried to run it, it failed, something not unexpected with open source software, which typically doesn't provide a lot of handholding.

Digging around in the opensim.ini configuration file and the OpenSimulator wiki, I discovered the reason for this. OpenSimulator like most modern software uses a relational database to store all sorts of information. Out of the box it was configured to use the SQLite database, the same one provided in IPhones and Droid smart phones.

A version of of SQLite does come with MacOS, however, OpenSimulator is not compatible with it out of the box. The three choices available were to, configure it work with the older version on the Mac, upgrade my Mac's SQLite software, or install MySQL, an open source database widely used in industry to store small to medium amounts of data. As I'd worked with MySQL before, I chose that route. Along the way I found out that though MacOS Server has MySQL installed out of the box, vanilla MacOS does not. Fortunately, it was easy enough to install from the MySQL website.

Since OpenSimulator seemed to want to log in to a database named opensim under MySQL, I created this and also created an account under MySQL with all privileges for that database. After more futzing around with OpenSimulator configuration I was able to get two regions, a few square miles of virtual land, up and running. What will I do with it, I'm not sure yet.

No comments:

Post a Comment