Wednesday, December 21, 2005

Penguins and balloons

Two quick notes:

1. I finally got my balloon vehicle autopilot to work - say "target theretra/200/200" and it locks onto the global co-ordinates of point [200,200] in Theretra, "auto on" and it starts to fly. In the right direction. Correcting the course if, say, you bounce off an object and start spinning, which was the hard part because to get a vehicle to move in a particular direction you need to take account of its facing as well, which means calculating the angle between the forward rotation and the vector to the target and turning that into another vector. Which means vector geometry, and while I could do that in my sleep when I was 17, now, I've forgotten an embarrassing amount of it.

There is probably an easy way of doing it with built-in rotation functions but I don't care, I've done it with a whole load of messy trigonometry and I'd rather not know that I was wasting my time, thanks.

It doesn't control your altitude. That, I decided, was not only going to make things harder but also be pointless, since on moving across the landscape you frequently encounter things of ridiculously variable height and need to move up and down to avoid them. Thus altitude is left under pilot control. It also has four silly-looking propellors which I may remove.

2. I have lost a heat-seeking penguin. It followed me into a restricted area with which I have been having trouble - instead of just not letting me in, that area tends to shoot me straight through it, make me sink through the ground, paralyse me or send me to another entirely different location, and it routinely sends any vehicle I happen to be riding right off the face of the virtual world and into my Lost & Found folder.

This sounds like some sort of imaginative and illegal security script but it's not; I'm fairly sure it's a bug, or a selection of them. Anybody who could write that sort of script wouldn't bother putting up the red lines around the property as well.

Anyway, my heat-seeking penguin disappeared. It is lonely and needs love and it will follow you around if you're not careful. Note to any Linden Labs employees or self-important unofficial game cops: it's not a griefing object, if you touch it it switches off. I was just playing.

If you find my penguin please send it home - I've not even saved it.

Monday, December 12, 2005

Bullets and Such

Right. As promised, here are a few things I've discovered so far about bullets, which might at some point save somebody some time. The basic idea is that you rez a bullet using llRezObject to give it an appropriate velocity towards the target - but I think if you're looking for advice you probably know that much already, as it's already in the standard .

I had a frustrating time originally when I tried to build an automated gun turret that fired at intruders. It was pointing in the right direction, it was firing bullets properly, but a lot of the time they would do absolutely nothing, just shoot straight through me (the only test subject here). You could watch them go past by changing the camera angle. Very annoying. Speeding them up didn't seem to help at all, though slowing them down did, but then they have a hard time hitting anything.

What I'd been suspecting based on this experience was confirmed to me later on - the physics engine works on a frames basis, moving objects a certain distance N times per second (N usually around 44 in my experience, you can get the current framerate with a script) and detects collisions after each move, it doesn't interpolate between the two positions. A small fast-moving object can therefore just appear on each side of a target without ever touching it. So you can't use one of those small round bullets that you get in the old free gun scripts, uh uh. What you actually need is a long thin spear-type thing, to ensure that it will cover all of the intervening arc that it travels along. I calculated that a bullet that travels at 100m/s - slow for a real-world bullet but works in SL - should be around 100/40 = 2.5m long to be absolutely sure that it would hit intervening targets. This seems to work.

So my bullet here is a 2.5 x 0.1 x 0.1 cylinder. When rezzed it turns itself fully transparent since the gun isn't supposed to fire spears, but you can see where it is from a particle at the centre. When it detects a collision event, it uses llPushObject to apply an upwards impulse to that object, determined by the parameter that the gun passes to it after it rezzes.

More about the revolver

I modified the gun and bullet so that one could change the degree of push applied by voice command ("push 1", "push 50" etc); the gun passes a parameter to the bullet which is multiplied by 100,000 to get the upward impulse used by llPushObject. On a direct hit, the default setting of 1 sends a target dummy pretty high, but then they're quite light, and since the impulse is divided by the cube of the distance between the centre of mass of the bullet, and the centre of mass of the object pushed, hitting a dummy in the foot means it just bounces upwards a little. So there is a slight challenge involved to satisfactory target practice.

There are also two bullet types now - one pushes forward, or at least in the same direction as the vector from the bullet's centre to the object hit's centre i.e. the following vector:
bulletForce * llVecNorm(llDetectedPos(0) - llGetPos())
so if you shoot low it could be mostly upwards, and one pushes strictly upwards:
<0, 0, bulletForce>
These can be selected by voice command as well ("push fwd" and "push up").

Target dummies

One has to have something to shoot at. I wrote a script that displays the weight of the object it is put into as float text, records and displays the maximum height above ground that the object reaches, and, after a certain period of time (about two minutes) sends an IM back to the owner saying the maximum height and the distance that it is currently from its starting point, and then dies. This helps solve the "oops where did that one go?" problem that seems to happen a lot to me. I hope nobody was disturbed by large wooden objects falling from the sky, but in SL they only weigh 8kg despite being two metres high.

Firearms safety

Of course, if one of these bullets hits a person by accident, it'll send them flying up in the air as well, which is at best annoying for them and at worst gets your account suspended. The base push is quite low, so it won't send somebody into orbit. I could have modified the bullet so it wouldn't push an avatar but I decided not to...

1. It adds an extra level of required complexity;

2. There might come a time when there's a legitimate reason to push somebody, a game, as a demo, to get them out of somewhere, whatever;

3. (and most importantly) If I'm building a gun it should be something I have to take care with. It wouldn't be hard to make something safe that would only interact with target scripted objects and I'd never have to worry about anything but... I don't know, what good is that?

Late Night Push

It was late and I wasn't asleep for some reason, so last night / this early a.m. I made myself a revolver, added a modified version of the Linden Revolver Script and an explosive upwards-push bullet, created some target dummies - simple wooden pyramids with balls on top, physics and temporary - and took them all to a sandbox, where I spent some time shooting them and then trying to shoot them again on the way down. (Total score: zero.)

What struck me was how normal this seemed. Here I was in an area full of lots of other complex, scripted objects, blasting things up in the air in real time, watching them spin around, bounce on the ground and so on, all in real time, all of it relying on a general physics engine rather than something specialised for this purpose. I could have, and did, change the details, add new objects, modify the code, change the whole behaviour at a moment's notice, with very little time required to re-compile. That's actually pretty damn impressive stuff for a program to do. But it was only when I thought about it that I noticed.

Jaded? Jaded would have been if I'd said "this is rubbish" instead of having fun blowing things up. In any case, we can't sit around marvelling at technological advances, or we'd still be pointing at wheels and saying "wow, I just can't get over how good those things are". As I always say, the human capacity to find the most amazing things ordinary is something that stops us just spending our entire lives looking up at the sky.

I'll post some stuff about scripting bullets later.

Sunday, December 11, 2005

A multiplicity of Bushes

Okay - has anyone seen more than nine IMPEACH BUSHes in one area? The neighbours must really have been vocal.

nine IMPEACH BUSHes at once

(Chaska [56,58])

The area in question has every land flag ticked for some reason - no fly, no script, no build, and damage allowed, for some reason, though I can't see anything that would actually cause you damage.

I should start a competition.

Saturday, December 10, 2005

The Obligatory IMPEACH BUSH Post

Despite it now being rather yawnsome for anyone involved in any of the SL communities, it may be the point at which I say something about the IMPEACH BUSH guy, Lazarus Divine. (Not, I understand, the one who represents Rugged Regiment, the Soul Mechanical Crew and the 6th ward.) If you're a SLer who has somehow remained unaware of IMPEACH BUSH... the executive summary is that guy buys tiny plots of land (16m2) and puts signs up all around SL that look like the following:

impeach bush signs

(picture taken outside a Socialist Party building) These are very annoying if you have them in your view. Simultaneously, the price of the land is set extremely but not insanely high, so that people who find them annoying can buy the plots to remove the signs, providing a very nice profit on the original land purchase.

When I first came to SL I saw a lot of these signs and thought that it must be some sort of craze - I'm not at all in favour of the war in Iraq or Bush so I was fairly heartened to see what I thought was evidence of general agreement. It didn't take long before finding out the real purpose of them though. There's no political element, despite what the guy says - if you argue or cause trouble, you find yourself surrounded with as many of the signs as possible, and, some people say, sometimes on the end of a lot of verbal harassment, though I have no experience of this myself.

The content of the signs has been chosen, as far as I'm concerned, as a deliberate attempt to pretend that this is some sort of political speech that's being attacked. It's a nonsense idea that somebody would put up these signs as an honest political campaign, in garish clashing colours and annoying locations, and then sell the plots of land at inflated prices. The guy is gaming the system, stopping himself from being banned or told to take the signs down under cover of "free speech".

I have to say, though, that I can't see a lot of difference in practice between the above signs and, say, something like this:

spinning flashing urgh

which can be found at Theretra [211,173], and is just one example of land spam that I picked up this afternoon. It sits there in the air, spinning and the light at the top flashing. This stuff is everywhere in First Land areas, where people start with small plots and then move out fairly quickly, selling to land barons.

What is the point of this? Garish and intrusive advertising in the real world is there to increase brand consciousness, but there's no brand here. If people want to buy a particular piece of land, they'll look there to see who owns it, in which case a subdued block at ground level is quite enough (as Anshe Chung uses). Nobody is going to look at a spinny block and think "oh, actually, yeah, I wasn't going to buy that land but I think I will now".

There's basically no reason to make the most annoying ad possible on a land package unless either you just don't understand simple advertising principles, or you want to annoy people enough that they're likely to just buy the bloody land to get rid of your bloody sign. Lazarus Divine has this latter motivation, I'm fairly sure, but the only difference is of degree. He's not interested in being a long-term landowner, so he can raise prices to ridiculous levels and make a short-term profit without worrying about people hating him, but he's not invented the idea, he's just taken it to its logical conclusion.

I can't stand the Impeach Bush signs, particularly because I think that this man is taking the piss out of my own political beliefs for profit, but I have to say that complaining about those and not the general land spam that goes on is ridiculous. My Second Life has been made far worse by other ads. What to do about it, apart from whinge? Well, I'm planning a more organised response, but the obvious thing is do not buy land from anyone advertising like that and, just in case the former ignorant defence is the case, tell them why. A message saying "I was thinking about buying the land at [X,Y] but I think that your advertising policy is much too annoying to support" could well have an impact, if it comes from enough people, and, you know, there aren't actually that many people in SL. Pointing out that advertising is being counterproductive is the best way to get it changed.

Incidentally, I'm compiling a gallery of particularly bad examples, so if you are reading this and have a good one, please get in touch.

Concerning an Irrationality of Permissions

I recently received notice from a person to whom I had given a copy of my Visual Radar Display (which, now that I think about it, is a stupid name - a radar display that wasn't visual would be worth noting, but not one that was) that it wasn't working. Odd.

I took a look and asked him to try a few things. The marker object - the glowing dot - was apparently disappearing from the radar's inventory after the first appearance of one, and the radar was complaining. Very odd. Works fine for me. So, thinking that it might be a problem with permissions, I took the marker out of a copy of the radar, made sure it had full modify/copy permissions set, deleted the old one, put the new one back into the radar, and gave it to him back to try. This image shows what happened:







That's a picture of no dice. It still didn't work.

It was only until this morning, when I received some further advice, that I worked out what had happened. The permissions of object A when it is put inside object B's inventory are not necessarily the same as the permissions of object A. They're not the same as the permissions of object B. One might think this a little illogical and I feel that one would be correct in this thought. I've just been playing around with putting objects inside other objects and sometimes, it appears, they are the same as those of object A. I'm still a bit confused, but the lesson that's been learnt at the end of this is check the permissions of object A once it's inside B's inventory, by right-clicking A and selecting "Properties", rather than assuming that SL is going to be sensible and give it the same permissions inside B as outside B.

Sunday, December 04, 2005

A new hobby

Something that I have been doing quite happily since I built my first vehicle has been spotting and investigating skybuilds.

I'm a curious sort of person anyway, and one of the things that I enjoy doing in SL is looking at other people's homes, particularly trying to get into bits that they're trying to protect. Is this bad? I suppose it is a little, really. I'm not interested in spying on anyone - if a place is occupied I will stay away - but to me, a "keep out" sign, implicit or explicit, says "take a look".

People don't usually build sky houses unless they want them to be unobvious, so looking above 200 metres is intrinsically attractive to me - anything there is going to be something I'm not meant to see, and thus want to see. The procedure is quite simple. Go up to a point above the clouds, change the graphics options to show everything to maximum distance, see what's about. Then turn the graphics options back down to make SL workable and go and investigate the areas where you saw things. Hover around them, get out, take a walk.

(For anyone who wants real privacy from people like me: it's not hard to get scripts that eject anyone automatically from a particular area who's not on a list, no problem. But I'd urge you not to do so, because there's little enough in exploring SL that's a challenge.)

In which more peculiarity occurs; also, a vehicle

I was innocently sitting at home, minding my own business, when a hovercar pulled up above my property, stopped, and one of the occupants opened up with an automatic weapon. Either it was a rather ineffective one or it missed, because nothing appeared to happen. Then, the car flew off. This all took a few seconds and I was entirely unable to respond with any form of responding fire. I have a Seburo for these purposes, you know.

Anyway, I've been investigating vehicles. These are relatively complex things to build, but I think that I've now got most of the issues involved. There are a number of different parameters to do with movement that one needs to get right, and one needs to understand how to take controls, but as far as the movement goes there seem to be only two major things to understand:

1. Linear motion - you move yourself left, right, forwards, backwards, up and down with linear thrust, and you use linear friction parameters to control when you stop;

2. Angular motion - the same, but as concerns spinning you around. You might also want to use the VEHICLE_VERTICAL_ATTRACTION parameters to keep the vehicle upright.

It's all relative to the rotation of the vehicle, so if you thrust up but you're pointing towards the ground you'll go horizontally. Really, it seems daunting playing with the scripts concerned, but if you start from one of the basic sample vehicle scripts you'll get the hang of it in no time.

So here is the AG "Bandit" Skimmer v0.5.1...

AG Bandit Skimmer

AG Bandit Skimmer

with my good self piloting it. It has two main modes, controlled by voice commands - "hover" where the vehicle keeps a constant height above the ground or sea (which you can move up or down) or "fly", where you can thrust up or down in the same way that you would thrust back or forwards. As well as that, the anti-gravity can be turned on and off, and there's a front-mounted gun:

gun close-up

which fires a pointless red plasma bolt that explodes rather prettily on contact with anything:

bolt explosion

though, at the moment, it seems to detonate immediately on leaving the skimmer if it's not moving. I'll fix that. When you're moving it's fine. Should there be a call for it, the bolt could also kill people or cause them other discomfort, though it's really just for show.

I'm not pimping for sales here by the way - contact me in-game and say "I read your blog" and I'll be quite happy to give you a copy of any of the objects mentioned here. I'm not much of a saleswoman. I just don't care, really. Certainly if you're interested in how any of the bits work, I will tell you, at length, until you're so bored you wish there was a way to remove your ears.

Friday, December 02, 2005

Ring ring ring etc BANANAPHONE?

So I was playing with an object, that, when touched, sent you flying a few hundred metres in the air. And I tried it out, and it did indeed do that, and when I returned, I found I'd acquired

bananaphone

Yes, a bananaphone, playing a segment of the music on a loop and following me around. I laughed for a little while and then deleted it, because it was going to drive me mad.

So I'm assuming that there must have been a bananaphone lurking at high altitude above me, waiting for an innocent victim to latch onto. I've tried to find more of them up there but with no success. Who plants bananaphones five hundred metres in the air?