Archive for the 'open source' Category

Sculptie Physics in OpenSim

Friday, May 9th, 2008

In secondlife sculpties only collide on bounding boxes, which make them really only suitable for visuals, not for part of complex builds. Due to some early work done by Teravus this week, that’s no longer true for OpenSim. We’re now creating a tri-mesh collision surface for sculpties and passing that into our physics engine. This code is young (only a week old), but you can see a demo of results below.

Sculptie Physics on OpenSim from Dahlia Trimble on Vimeo.

Popularity: 9% [?]

llTargetOmega in OpenSim, an epic journey in OpenSim prim updates

Friday, May 9th, 2008

A few weeks ago I had an email conversation with Dale Innis about llTargetOmega support in OpenSim. This script function lets you set the angular velocity on a prim, which the client then interprets and displays spinning objects. It is not guarunteed to be synchronized between all clients, but it provides a rather useful visual effect regardless.

llTargetOmega didn’t work for us a week ago, which confused me, as I saw that in the LSL portion of our code it was doing exactly the right thing and setting the angular velocity correctly. I should work, but it didn’t. In the lack of it working people were setting fast timers that pushed out rotation updates. This caused a lot of extra load on the server, and was really the wrong approach for this.

Take 1: Terse Updates

OpenSim has 2 paths to sending information about Prims to the client (we’ll get to the first one later). Terse Updates are a small update packet that contains just a bit of information on updated textures and some of the vectors used to establish prim position, velocity, acceleration, rotation, and angular velocity. When a prim is updated in the environment, Terse Updates are used to tell all the other clients about that change. One of the heavy users of the Terse Update path is the physics engine, as all the vectors the physics engine changes are in there. We’ve seen a lot of work on the Terse Update path as physics have gotten more and more tested.

On Tuesday I finally dug in and traced our Terse Update path, and found an interesting thing. When the object was physical (i.e. movement coming out of the physics engine) we did the right thing for Terse Updates. When it wasn’t, we hard coded all the velocities to zero. So even if things were rotating, any time we sent an update we’d stop them.

Author: sdague
Date: 2008-05-06 15:17:00 -0700 (Tue, 06 May 2008)
New Revision: 4543

Modified:
trunk/OpenSim/Framework/IClientAPI.cs
trunk/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
trunk/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
trunk/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
Log:
send actual velocity and angular velocity in terse updates
instead of hardcoding to zero when the primitive is non physical.
llTargetOmega should work now.

Ok, so life is good, the issue is fixed, and we move on.

Except… it wasn’t.

CSI: OpenSim, getting to the bottom of this

At this point a whole bunch of people on the IBM side jumped in. Mike Osias had a build that was on it’s knees due to use of fake rotation, so he had all the good test cases, and opened mantis 1166. I’m not a scripter, so I needed some examples to know what should work. Alan Webb started to dive in and try to figure what was going on as well. I figured I’d spend an hour on it to try to figure out where things were at before getting back to avatar appearance bits.

After abount an hour Alan and I started comparing notes. The code in this area is extra confusing because we’ve got 2 vectors for angular velocity. An, no, they aren’t actually different in any real way. Lots of people have tried to rationalize that they do different things, but they don’t. This is cruft, and is part of what happens in an organically growing open project. The AngularVelocity / RotationalVelocity thing an opensim appendix, and should be surgically removed at some time in the near future.

But the behavior was even odder. I could set llTargetOmega on an object, and it wouldn’t move. Then I’d touch it, and it would. I got Mike into my test environment and was looking at a spinning cube.

“Ok, you see that cube spinning?”

“No”

I grab it and move it. “What about now?”

“Yes, spinning now.”

At this point I was confused a lot. Why would that be?

Take 2: Full Updates

I said there were 2 ways of a client finding out about prims, and this gets us back to the first one. In addition to Terse Update, there is what we call Full Updates, which are really just the full prim definition being sent down the wire. This is everything we know about the prim. This packet is also marked as reliable, to make sure the client doesn’t drop it (terse updates are droppable).

And now we get back to organic code bases. One of the big activities since October was working physics in opensim. Lots and lots of work were spent on Terse Updates. Very little work was spent on full updates. It turned out that Full Updates were always hardcoding all the motion vectors to zero. The SendPrimitiveToClient function predates both physics and scripting by months. In a pre-physical opensim world passing the motion vectors didn’t make any sense, as there wasn’t anyway to set those values. The code worked well, so no one was really looking at it again, at least not in this specific area.

TerseUpdates (sent on minor prim movement) would make things spin. Full Updates (sent on initial prim rez, or after calls to osSetDynamicTextureURL) stopped the spinning. My earth projector turned out to be the perfect test case for this once I added rotation to the globe.

Originally I was going to punt on this and leave it to someone else, but then the thrill of the chase got to be too much. But there was one problem. This information is sent to the client in a 60 byte array, with basically undocumented positions. It was easy to fix terse updates because someone had already sorted it out, and I just needed to copy the decoding pattern there. For FullUpdates, it was more of a trial and error approach, represented by a series of checkins, reverts, and new attempts.

You know what happens when you get that array wrong? Spectacular fail. 3/4 of prims aren’t in the right place, and touching an image board (user of osSetDynamicTextureURL) makes it fly away to some other part of your sim. Maybe in space. I eventually figured out a workable serialization:

Author: sdague
Date: 2008-05-07 12:44:22 -0700 (Wed, 07 May 2008)
New Revision: 4566

Modified:
trunk/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
Log:
seriously hope this gives us rotation and rotational velocity

As you can see, I was getting a little punchy on changelog entries.

So we’re done and fixed, and back to work…. well not quite.

Take 3: Deselected Objects

When you edit an object the client stops it’s motion, as nothing would be more evil than trying to edit an object that is flying away from you at 60 m/s. When you’ve deselected the object it tells the server. But the object is stopped. The client needs to be told again that it is spinning. I got that critical information from melanie on IRC, which was enough to pass on the buck.

We had Mike almost working, and Mike is no slouch on our code base (he’s sent in a couple dozen patches in the past), so I flipped this one back to him with “we’re almost done, but you’ll need to find the right place in the deselect path to generate a Terse Update. Then I think we’ve got full llTargetOmega support.”

A day later Mike sent in this final patch:

Author: sdague
Date: 2008-05-08 05:48:29 -0700 (Thu, 08 May 2008)
New Revision: 4585

Modified:
trunk/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
Log:
From: Michael Osias <mosias@us.ibm.com>

Patch to schedule terse update on deselect, specifically so llTargetOmega
sets rotational velocity on deselect.

This should complete our llTargetOmega support and fix:
http://opensimulator.org/mantis/view.php?id=1178

And now. For real. llTargetOmega works.

Final Thoughts

Avartar Appearance as a User Service isn’t coming this week, sorry folks. The above epic took much of my hacking time this week. It was a pretty solid educational experience for me in the way we actually communicate the contents of the Scene to the client, which was good to learn after a year on the project. :)

Something else to take away from this. Lot’s of focus is currently on the OpenSim scripting implementation, as it should be, as that’s a huge user visible portion of our function. llTargetOmega it self is < 6 lines of implementation. But our supporting scene model needed some work to actually get that info to the client.

I get asked all the time “how long until my favorite feature X is implemented”, and the answer is always an unsatisfying (to me and them), “I’m not sure”. Sometimes the plumbing is already there, and it’s quick. Other times we’re doing deep dives into our code base to implement what seems to the user to be a very simple function.

We’re making constant forward progress, I’d even say rapid constant forward progress, but patience is always a good thing. Also, if you want OpenSim to work for whatever you application is, you should be trying to use it now and filing bug reports. That’s how we function, personal itches, and knocking of mantis reports. Any ability that you have to narrow the bug to a specific section of code (even if you don’t have a fix), helps a lot as well, as it removes possibly hours of core developer time trying to track down where things fail.

Popularity: 9% [?]

Dague.net move

Wednesday, April 30th, 2008

Once upon a time I said I would never host my own email (or email in general), as it was a pain I didn’t want. Then, I ended up hosting email for mhvlug.org because it turned out to be the simplest solution. A week later I installed postgrey, and watched the spam rates drop by 80%. And it was good.

A couple things changed in the last year. Linode went from UML to Xen, which definitely makes each linode more powerful. My shared hosting company stopped being helpful. I had a couple of small outages. They had moved from a knowledgable support staff, to a support pool that was clueless, and never seemed to understand the ways in which their system was broken. And, after hosting mhvlug email for a while with no issues, it seemed reasonable that dague.net email would be safe there as well.

Backups (thanks to backuppc) have been ramped up from every 24 hrs to every 6 hrs on the box, to narrow my window in which I can screw things up. Only one set of email delays so far, mostly because I set a wrong postfix param over the weekend, which may have been blocking mhvlug.org email as well. But that is resolved now. Dan will at least thing I’m a real man now. ;)

Popularity: 23% [?]

When Child Agents Go Wrong

Monday, April 28th, 2008

This is a snap shot from right before OpenSim Office hours last Tuesday, in a neighboring region. It appears that we’ve incorrectly made our child agents visible, which has some really fun effects on the viewer.

Bugs are so much more amusing in 3D.

Popularity: 38% [?]

Live from Hardy Herron

Sunday, April 27th, 2008

Yesterday seemed like as good a time as any to actually do the upgrade to Ubuntu 8.04 on my laptop. A series of wireless card crashes got me fed up to the point that I had to do something.

The upgrade, via update manager, only had one hitch, when the wireless card bonked out in the middle of it. I suppose it adds appropriate insult to injury, given how often the iwl4965 crashed on my over the last couple of months. Resuming the upgrade on wired ethernet, and all was well.

The Good

Upgrade went flawlessly; fonts look even better; wireless seems better; ssh-askpass now seems to actually trigger on login; firefox 3b5 is fast; liferea is much faster

The Bad

Pidgin 2.4’s usability improvements are anything but; A few of my firefox plugins (delicious links, firebug) don’t work with firefox 3b5 yet (as such, my daily links won’t be on the blog until delicious gets fixed).

The Amusing

During installation some 3rd party packages were removed, including Lotus Notes. While I appreciate Ubuntu’s attempt to make my life better, I sorted of need that for work. ;) I’m pulling from our internal repos now.

Popularity: 25% [?]

Things that make my week…

Friday, April 18th, 2008

This comment on twitter from RichWhite, one of the leaders of EduSim:

@sdague - you realize you Opensim developers will be raised to “saint” status in the k-12 distance education field some day.

Man, what a great way to end a week.

Popularity: 51% [?]

Beware the Anti-Market

Wednesday, April 2nd, 2008

A vendor can often be their own worst competition if they create good technology, but put it out in a way that is too limiting, in platform support or licensing, than their prospective users would like it to be. I’ve often refered to this as the Anti-Market among colleagues. The rules of the Anti-Market are more or less as follows:

If you create a technology that is useful, but 90% of your prospective market can’t use it for various reasons, they’ve got a good chance of getting together and writing a replacement for your product.

Example 1: KDE vs. Gnome

Gnome created out the anti market that KDE created. KDE is built on QT. Back in the early days of KDE, QT was licenced in rather funny ways by Trolltech. The funny license meant that Red Hat (and other Linux distros) didn’t want to ship it. Mandrake was originally just Red Hat + KDE to fill such a need. But with the bulk of the KDE user market blocked because of bad licencing, a void existed to be filled. Gnome did that. A decade later Gnome is the primary desktop environment on nearly ever major distro, and while KDE 4 has gotten some recent press, it is definitely now a minority player.

KDE was brought down because it created an anti market. People wanted that kind of function, but the way it was delivered was not acceptable to its users.

Example 2: Java vs. Mono on the Linux Desktop

How many Linux desktop apps are you running right now, or ever, that are Java based? How many that are Mono based? The only Java apps I run on the desktop in any frequency are Azureus and Freemind. On the Mono side F-Spot and Tomboy have seen a lot more use. Until very recently Java remained under a license that made including it with the Linux platform quite an issue. Mono is under an MIT license, and has been since day one. While Mono has a number of short comings, the fact that it’s so young, and so much more used than Java in the Linux desktop space speaks a bit to the anti-market that Sun created by waiting forever to open source their baby.

Example 3: MySQL vs. everyone else

In 1995 Linux was already being used to run key parts of the internet. None of the traditional ISVs were paying attention to it (DB2 showed up in 1998 on Linux, and too my knowledge, was the first big database vendor there). You know what you need to run the internet, a reasonable database. MySQL popped out of the anti-market created by there being a platform people were using quite a bit, but lacking ISV support. People needed the function, but couldn’t get it even if they wanted to pay for it.

I continue to be amazed at how much of an anti-market MySQL took advantage of.

Closing thoughts

The Linux Desktop space is full of anti-market applications, some of which have even seeped back into the Windows world, like OpenOffice, Gimp, and Pidgin. Adobe just made a very astute move and got Air out for Linux before they forced a new anti-market there. While the Linux Desktop space isn’t the highest volume space for users, the developer to user ratio in the space is very high, which means ignoring it means there is a real chance of creating an anti-market.

I’d love to hear other people’s thoughts or examples here, comments are open, have at it.

Popularity: 79% [?]

Mono 1.9 install script

Saturday, March 29th, 2008

Unfortunately no one has made ubuntu packages yet, however here is a script that I built based on Dirk’s post to automate mono 1.9 installation onto Ubuntu environments.

#!/bin/sh

# This is needed to pick up our built mono for commands
export PATH=/usr/local/bin:$PATH 

apt-get install build-essential bison gawk
apt-get install libglib2.0-dev
apt-get install libpng12-dev libx11-dev libfontconfig1-dev
apt-get install libfreetype6-dev libjpeg62-dev libtiff4-dev
apt-get install libungif4-dev libexif-dev libcairo2-dev
apt-get install libpango1.0-dev libgtk2.0-dev libglade2-dev
apt-get install libgnome2-dev libgnomecanvas2-dev libgnomeui-dev
apt-get install libgnomeprint2.2-dev libgnomeprintui2.2-dev
apt-get install libpanel-applet2-dev libgtksourceview-dev
apt-get install libgtkhtml3.14-dev

BUILDDIR=~/mono-build
mkdir -p $BUILDDIR
cd $BUILDDIR

wget http://go-mono.com/sources/libgdiplus/libgdiplus-1.9.tar.bz2
tar xvf libgdiplus-1.9.tar.bz2
cd libgdiplus-1.9
./configure --prefix=/usr/local
make
make install
cd ..

wget http://go-mono.com/sources/mono/mono-1.9.1.tar.bz2
tar xvf mono-1.9.1.tar.bz2
cd mono-1.9.1
./configure --prefix=/usr/local
make
make install
cd ..

wget http://switch.dl.sourceforge.net/sourceforge/nant/nant-0.86-beta1-src.tar.gz
tar xvf nant-0.86-beta1-src.tar.gz
cd nant-0.86-beta1
make install --prefix=/usr/local
cd ..

wget http://go-mono.com/sources/gtk-sharp210/gtk-sharp-2.10.4.tar.bz2
tar xvf gtk-sharp-2.10.4.tar.bz2
cd gtk-sharp-2.10.4
./configure --prefix=/usr/local
make
make install
cd ..

wget http://go-mono.com/sources/gnome-sharp2/gnome-sharp-2.16.1.tar.gz
tar xvf gnome-sharp-2.16.1.tar.gz
cd gnome-sharp-2.16.1
./configure --prefix=/usr/local
make
make install
cd ..

wget http://go-mono.com/sources/gtksourceview-sharp2/gtksourceview-sharp-2.0-0.12.tar.bz2
tar xvf gtksourceview-sharp-2.0-0.12.tar.bz2
cd gtksourceview-sharp-2.0-0.12
./configure --prefix=/usr/local
make
make install
cd ..

cd mono-1.9
wget  http://go-mono.com/sources/monodoc/monodoc-1.9.zip
unzip monodoc-1.9.zip
cd monodoc-1.9
./configure --prefix=/usr/local
make
make install
cd ../..

wget http://go-mono.com/sources/mono-tools/mono-tools-1.9.tar.bz2
tar xvf mono-tools-1.9.tar.bz2
cd mono-tools-1.9
./configure --prefix=/usr/local
make
make install
cd ..

wget http://ftp.novell.com/pub/mono/sources/mono-debugger/mono-debugger-0.60.tar.bz2
tar xvf mono-debugger-0.60.tar.bz2
cd mono-debugger-0.60
./configure --prefix=/usr/local
make
make install
cd ..

wget http://ftp.novell.com/pub/mono/sources/heap-buddy/heap-buddy-0.2.tar.gz
tar xvf heap-buddy-0.2.tar.gz
cd heap-buddy-0.2
./configure --prefix=/usr/local
make
make install
cd ..

wget http://ftp.novell.com/pub/mono/sources/mono-addins/mono-addins-0.3.1.tar.bz2
tar xvf mono-addins-0.3.1.tar.bz2
cd mono-addins-0.3.1
./configure --prefix=/usr/local
make
make install
cd ..

wget http://ftp.novell.com/pub/mono/sources/monodevelop/monodevelop-1.0.tar.bz2
tar xvf monodevelop-1.0.tar.bz2
cd monodevelop-1.0
./configure --prefix=/usr/local
make
make install
cd ..

Popularity: 100% [?]

Upgrading my Linode to Xen

Friday, March 28th, 2008

I just did the upgrade of my linode (which hosts mhvlug.org, planet opensim, dague.org, and a few other sites) to Xen. I had put in the request to join the beta for Xen a couple weeks ago, got in, and was slow on my side to actually kick off the migration (which was painless, but required about an hour of down time). It turns out that all of linode is now going to Xen. Based on very simple latecy tests, the box feels much snappier on serving up wiki pages.

Popularity: 76% [?]

Fun with Morphing

Tuesday, March 18th, 2008

After a bit of playing around with gtkmorph tonight, I came up with this morph between myself and my Second Life avatar Neas Bade. I haven’t quite figured out where I’m going to use this yet, but it seemed like something handy to have. I need to actually replicate my avatar shape into the various OpenSim environments that I use, which I haven’t gotten around to yet, but will soon.

Popularity: 54% [?]