Using Streaming Audio

To get streaming audio into Opensim/SL is a breeze. Just follow these instructions:

1. Download the free software
Download Broadwave Streaming Audio Server (free). When the webpage opens, click the Get It Now button.

2. Give it an mp3 file
When the software has installed and is running, go to the toolbar, and click on Options, Audio Files, and Add an mp3 file from your hard-drive. Click on OK. The server should now show a varying green bar, showing that the mp3 file is playing.

3. Connect locally
Click the Connect button. A webpage will open, containing links. Click the Broadwave Playlist, Broadband Stream, Windows Media link. Windows Media Player should now open in your browser and start playing the mp3 file.

Now that the first goal of getting the server delivering a streaming mp3 to your media player, in local mode, it is now time to broadcast to the internet.

4. Open your Router for TCP Port 88
If you use a router with an in-built hardware firewall, then you need to configure the router to pass the required port (called port-forwarding). The port that Broadwave needs to be open for inbound traffic is: TCP/88. There are detailed instructions on how to setup port-forwarding on your router on the PortForwarding website. Select your router from the list, then you will be taken to a page that lists most on-line games that need port-forwarding. Choose 3-In-a-Bed, as an example, this uses port 4871, follow the instructions for that, but replace 4871 with 88.

5. Get your current external IP address
You are probably connected to the internet using a dynamically assigned IP address (it changes from time to time) by your Internet Service Provider, and this will be the actual external address of your router. Get the current, external IP address of your router, using this link. Copy this to the clipboard. Mine looked like this: 79.199.93.245

6. Create the Streaming URL
On the toolbar click Options, then General, and under Connection select the 'Use this specified known domain or public IP', then paste your external IP address into the box, and OK. If you now click the Connect button all the links will now have this address inserted. The link here we need is the Broadband Download link, mine looked like this:

http://79.199.93.245:88/broadwave.mp3?src=fBlondie%20-%20Call%20Me&kbps=56

7. Try the URL
Just copy and paste that Streaming URL you just created into any browser. Windows media should now open, and your mp3 should play. Now launch Opensim or Second Life, and copy this URL into the Music URL box, on the Media tab of About Land. Press the music start button, and you should be able to hear your stream!

You can now experiment with several mp3 files, or even stream live music through your soundcard and use that as the source. You may also wish to move this software to a dedicated server, with a static IP address, especially if you want many people to be able to hear your broadcast.

Have fun,

Rock

Performing an Automatic Daily Database Backup

Step 1: Create a Backup Folder
The first thing to do is to create a folder to hold your backups. I created a folder in the root of the c:\ drive

c:\OpensimDatabaseBackup


Step 2: Create a Backup Script Batch File
Open Notepad, and copy/paste the script below into it:

REM Rock's quick database backup script
REM Place this batch file into Microsoft Scheduler, set to daily
cd "c:\wamp\bin\mysql\mysql5.0.51b\bin\"
mysqldump --opt -uroot -pxxxxx opensim > c:\OpensimDatabaseBackup\opensim.sql
cd "c:\OpensimDatabaseBackup\"
ren opensim.sql "%date:~10,4%-%date:~4,2%-%date:~7,2%.sql"

The first line above simply sets the path to the mysqldump command (change to your path)
The second line issues the mysqldump command, the --opt switch makes the backup clean, (change root and the xxxxx for your own user name and password)
The third line changes to the folder where you will be saving the backups (the folder in Step 1)
The fourth line renames opensim.sql to today's date, eg 2008-12-16.sql

Save this script as OpensimBackup.bat
(you can save it wherever you like, but remember its location))

Step 3: Create a Windows Scheduler Task

XP
Go into the Control Panel and select 'Scheduled Tasks'
Choose 'Add Scheduled Task' to start the wizard
Choose the program you want to run (OpensimBackup.bat), Daily, and set the time
Supply the Administrator Password if you are not logged in with Adminstrator privileges.
Click on Finish

Vista
Go into Control Panel, Administrative Tools, Task Scheduler
Choose Action from the menu, and Create Basic Task
Give the Task a Name: such as Daily Opensim MySQL Backup
Give a Description (optional)
Set the Frequency to Daily
Set the Time (I made mine at 4am in the morning)
Choose the Program to run
(OpensimBackup.bat)
Choose to Display Properties when Finished
In the Properties dialog, General Tab, ensure that 'Run whether user is logged on or not' is selected.
On the Settings Tab, ensure that 'Stop the task if it runs longer than' is set to 1 hour.


Hopefully, this should cure your (OMG, what has happened to my database) blues.



Deleting A Region

There are two ways to delete a region, but they both have very different net results if you have objects on the region at the time it is deleted.

However, whether you have objects on the region or not, it is still good practice to use the command specifically developed to delete a region (delete-region ), rather than 'the other way' of simply going into the Regions folder and deleting the unwanted region there.

Deleting a region by deleting the unwanted region in the Regions folder can orphan objects that are on the region in the database. The objects are still in the database, but the region UUID that these objects are flagged as belonging to no longer exists. For this reason I will not pursue this method for deleting regions.

This tutorial will therefore only deal with the 'approved' way, and I will give the procedure for dealing with any objects that may be on the regions at the time.

Procedure 1: Deleting a Region and all the Objects on it
This is the simplest case. Assuming that the region to be deleted is called Alpha, go into the opensim server console and type:

delete-region Alpha

This command will remove the region, delete the Alpha.xml file from the Regions folder, and remove all objects from that were on Alpha from the database.

Procedure 2: Deleting a Region but returning all Objects First
There is no console command (yet) that will do this, so first the landowner (usually the Master Avatar) needs to log into the region, and from his viewer go into About Land (by right-clicking on the ground, or on the Region name at the top centre of the viewer screen), then clicking on the Objects tab. By clicking on the Refresh List button all the owners of prims and the number of prims they own will be displayed. By selecting a name from the list, the Return Objects... button then becomes highlighted, and clicking this will return all of that person's objects. You can continue returning all the objects you wish using this method.

When done, log out, and following Procedure 1 to delete the region.

Procedure 3: Deleting a region but transferring all the Objects on it First
To do this the landowner must log in first, and set the land for sale, by selecting About Land (right-clicking on the ground, or by left-clicking the Region name at the top centre of the viewer screen), then selecting the General Tab, and clicking the Sell land... button.

The price can be set to L$0, but to transfer all the objects to a particular person a named buyer must be entered in the second option box. The third option asks 'Sell the objects with the land?'.

The answer, of course, is 'Yes, sell objects with land', then click on the Set Land for Sale.

The user to whom the objects are to be transferred must then be logged in, the land bought, and then they will receive all the objects. They can then be logged out, and Procedure 1 followed for deleting the region.

Renaming a Region or Estate

Renaming ing a Region Name
I agreed for a friend to take over one of my void regions at the weekend. Her art galleries were to be installed at 1000m, so they would not affect the views or the Ancient World theme on the ground.

Before I renamed the Red Sea 4 region to Gala (the name she wanted for her region), I paused to think of the consequences. I had assumed that changing a region's name would be as simple as renaming the region in the Regions folder, then opening it and changing the sim name inside too.

However, would changing a region's name have any negative impact on prims already on that region? After all, they must be referenced to a location in the database.

The answer is that it was simple. Objects ARE referenced in terms of location within the database, but not by the region name, or the region coordinates, but by the region's UUID. Providing this stays unchanged then you are free to rename a region, or even move its coordinates. I would still backup any objects using save-oar anyway, as it is always a good idea to be safe rather than sorry when making any changes.

Renaming an Estate Name in OpenSim
I wanted to change the default estate name of 'My Estate' in OpenSim, but could not find any info on how to do this. I noticed in the bin folder an xml file called estate_settings.xml, and in there was a setting: estate_name="My Estate", so I changed this to the name I wanted, estate_name="Kemet", and started everything up, full of confidence in my skill and perspicacity. I opened up the About Land, and there it was, Estate name: My Estate :(

Undaunted, I wandered into my database with Toad. There is a table called estate_settings, and in here I found that the name was set to 'My Estate'. A quick edit here to 'Kemet', and I shut everything down and fired it all up again. With somewhat subdued enthusiasm I opened the About Land... Estate Name = Kemet, yay!!!!

Updating the World Map

I have found 1 method to force the World Map to redraw:

a) Stop the opensim server,

b) Open each file in the Regions folder, that you want updating, and set the value for lastmap_refresh to '0',

c) Restart the opensim server and log in,

d) Open the World Map, and over the next minute or two you will see it redraw.

Moving a MySQL Database

While I am waiting for my server (which hopefully be available on either Monday or Tuesday), which has a Windows 2008 Web Server OS, I thought I would have a go at moving my opensim and MySQL database from my home PC to my laptop, to see if it was straightforward. I am glad I have tried to have a go, because I got bogged down for quite a while, but fortunately with the help of DigiDaz from the #opensim irc channel, I eventually got there. Here are the steps:

Step 1: Moving OpenSim
Getting opensim onto my laptop was as easy as copying my bin folder from my home PC onto a memory stick, and copying it onto my laptop.

Step 2: Installing MySQL
I then installed MySQL onto my laptop. When configuring I used the same user name (root) and password as on my PC, I then created an empty opensim database. (see Tutorial 5, in the Main Tutorials, for full instructions on installing MySQL and creating the opensim database).

Step 3: Backing up the MySQL Database
On my PC I made a backup copy of my opensim database. I did this by opening a command console window (go to Start, Run, and type 'cmd' (without the quotes) in the Open: box.). In the command console I typed the following:

mysqldump -u root -p opensim > opensim.sql

This command starts the mysqldump backup utility. The full syntax for this command is:

mysqldump -u [username] -p [databasename] > [backupfile.sql]

where:

username = the user name you use in MySQL, usually 'root' the -p switch will prompt you for the password you use for MySQL

databasename = the name of the database you wish to backup, in our case this is 'opensim'

backupfile.sql = the name of the backup file, can be anything, I chose 'opensim.sql'

Like this.

I had to do a search to see where this file had been saved, I found it in the 'C:\Documents and Settings\Colin' folder.

Step 4: Transfer the Database backup File
I then copied opensim.sql file onto my memory stick, and pasted it in the C:\ root folder on my laptop.

I then opened a command console on the laptop, and navigated to the root folder by typing:

cd c:\

(it is important to be in the same folder as the test.sql file)

Step 5: Restore the Database
I then restored the database by typing at the command console:

mysql -uroot -p opensim < opensim.sql

It was successful and it returned me to the c:\ prompt.

After starting my Opensim, and logging in with my Hippo viewer, I was pleased to see my region exactly as it was on my PC. A very happy bunny indeed, eventually :)



The big benefit of transferring the database, rather than using the console command, save-oar, is that everything is transferred, not just the objects, so all the terrains, terrain textures, users, estate settings etc are all migrated.

Again, many thanks to DigiDaz.

Tips and Tricks

A common pitfall?
I had a friend get very interested in OpenSim, so she downloaded the binary and the Hippo viewer from the OSGrid site. She followed my step-by-step guide to the letter, and it crashed with a 'Registration Failed' error message. I asked her to check that she had set gridmode=false, and she assured me she had. After more 'try-this, try-that' she sent me the contents of her OpenSim.ini file, and it all looked perfect.

I didn't get the clue until I asked her for the OpenSim.32BitLaunch.log, when she said she could not see one called 'log', did I want the notepad one? The problem was that she was using Windows XP, with the default settings for folder view. If you open folder view, either by using Windows Explorer, or via My Computer, you will see in the menu at the top, Tools, go into there and select Folder Options, then choose the View tab, in the Advanced Settings, about 10 down, you will see Hide extensions for known file types. The default setting is 'checked', and this can lead to all sorts of confusion (I told her to uncheck it).

Because the extensions were hidden, when she looked into her Bin folder she saw the file I mentioned, OpenSim.ini, but this was in fact OpenSim.ini.example (with the example extension being hidden), and it was this file she was editing, not the OpenSim.ini file. Consequently, she was opening up in grid mode every time, as the real OpenSim.ini file never got edited. Now that she could see the file extensions, and could edit the correct files, the step-by-step procedure worked perfectly. Keep this in mind if a friend runs into trouble and asks for help.

Using Second Inventory
I wanted to have a go at transferring inventory from SL to my OpenSim, so I purchased a copy of Second Inventory. Basically you fire up SI, and do a backup of the objects, or the folders you want, or the entire inventory tree, to hard-disk. This can take hours for a lot of stuff, so, do it before going to bed, or to the store. Once it is all backed-up on your hard-drive you can then restore to your OpenSim. But, first a few warnings:

a) It will only restore items that are full permission
b) It will not sort the full permission objects for you, you must find them yourself
c) Restore works on one single object only. So it is a lot of work restoring 100s or 1000s of objects.
d) Don't expect complex multi-prim objects, with textures applied, and containing various scripts, anims etc to restore perfectly. It won't. Other than that, it works well.

When is a hole not a hole?
I made a 20 x 20 x 0.5 floor, hollowed it to 40% to use as a pond/pool, and when I walked onto the hole I was amazed to find it completely solid. I had a quick lurk in the #opensim IRC channel, and Jenni there told me the problem, 'use the other mesher' she said. In the opensim.ini file, under physics, you have a choice of two meshers (don't ask me what a 'mesher' is). The default mesher was ZeroMesher, so I chose the other one MeshMerizer. After a restart, I was happily falling through the hole. I wonder why you get a choice of two, one that works, and one that doesn't?

Fixing Bent Leg Syndrome
I noticed that when recreating my SL shape in OpenSim, and using maximum height and leg lengths, I have the infamous bent-leg syndrome (the default OpenSim Ruth avatar does not suffer from this). I decided to have a play with some of the settings in the OpenSim.ini file, in the Avatar Control section. The first I tried was this entry:

; Max force permissible to use to keep the avatar standing up straight av_capsule_standup_tensor_win = 550000

Setting this value higher, to 700000 fixed the bent-leg, but walking up inclines and stairs was quite difficult. I then put that value back to the default value, and tried this one instead:

;girth of the avatar. Adds radius to the height also
av_capsule_radius = 0.37

I was not sure what this parameter actually was (initially), but I tried it lower, at 0.17, and I seemed to have even more bent-legs than normal, so, full of excitement, I then changed it to 0.57, and bingo, bent-legs fixed! I then tried walking up inclines and stairs and no problem :)

However, when I spoke of this succcess in the opensim irc channel I was told by one of the developers that this change would result in my avatar having a bigger radius, in other words, I may have difficulty in walking through narrow doorways, so my vampire coffin weekends would be most definitely out :) He suggested that I play with another setting: av_height_fudge_factor = 0.52 I changed this value to 0.42, and again, success! I will leave this setting as it is.

Accessing your OpenSim locally, when in External Mode
After you have changed your External_Host setting in the default.xml file in the Regions folder to allow visitors to come into your region, you find that you have to come in the same way, and suffer the same lag effects as your visitors. Wouldn't it be nice to be able to access your region locally? Well, you can! Try this little trick: Go into your Windows\system32\drivers\etc\ folder, and look for a file called 'Hosts' (no extension). Open this file with notepad, and add the following line at the bottom: 127.0.0.1 myregion.hostname.com Replace myregion.hostname.com with the actual external hostname you are using.

Basically when you use the external hostname in your viewer, Windows will resolve what IP address this refers to, instead of the external web DNS servers (who will point that address to the IP address of your PC modem or router). In this case, whenever Windows comes across the myregion.hostname.com hostname, it will resolve the address automatically to 127.0.0.1, which as we learnt earlier, is the special address for this machine.

Edit: One or two people have reported that visitors could not log in when using this method. If you have any problems then just remove the entry. Meanwhile, I will look at a more universal solution to logging in locally while visitors log in remotely.

Creating MySQL Database Backups
I have just reached the point where the build in my standalone is sufficiently mature that I would hate to lose it. So, it is time to capture the moment, and make a backup.

Essentially there are two ways of making a backup, a physical backup and a logical backup, and I will describe both. Before proceeding, I created a folder to hold my backups. I have one of these standalone 'Brick' storage drives, that connects to my PC via the USB port, where I store all my backups (in case the HD in my PC fails). I created a folder called 'OpenSim Backup 26 Sep 2008'.

Physical Backup
Making a physical backup is simple, but can be dangerous. You MUST ensure that the database is not in use before doing this, so make sure that your OpenSim server is NOT running! OK, if you are sure that the database is not in use, navigate to the MySQL data folder, on my machine this was located at:- c:\program files\MySQL\MySQL Server 5.0\data

Right-click the data folder, choose Copy, then navigate to your backup folder you created earlier, and Paste it there. Job done.

Logical Copy
To make a logical copy you can use the console command mysqldump, but as always, preferring the simpler life, I downloaded a lovely little application that does that for me. In fact, it is a great little suite of useful application for MySQL, it is the MySQL GUI Tools Bundle for 5.0, and can be downloaded from here. Once it is downloaded, running the download will install the tools under the MySQL folder. Then, go to Start, Program Files, MySQL, and select the MySQL Administrator tool. When the tool starts it will ask you which MySQL server to connect to. For the Server Host enter 'localhost' , for the Username enter the root username that you used when setting up MySQL (in my case, I left it as the default 'root'), and the password you created at the time, and click on OK. The tool will then open, and connect.

To create your backup, simply select the Backup icon on the left-side panel, click on New Project, call it Opensim (don't worry with a date in the filename, it will append the date and time to whatever name you choose automatically). You then select the databases you wish to backup, and I chose avatar_appearance, opensim, mysql, and test (not knowing what was in each of these databases, I decided to back them all up, to be safe). Selecting a database, and clicking on the '>' button moves them to the right-hand pane, ready to be backed-up. Once you have selected the databases to be backed up, just hit the Execute Backup Now button, choose where you want the backup to be stored, and click on OK. Job done.

A Better Console for OpenSim
The other little utility I played with after being recommended it in the #opensim irc channel, is a replacement for the OpenSim Console, which is not very user friendly. The utility is simply called 'Console', and is available from here. I chose Release 2.00

After unzipping the package, you will find in the Console2 folder the Console.exe program, double-click to launch it. To set it up, go into Edit, Settings, and in the Startup dir: navigate to your OpenSim Bin folder, then click on OK to select it. Close the program. Now, next time you start the program it will open in the openSim Bin folder, and you can enter the executable that you normally use for starting the OpenSim Server, either OpenSim.exe or OpenSim.32BitLaunch.exe. You will see straight away how much nicer this console front-end is, much bigger than the Windows console window, and with handy Copy/Paste icons on the Tools bar to make life easier.

Got my own Server

On the 21st October I got my very own dedicated server. The one I went for was the Express Server 6, from Leaseweb. This server came with Duo Core T2450, 1GB of RAM, 160GB SATA II HD, a 100Mbps duplex link, 2GB of data traffic per month, 2 IP addresses, and on a Windows 2008 Web Server platform. Total cost, €49/month.

Smallprint
Things in the small print I should have read first: 1) After paying for a 3 month contract, by bank transfer, I immediately got another invoice for another €15. This was because the contracts only run from the start of the month (so in my case, that would be from the 1st November), so I was being charged for the rest of the current month of October. 2) Technical support is by email ticket only. This can then be a lengthy process if the engineer has to ask you several questions by email exchange if the server is down or misbehaving for any reason.

Getting Opensim Installed
I was told to await an email, with my login details, which would signify that my server was installed and ready. I duly got the email on the 21st October, informing me of the IP address of the server, and the System Administrator password.

To log in, I used the Windows Remote Desktop, which I found in Start, Programs, Accessories, Communications, Remote Desktop Connection (I dragged a copy of this to my desktop). This widget comes as standard with Windows XP Service Pack 1, and XP Professional, but if you have an older flavour of Windows and you do not have it, you can download it from here. I then entered the IP address I was given (the one in the picture I just made up), and it connected right away and presented me with a login screen for my server.

There were two login Users, Colin (that's me!) and Other User. I tried the password in the Colin box, but it did not work, I then created another user, called 'System Administrator', as it said in the email, but the password did not work there either. Starting to panic I little, I did a Google search for Leaseweb login problem, and I immediately found a discussion forum where someone was having the same problem. The advice given was to create a User called 'Administrator' and use the password with that account. That solved it, panic over (for now). I was connected directly to my server's desktop, as if I was sitting in front of it with my monitor, keyboard and mouse (although a little slower, of course).

I first tried to copy/paste the bin folder from my PC to the server, but the Paste function was greyed out on the server. A little more Googling, and I found that this had to be enabled explicitly, by choosing Options on the Remote Desktop widget, selecting Local Resources, and checking the Disk Drives box. I then went back to the General Tab, typed in my password, and saved the connection details in the default.rdp file so I would not have to enter them each time I wanted to connect to my server.

TIP: Do not copy your bin folder to the server using Remote Desktop, nor the installation file for MySQL, these files are quite large, and the connection speed (upload speed) provided by most ISPs is very slow (compared with their advertised download speeds). Instead, use the Internet Explorer on the server to locate the latest OpenSim binary download from the OSGrid website, and download the MySQL installer file directly from their website. These files downloaded in seconds, whereas the copy/paste method from PC to server can take over an hour.

The only files I then copy/pasted, which were quick, because they were small, were the Opensim.ini, and default.xml file from my Regions folder. There was one other file I needed to copy/paste, which was quite large, but there was no other way to do it, more on that next.

I then installed MySQL, and when it was complete, and I had created the opensim database file, I copy/pasted my opensim.sql file into the c:\ root drive (see the details on this in the Diary entry for the 18th October).

Poking Holes in the Firewall
Otherwise known as Port-Forwarding. The email I received from Leaseweb advised me that IP Filtering was Enabled, and that the only ports that were open were TCP Ports 21, 80, and 3389. I had no idea what IP Filtering was, and I spent a lot of time barking up the wrong tree, before DigiDaz on the #opensim channel came to my rescue, once again, and told me that IP Filtering Enabled simply meant that the Windows firewall was switched on!

In order to open the TCP 8000-8005, TCP 8895, and TCP/UDP 9000 ports, I went into Control Panel, selected Windows Firewall, and then selected Change Settings. I then selected the Exceptions tab, and clicked the Add port.. button. I gave the exception a name, chose the first port to open, TCP 8000, and clicked OK. I then repeated this for the remaining ports to open.

Running OpenSim on the Server
The only change I needed to make before I began was to put the server IP address into the external_host_name in the default.xml file (I later changed this to my DynDNS host name, after setting the host to point to the server's static IP address, and I turned off the automatic updating (all of this is described in Tutorial 3, in the Main Tutorials). Opensim ran normally, and after updating my Hippo viewer with the server's IP address in the loginuri box, I was in, and connected to my Opensim!

The whole process had taken around an hour.

Choosing a Server

OK, you have got your standalone sim up and running, and maybe even got it connected to the OSGrid. If, like me, you are hosting your sim on your home PC then one of first things you may notice, when visitors come calling, is lag. If you experience lag, then it will probably be due to your upload speed.

Finding your Upload Speed
Most Internet Service Providers (ISPs) quote the download speed when offering their services. This is because the requests that your browser makes (or other software that connects to the internet) are quite small, and do not need to be fast, but the amount of data sent in response to those requests (such as a movie downloads) can be quite large, so faster download speeds are the prime consideration. However, when you want to host a server, (which supplies data to a client requesting it), then the upload speed is the prime consideration, and this is the problem you need to solve.

So, what do you do if your ISP does not quote your upload speed? The answer is - you measure it. Use one of the internet connection speed measurement services. The one I like best is SpeedTest.NET Just select the recommended server to test with (click on the yellow pyramid), and it will measure first your download speed, then your upload speed. My download speed was 3.6Mb/s (megabits per second) while my upload speed was a paltry 0.376Mb/s. As soon as I got one visitor it took a couple of minutes for them to go from grey to me seeing them, and my region took a couple of minutes to fully rez for them. If I had two visitors then the experience was too bad to enjoy. It was now time to move my standalone onto a proper server.

Virtual Private Servers
Buying a dedicated server can be costly (although Cari.net provide a great offer for their Celeron service for around $54/month when paid for annually), so most people wanting to have their region hosted go for the Virtual Private Server (VPS) solution. A VPS is a single physical server that is divided into a few “virtual machines” with the help of the required software on the server. In a VPS hosting service, the server’s resources like RAM, disk space, etc are shared, but at the same time each VPS gets its own allotment and operates completely independently from the others. Due to this facility, you can run software or even install a different operating system, without creating any effect on the other virtual servers on the same machine. At the most basic level, you can treat a VPS as just another drive available to your PC that you can install your programs and files on.

Sizing a VPS
To host a single region, with around 10,000 prims, and a reasonable number of textures and scripts, and with just a few friends visiting, you will need between 5-10GB of hard disk space, at least 512MB of RAM (the more the better), and a monthly traffic or monthly bandwidth allowance of around 300GB. All these parameters are just rules of thumb, and can vary a lot depending on your particular set-up (please let me know your region setup and VPS parameters, and your experience, so these sizing parameters can be tuned more precisely).

Choosing a VPS
When comparing VPS service providers, you will notice that they offer a range of services. Managed or unmanaged services, available in Windows or Linux operating systems, and with or without Control Panels (a program to help manage your VPS, but is designed to be most useful to those wishing to host a web-server service, rather than a virtual world). Usually the Linux-based systems are cheaper, as there are no license fees to pay, unlike the Windows operating systems. An OpenSim region requires no Managed Service, so do not waste money paying for this, nor is a Control Panel essential, as long as the service provider tells you how to upload your files to the VPS, and how to perform restarts.

I have looked at 20 VPS service providers, and the best entry-level services are the remarkable Level-1 deal from TekTonic, at just $15 / month. For this you get 13GB of HD space, 500GB of monthly traffic allowance, but only 294MB of RAM. However, this performance is adequate for many region owners, and if your region is not ‘overdone’ it could well be what you are looking for. The other great entry-level service is from OVH, they offer 10GB of HD space, unlimited bandwidth, and 512MB of RAM, for £9.99, or $18.57, at today's exchange rate. The best of the deals for a well-specified system come from two suppliers, EasySpace with their Custom service. For example, chosing 15GB of HD space, 640MB of RAM, and unlimited* monthly bandwidth (*there is a fair-use policy in effect, which equates to an average of 100MB of traffic monthly, but they will not penalise you, or throttle back the service, if you exceed this occasionally, while keeping under the average figure), will cost UKP21.18, or at today’s exchange rate, around $39. The other came from Hosting Source, who provide 20GB HD space, 1,250MB of monthly traffic, and 512MB of RAM, also for $39, for a Windows system. For speed, with their extra RAM, EasySpace have the edge. However, if you have a lot of assets, then maybe the extra HD space is more valuable to you. The best of the prime deals comes from CheapVPS (Linux only, I’m afraid), their 1024 deal gives you 54GB of HD space, 1500GB of monthly traffic, and 1GB of RAM, for UKP27 or around $47.

Running two Instances of OpenSim

My son came to see me and asked if he could move his standalone opensim from his laptop to my nice new server (still as a standalone, not as part of my grid). This seemed like an interesting project, little did I know all the hoops I would have to jump through to achieve this. Eventually, after much help in the #opensim irc channel, most notably from Lexa, I got there. So here are the steps you should take, to avoid all the blind allies that I ran up.

Step 1: Create a new Database
Open the MySQL command console, and create another database for the second instance, I called mine opensim01.

Step 2: Download OpenSim
Download and install a fresh copy of the OpenSim binary from the OSGrid website.

Step 3: Edit opensim.ini
Copy the opensim.ini from the first instance into the bin folder of the second instance.

Make the following changes to the opensim.ini file in the second instance:

  • Do a Search and Replace for Database=opensim to Database=opensim01
  • Go to the [Network] section, and change http_listener_port = 9000 to =9020
The reason for this choice of port number is that I have 25 regions in my own standalone grid, using ports 8994 to 9018 inclusive, so I allocated port 9020 for my son's single region. You can allocate any unused port number you wish here.

Step 4: Launch OpenSim
Run the second instance of opensim, and answer the nine questions, giving the following reponses:

  • Region Name [Opensim Test]: Draconia (example)
  • Grid location (X-Axis) [1000]: Enter
  • Grid location (Y-Axis) [1000]: Enter
  • Internal IP Address [0.0.0.0]: Enter
  • Internal IP Port [9000]: 9020 (or whatever unused port you wish to allocate)
  • External Host Name [127.0.0.1]: anubia.servegame.org (just an example)
  • First name of Master Avatar: Hawkwind (example)
  • Last name of Master Avatar: Dragonslayer (example)
  • Password for Master Avatar [test]: XXXXXXX
Note: The values in square brackets are the defaults that are taken if you just press the Enter key.

Step 5: Edit the Viewer
Edit the loginuri for the Hippo viewer to anubia.servegame.org:9020 (using the examples above)

If you are using the SL client, the target would look like this:
"C:\Program Files\SecondLife\SecondLife.exe" -loginuri http://anubia.servegame.org:9020/

Both instances should now be running, and you can log into both the respective opensims.


Upgrading OpenSim

Step 1: Edit the opensim.ini file
Do not simply copy your old opensim.ini to the new bin folder, as there may well be new features in the newer build and settings for those features may well have been added to the new opensim.ini file. It is far better to compare the two opensim.ini files to see what the differences are. If no new features have been added then copy the old opensim.ini to the new bin folder.

A very handy (and free) tool that I use to compare files is ExamDiff from PrestoSoft. This tool will show you all the differences between two text files, as this screenshot demonstrates.

Step 2: Copy your Regions Folder
Copy your Regions folder from the bin folder of your your previous build to the bin folder of the new build.

Step 3: Copy Your Database Files
If you are using MySQL you need to do nothing. Your new opensim build will start working with it right away. If you are using SQLite then copy across the files listed above, and in addition copy across all the files with a *.db extension from the Bin folder.

If you are working in gridmode instead of standalone mode you will also need the next step:

Step 4: Copy the UGAIM Config Files
Copy the UGAIM config files from the previous bin folder to the new one:

AssetServer_Config.xml
GridServer_Config.xml
InventoryServer_Config.xml
MessagingServer_Config.xml
UserServer_Config.xml

and the estate settings file:

estate_settings.xml

That should be all you need to get the new build up and running very quickly.

Rock

Using Toad for MySQL

Having migrated from SQLite to MySQL, and not being a big fan of command-line consoles, I wanted a nice windows graphical interface to the OpenSim database being used by MySQL. Fortunately, an excellent interface to MySQL databases is provided, free of charge, from Quest Software, Toad for MySQL, available for download from here.

After downloading the Toad zip package, unzip the contents and launch the Toad for MySQL Freeware exe file. Accept the License Agreement, and when you get to the Register File Extensions page ensure that all boxes are ticked, including the .sql box.

When the installation is complete, leave the 'Start Toad when installation is complete' box checked, and click on Finish.

Toad should then start, and open in the Connections window. Ensure that the options are set as follows:

Connection Type: TCP
Host: localhost
User: root (or the user name if you changed it from root)
Password: (your MySQL password)
Database: opensim (if this was the name you used when creating a database for OpenSim)
Port: 3306

Check the Save Password box, then click on Connect.

You are now inside your Opensim database and free to explore. I strongly suggest you read the Release notes first, and join the Toad MySQL forum to get tips on how to use Toad and get the most out of it.

Terrain File to Cover Multiple Regions

So, after successfully getting four regions up and running in a 2x2 grid, it is time to terraform them. Doing four regions by hand would be way too tedious, so I had a go at creating and loading terrain files.

My sims are based on Ancient Egypt, the Estate Name is Greater Anubia, and the region names are Anubia, Karnak, Giza and Luxor. So I wanted a terrain that would cover the full four regions, and look something like the Nile Delta, with the river Nile winding its way through the four regions.

Here are the steps I took:-

Step 1: Prepare the Background in Microsoft Paint
I opened Microsoft Paint, and changed the Image size to 512x512 pixels (this will cover four regions), and filled the background with dark grey

Step 2: Do some Painting
I then used the brush and using black I painted a water border around the edges (yes, I know Egypt only has a water border on the North and East, but I like to sail), then a river delta and a river winding through the regions. Three higher elevations (one to host the pyramids of Giza, one to represent the source of the Nile, and one to host the Palace) were then created using the brush and painting in light grey then a little white on top. The resulting simple image looked like this (don't laugh, it does get better).

Tip: If you want low-lying land the shades of grey to paint in are so near black as to be indistinguishable. So I have started to paint in just the four clear shades you get in Microsoft Paint, ie black, dark grey, light grey and white. I then blur the image and use the terrain multiply factor to scale the heights down from 255m high (white) accordingly to a much lower elevation. I found by experiment that 0.4 left the ground still a little too high, while 0.3 left too much underwater, and 0.35 was about right.

Step 3: Blur the Image
I then saved the bitmap as a windows bitmap (egypt.bmp), then opened the file in Photoshop, and blurred the image using Gaussian Blur, and a setting of 7.2 (but you can blur it with Gimp, .Paint, and several other free programs). The resulting image now looked like this.

Step 4: Splitting the Image into Tiles
I then used 'Split and Tile Image Splitter', available from http://www.softdd.com/splitting-images/splitting-pictures.html

This neat utility will open an image, ask you to select how many cells across by how many down you want to split the image into, and it will then split the image and let you save the cells in one easy go. I opened egpyt.bmp, selected 2 across by 2 down, and it then saved the four cells as egypt1.bmp, egypt2.bmp, egypt3.bmp and egypt4.bmp into the root of my C: drive (just to save typing out long paths in OpenSim). Couldn't be simpler.

Step 5: Loading the Files and Scaling Them
I then opened Notepad and entered the following 4 lines (to save constantly typing them out each time in the OpenSim console):

change-region
terrain load c:\egypt1.bmp
terrain multiply 0.35
terrain bake

I then started my OpenSim server, and when it was ready I opened my Hippo Viewer and connected. I then changed the region from Root to Anubia by copying to the clipboard change-region from my notepad, and pasting it into the opensim console (using that little icon in the top-left of the title bar, and selecting Edit/Paste, as Control-V does not work in Dos windows) and adding 'Anubia', like so:

change-region Anubia

(all terrain commands will now only apply to this region)

I then loaded the appropriate bitmap file

Tip: The file splitter utility saves the four files, numbered from the top-left (1), top right (2), bottom left (3) and bottom right (4). In my Hippo Viewer I looked at the Minimap to remind me of the layout of my four regions, with the southwest (SW) in the bottom-left corner. I could see that Anubia need the (3) file, Karnak the (1) file, Giza the (2) file and Luxor the (4) file), so I entered the following commands:

terrain load c:\egypt3.bmp
(wait until it says it has loaded it ok)

terrain multiply 0.35
(again, wait for the console to say that it has completed this step)

terrain bake

Repeat the above until all four regions have been selected in turn, had their terrain files loaded, scaled with the multiply factor, and baked.

Step 6: Apply Terrain Textures
In my Hippo Viewer I then went to the World, Estate/Regions, Ground Textures tab, and loaded rippled sand for my first texture, rock for the second, granite for the third, and thatch for the fourth, and set the elevations to 25 and 45 for all four areas.

The resultant landscape now looked like this.

Creating More Regions

To create more regions is quite easy. So, for example, to have 4 regions in a 2x2 grid here are the steps:

Step 1. Copy the default.xml File
Go to the Bin/Region folder and locate the default.xml file. It is this file that defines your single standalone region. By the way, I would rename this file now, to the name of your region, you might want to put its location into the filename too, so you can see at a glance. (I changed mine to anubia 1000x1000.xml). Copy this file, and paste 3 copies of it into the same folder.

Step 2. Get some UUIDs
Each region needs it own, unique UUID. To get UUIDS go here, a UUID will be waiting for you, copy and paste it into Notepad. Refresh the web page, and another UUID will be given, copy/paste this into Notepad too, do this once more, and you will have the extra 3 UUIDs you need.

Step 3. Edit the Region Files
Open the first of the three copies you made, delete the sim_UUID value, and replace it with the first UUID you got from the previous step. Change the sim-name to something else; change the sim_location_x to 1001 (leave the value for y alone, at 1000); change the internal_ip_port to 9001. Save.

Repeat this process for the next file copy, entering the next UUID, giving a new name, changing the x to 1000 and y to 1001, and the port to 9002.

Repeat this process for the next file copy, entering the next UUID, giving a new name, changing the x to 1001 and y to 1001, and the port to 9003.

Step 4. Open more Ports in the Firewall
Now, if you remember how you opened your firewall or router to allow TCP port 9000 to pass, repeat this to allow ports TCP 9001-9003 to pass also (see step 2 in Tutorial 3 in the Main Tutorials for more details).

You now have 4 regions in a nice 2x2 grid!

Step 5. Changing the Terrain for each Region
To change trhe terrain for each region individually, in the server console, type

change-region regionname (replace 'regionname' with the name of your second region)

The region that all commands will now apply to will be this new name you gave. So, you can go ahead and load a terrain file:

terrain load c:\myterrain1.raw

Repeat for the other regions you created.