Tuesday, October 30, 2007
Automatic Navigation Preliminaries
Lately, I've been kicking around a project involving automated navigation of the various Linden Protected Land roads and river ways. I'm toying with a low-rent, no-camping version of the SL Metro, hopefully without the controversy. Or maybe I'll just make an automatic vehicle for myself, and take a few relaxed tours of SL now and then.
Above, you can see an early test run, with all the built-in debug tools enabled. This version of the navigation script sweeps in front of the vehicle (the black rectangle that I'm sitting on, in center), checking parcel data at each point. If the parcel at that point is named "Protected Land" (or "The Garden of Mo" in this test), belongs to the Maintenance group, or is owned by Governor Linden, then it's a valid location. If not, the point is thrown out. The sweeps are comprised of points along two concentric arcs. The check points are shown as white spheres in this test.
After the sweep, the destination is derived from the average of all the remaining valid points. The vehicle moves to this target (shown by the red spheres), and the sweep is started again. The net result should be a path roughly down the center of the road or waterway. In this case it's running in wide open land, so the path is straight (save for adjustments for elevation). This method works well enough, but has some problems that can generally only be solved by adding more and more check points. This is ultimately a losing proposition.
So, I've since gotten away from this method in favor of the simpler right-hand rule. Basically, this involves checking forward of and to the right of the vehicle. (Directions relative to the vehicle's current orientation, with "forward" being in the positive X direction, and "right" being in the negative Y direction.) If the right hand side is too close to the edge of the valid parcel, bump the vehicle to the left by a set amount. If the point ahead is not valid, turn left by a predetermined angle and try again. Turn right by a small angle each cycle, and the net result is a vehicle that tends to stay within a few meters of the right hand edge of the path.
The process isn't perfect. For example, it tends to make left turns instead of veering right at sharp intersections, as the forward scan tends to hit the opposite edge of the parcel before the vehicle can make its slow right-hand turn to continue following the right hand edge. Tweaking of the turn angles (veer right/clockwise vs. correct left/counter-clockwise) can help this, but that'll have to be determined with live road testing.
Still, even if that flaw is never fixed, it should be sufficient for my needs. The goal is to take a scenic flight across the Grid, not slavishly solve the maze of SL roadways. And it requires considerably fewer checks than the full forward scan above. I don't know how server intensive the llGetParcelDetails command is, but calling it two or three times (I actually need one more distant forward check to avoid running out of bounds at sharp turns) instead of a dozen or more is surely more efficient.
I'm sure I'll talk more about this project later. It's helping my outlook in SL to once again have something to sink my teeth into, anyway. But that's not really the reason I'm showing this particular picture. This was posted to illustrate the typical working conditions on the Mainland. Okay, maybe not "typical," but certainly not uncommon.
Behind me, you can see a batch of billboards, now nestled neatly in the middle of my newly acquired expansion property. Someday, it'll annoy me enough to consider buying it out. (It'll have to really annoy me to merit spending L$9.5K for a 16m plot. In the meantime, big, obscuring trees- which were disabled in this pic- are free.) This is, of course, the guy's whole obnoxious strategy. You thought he was making money from the ad sales? Nah, that's just plausible deniability.
Beside that is an equally obnoxious spinning "For Sale" sign, hovering over an a horribly overpriced 512 plot. Nothing unusual there.
Everywhere else, you can see the results of the nigh-daily griefer attack. A half hour or so before this picture was taken, a wave of self-replicating cubes swept over Abitibi and Louise. Said objects were textured with a scene from the now-mercifully-defunct "Super Mario Brothers" cartoon show, and spewed countless particle images of a flying Mario with wing-bedecked hat. And, to top it all off, each cube bawled "That's Mama Luigi to you, Mario!" over and over again, ad nauseum. One AR, some parcel ban settings, and an object return, and I was able to clear my land well enough to get on with my work. Fortunately, Louise is too far off the beaten path to routinely attract such attentions. Griefers generally go after population centers.
All in all, just another day in Second Life.
Of course, given the state of the mainland Grid, automatic touring balloons (or whatever vehicle concept I settle on) might prove to be depressing. Putting aside the architecturally dubious builds, the billboards, the gaudy shops, and the other man-made eyesores, even the natural scenery is degrading. (Inasmuch as anything is "natural" here.) Above is a picture of a waterway in Keuka, a few regions southwest of my home sim of Louise. I discovered it while looking for long, uninterrupted stretches of Protected Land in which to run my early tests.
Or, rather, it used to be a waterway. Sloppy terraforming and general apathy from the successive owners of the adjacent rental properties have succeeded in damming the flow, and turning the adjacent river into two long, shallow puddles. At one time, this was part of a reasonably large, navigable river valley that stretched across a large portion of the mainland continent. Now, it dead-ends in a watery cul-de-sac after only a couple more sims. Said cul-de-sac is filled with hopeful docks, perhaps in an "if you build it, they will come" attempt to attract yachts to the quarter-sim-wide micro-lake.
Now, I can't remember the last time I piloted an SL water craft. As with all vehicles, I generally lost interest after the fourth or fifth botched sim handoff and resulting crash-and-burn. But, still, this depresses me. At one time, not too far from where this picture was taken, there were lovingly sculpted rapids. A bit further downstream, an inner tube ride allowed visitors to take a leisurely tour downstream. And now? Uninspired waterfront houses, jammed edge-to-edge with piers, stairways, and docks leading to tiny, stagnant ponds. Very sad.