Tuesday, November 18, 2008

Weapons! Transcript, Aether Salon the Second

Viv Trafalgar: Welcome Miss Malaprop

Ordinal Malaprop: Good evening all!

Sera Puchkina: Welcome to the Aether Salon of Babbage! Thank you all for coming today. We are grateful to many fine people who helped make today’s event a reality – Miss Canolli Capalini of Capalini Fine Furnishings, for her wonderful chairs. Miss Breezy Carver for the food and drink, and Mr. Jasper Kiergarten for his assistance with today’s craft. And my personal thanks to Miss Viv Trafalgar, my co-leader who put in many hours of preparation for today’s salon. If you would like to join the Aether Salon group and receive notifications of future salon events, click the lower right hand corner of the large brown sign by the entrance. If you click the lower left hand corner of that sign you can help contribute toward the cost of running the salon. The craft will be distributed after the discussion. As a courtesy to all, please turn off everything that feeds the lag monster -- all HUDs and scripts, AOs, and the like. I turn this over to the amazing Miss Trafalgar who will introduce our speaker.

Viv Trafalgar: Thank you Miss Puchkina, for everything, as always. My friends, fellow Babbagers, and distinguished guests, I find myself in the position of giving an introduction for someone who needs none whatsoever. And yet, I will persist for a moment because I do so love the sound of my own voice.Whether she is developing new ways to enchant and/or maim, teaching by example, or simply laying waste to stupidity with a wide-ranging and deadly wit, Miss Ordinal Malaprop is one of the brightest and most inventive lights on the grid. Should you have the opportunity later, please take the time to read her thoughts on a range of topics, located here http://ordinalmalaprop.com/engine/.  For the present, however, the topic is weapons. From pistols, swordsticks, revolvers, cutting torches, and throwable blades, to snowball shooters, remote controlled guns, and more, Miss Malaprop is a major supplier of mayhem and bodily harm to citizens far and wide. Moreover, she is well versed in the requirements and qualifications for systemic damage, in particular combat systems. And occasionally, devices that are more suited to punishment than siege battles. It is also worth noting that her devices are never, ever dull or staid. I could go on, but if I did, I'd likely find myself chased down by bees, or pelted with snowballs. What I really wish to do is pull up a chair and listen, and so I shall. Please do ask questions (and keep your mitts off the craft boxes, too) and welcome a great friend to both Babbage and Caledon, as well as the rest of the grid, Miss Ordinal Malaprop.

Ordinal Malaprop: Thank you kindly for the extremely flattering introduction, Ms Trafalgar! I find myself blushing but it should not affect my actual speaking, I hope. Well, as mentioned, I am indeed Ordinal and I am here to speak on the subject of Weaponry And Such. I would be delighted, should you have any questions during my ramblings, if you would mention them in order that I might have a guide as to issues to address. . .  . Or, if you wish, I can simply continue to waffle on indefinitely. One thing that I am not entirely sure about, for instance, is the level of interest in specific parts of weaponry design, etc, so, if there is a wish to hear more about scripting, please say so.

Actually, I appear to have gone temporarily deaf in fact. Eardrums are fragile. Let that be a lesson to all. Ear protection _on, before_ testing the munitions. In my journal I somewhat derivatively subtitled this address "everything I need to know about LSL, I learnt from weapons" which is actually almost true. (Apart from the vehicles.) While preparing myself for this evening I was pondering on the nature of what a "weapon" actually is and really, the conclusion that I came to was that, at base, it is in fact a communications device. And not merely in the usual "only language they understand" sort of way. The underlying nature of a "weapon" is to communicate certain information - be that by a built-in protocol such as the Linden Damage System or via some sort of other more custom one.

Incidentally, and I will be doing this all throughout, so feel I should warn you at this stage I will not be speaking much of weapons which are primarily intended to cause Unwanted Effects upon others. Well, by this I mean such things as Orbiters and Torus Bombs and all that sort of thing.
Of course, in practice, few wish to be hit in any circumstance, but there is a level of consent. Even in "free fire" areas, there is implied consent. Whilst in my youth I was known to experiment with such things nowadays, really, it is not something much of interest.

The most efficient weapons in this sense, after all, are the Ban Line, the Estate Panel and the Friendly Linden Ear. These beat any sort of "cage" into a cocked, and flattened, hat. In this case, then, what do I mean when I speak of a weapon? The term covers a multitude of sins, but the common factor I would say is, quite simply, appearance. In that weaponry on the grid does look rather like weaponry outside of it, or at least should. Or have certain commonalities. I would say that it should also be something capable of causing simulated injury, but actually, that is not always true. Much of precisely the _function_ of a weapon will depend on what it is meant for and who is purchasing it. In my experience, purchasers and users of weaponry tend to fall into a few main categories, each with specific needs. Of course, these categories often overlap. Doubtless, I have forgotten some very vital ones. But, moving along a line from concentration on form to concentration on function.... Firstly, there are people whose _only_ real interest is in form. "Fashionistas," if that is not an insulting term. A weapon is basically an accessory. It really doesn't matter an awful lot quite what it does. It should be able to be drawn and sheathed, usually, but the main interest is in how well it fits a particular outfit.... In this market, prims and textures are most important and communication the least. It should be able to go "bang," or make whatever noise is appropriate.  Please note that I make no value judgments here! This is a perfectly valid use.

Moving slightly on from that group are "collectors" and "historians" who are concerned usually greatly with form and its accuracy to a historical pattern but also are concerned that certain aspects of function are present. Accurate models of reloading, say, or an appropriate level of damage in an RP area. I generally use "historians" to refer to people with a particular interest in a particular period, and "collectors" to refer to those with an interest in accuracy mostly for its own sake.

Then we have a middle category that I call "toy lovers" who like form, but also like entertaining function that has some effect on the rest of the world. Possibly "casual gamers," but also possibly, um, firing rockets at a particularly ugly Shopping Centre next door something I have certainly _never_ done on the mainland, oh no. Or, you know, throwing paper aeroplanes. Or something involving bees. In other words, function is important but it isn't very specific. It just has to be entertaining. Finally in this overlong introduction there are those interested in specific types of function.

Firstly, "gamers," who wish to have weapons, which interact reliably with each other and with a specific system. This includes, say, Samurai Island warriors, or those using En Garde. Yes, En Garde rapiers and swordsticks are weapons here, very specific ones. Form is useful but really, who tends to see the weapon anyway? Ideally your opponent should not be seeing it for very long. And then we have "RPers," a term as you know that I dislike but have no good alternative for. RPers could possibly be considered as a combination of gamer and historian or fashionista, but do not quite fit the latter as the form needs to fit in with a choice of dress specific to that individual though, in towns such as Deadwood, there is a definite historical form requirement.

There is also a functional requirement, which is usually strictly enforced. At this stage, does anyone have any areas that they would like to hear addressed next? Or briefish questions?

Dreddpiratebob Streeter: scripts miss

Ordinal Malaprop: Scripts, yes. I can certainly move on to a more technical discussion if that is the sort of thing that people would be interested to hear. I will go through some of the areas of scripting which are essential, and why. I have to say that there are many different ways of scripting weapons and doubtless other people do things differently. But one thing that I think it is always essential to have a good grasp of is permissions and controls. All of my weapons have a central co-coordinating script and its most important function is to allow control by the wearer. Permissions and controls are actually quite easy to manage but can appear daunting to the novice particularly as they do use Bitfields. Master your |s and &s rather than ||s and &&s, and so on.

The major things that do use control events are weapons and vehicles, so these are good practice if you wish to master them. So, my main controls script gets control permission when attached and drawn, and also animation permission, which is rather essential. PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION It also responds to the appropriate controls being used, obviously it would be a little silly if it did not.

On the subject of weapon controls, there are two main standards, which should generally be stuck to for compatibility and ease of use in my opinion. Close-combat, "melee" weapons use the format I think first used in the Safezone system which is (hold left mouse button) + (move in a direction) to strike. And (button) + (down) to block. It is vital to use these controls as some of the most popular RP systems actually detect their use for melee attacks (DCS2 particularly) so if you don't, your customers will be annoyed and defenseless and possibly dead. And dead customers are Not The Thing One Wants. Anyway, ranged weapons use the format I think first used in, er, the Linden Popgun. Very simple, enter mouselook and then left mouse button and a Thing is Shot or Bees are Released, or Humbugs are Thrown, or whatever. I have a basic script for ranged weapons and one for melee ones, which I drop into whatever I am designing and then modify significantly given that basic scripts are dull.

Is there any particular aspect of the scripting that I might address as a priority here by the way? Methods to produce effects such as drawing and sheathing, particles, muzzle smoke, synchronizing effects, rapid fire, projectiles having effects, using APIs...? I can certainly speak about all of them. It might get past certain folk's bedtimes though.

Riven Homewood: I am very curious about drawing, sheathing and particle effects

Jedburgh30 Dagger: I am curious about projectile effects

Ordinal Malaprop: The second control mechanism apart from directly taking controls, to control a weapon, is via chat. HUDs and then particles then.  Of course no civilized weapon actually requires open chat. But, for instance, "/11 draw" is a fairly standard method of drawing and sheathing a weapon. I tend to have all user commands accessible via a positive chat channel like this, usually in fact 11 (this can always be customized by the user if you allow it) Now, a HUD is quite capable of also sending chat commands. So this sort of system allows for both spoken and HUD usage. Sometimes one just does not have space for a HUD after all. It is always important to check the owner of the speaker by the way, in the listen that the weapon has. If (llGetOwnerKey(id) != llGetOwner()) return; is the line I have at the start of the listen() event usually where id is the key of the "speaker". An avatar's owner is itself, so this will allow either the owner to speak or any of his or her objects.

By the way, some HUD data does not need to be transmitted by the user ever, so can use some sort of weird negative channel but the same principles apply, just the HUD must listen.

Breezy Carver: When you went to 191 channel was there a reason for that??

Ordinal Malaprop: Um, I used 191 because I had not decided to use 11 at that stage. Nowadays, I tend to use 11. Does that answer HUD questions or at least a reasonable subset of them? Particles. A very wide topic.

Greg Merryman: is there another way a hud can communicate with a weapon besides chat?

Ordinal Malaprop: Mr Merryman, potentially yes, in practice all other methods would be less efficient. I suppose it could use email. Or http calls. Any particular sort of particle effect might I enquire? In general, the two types used are just explosions and cones. When constructing particle effects for an actual weapon itself, I have specific prims devoted just to that. I have a few basic ones in my "toolbox" which I attach to designs and then customize, as they are so frequently used. A "muzzle smoke cube" and a "muzzle flash cube." Those have short-lived particle effects, which are triggered by link message.

Sending link messages is another one of those skills that is pretty vital in scripting terms, though that is not just for weapons. Oh, A point about link messages. Some of the more outré weapons, and indeed some which are allegedly simple, do use an awful lot of prims, as I am sure some may have noticed. Sending link messages to all of those prims at once might be inefficient. It is therefore best, if there is only one prim that cares about a message, just to send it to that prim. On the other hand, it is hard to isolate that prim sometimes, and its link number should NOT be hardcoded that is a very poor thing to do and certainly nothing that I have ever done *cough*  The way to get around this is to have a little function at the start which goes through the names of all of the prims, and when it encounters one which has the name "muzzle flash", say, stores that link number for later use. This should activate on CHANGED_LINK as well as on script reset.

I won't bore people with the actual code for that now but if anyone is interested I can provide a simple example afterwards. However_... pauses dramatically … sometimes it is best to use _semantic_ link messages in other words, the main control script (which is the one that should send all these out, really) says things like "firing!" or "drawn!" or "turned into camembert!" and then leaves it up to all of the subscripts which you have littered your design with, and forgotten to change the permissions on before sale, to work out what they are meant to do. So "drawn" might, er, in the case of my clock-loading pistol, say, trigger a change in the alpha of the gun itself, and also potentially the playing of music. This sort of thing is an awful lot easier to script on a conceptual basis. Distributing the processing also helps make the control script a lot simpler and really, the control script should just be, well, _controlling_.

Whiskers Beardmore: are there performance issues to worry about having too many scripts listening for events?

Ordinal Malaprop: If you are constructing something appallingly complex you might wish to have a modular system, and even turn scripts on and off when not used. Listening for events: well, they don't actually listen as such... not using a general sim llListen.

Whiskers Beardmore: is it possible to script turning scripts on and off from a control script?

Ordinal Malaprop: I try to only have one script ever running a sim listen. However, yes, I believe there would be a slight effect from having lots of scripts with link_message() events, though not in my experience a lot. Sending the messages is a more laggy process. Don't have, you know, dozens of the things, I would advise generally. Yes, it is possible to turn scripts on and off by script, let me see... the function is called something like lSetScriptSate *state I don't use it very much to be quite honest with you. I have in the past, though that was not for weapons, for an artificial lifeform thingummy. But if one has a horrifically complex subscript which is only needed occasionally, why _not_ turn it off and save its breath? I have digressed a bit from particles and effects. That is how I usually manage effects within the weapon itself.

Just quickly on the subject of projectiles... A projectile (and I usually have them as one or two prims - a long, transparent "spike", which is necessary to overcome physics framerate issues, and a visible prim) can sometimes have particle effects in flight, and for simple bangs and smoke, the controlling script within the projectile can make its own particle. Turn physics off, turn phantom on, trigger the effect and sound, wait a little and die. Yes, so I hear. I suspect spikes will still be necessary though. Just not, uh, enormous spikes the size of houses, which are rather required at the moment.

Greg Merryman: what is the purpose of the spike?

Marion Questi: So the spike is the actual projectile? The visible prim is for esthetics?

Ordinal Malaprop: The spike ensures that a fast-moving projectile actually intersects the target. Yes, the visible one is aesthetic. Every "physics frame," moving objects are moved forward by a certain distance, and if they are too small they may just appear on either side of a target and not trigger a collision which would be a bit silly. This took me ages to work out. Perhaps I should have asked somebody. Hey ho. Well, it took me ages a few years ago. There is no calculation of intervening positions still under Havok 4 I believe.

Anyway - collision effects. For more complex effects I usually find it best that the projectile rezzes another prim when it collides, and then dies.. An advantage there is that _different_ prims can be rezzed. For instance, in my hand weapons, there is a different effects depending on whether the "weapon strike" projectile (very short-ranged) collides with a person or an object. *effect I seem to recall that I used two different prims for this. On collision the strike projectile works out what it has hit, and rezzes the appropriate one, and then goes to join the choir invisible

Greg Merryman: so the rezzed prim would take the place of a particle effect?

Ordinal Malaprop: The rezzed prim, or prims, then generates the appropriate effect on rez. Some complex explosions can require a multi-prim object, seeing as how there is only one particle effect per prim allowed. Plus, one might wish to have shrapnel, say. Which involves a _third_ level of rezzing. I would not advise anyone to go much beyond that as it then becomes an utter pain packing all of one’s prims into other prims and then into other prims, during testing. But when making particle effects, I do advise that people always consider this possible method. A tiny and volatile one. It is much simpler to be able to rez a prim and know that it will do a certain thing and be able to forget about it, than mess around with particles in a control script. Also, some things are just impossible to do from the projectile, as particles must be emitted from different positions. Well, one could always setpos the projectile around I suppose. But that seems excessive. I constructed an "airburst" explosive at one point for instance, which, if close enough to the ground, produces a ring of dust, as well as having the usual explosion. That throws a dust ring prim downwards, which works out the radius that it should be producing dust in with a little trigonometry based on where it ends up. This was rather a nice idea I thought but in the end pretty useless and not very impressive. Hey ho. Such things are their own reward. Luckily. I hope that goes some way towards answering particle-related questions....

Ivniciix Wemyss: for something...larger, like a ship cannon, do you still recommend this procedure of an invisible prim for the actual dmg and accuracy.

Ordinal Malaprop: Ah, well, vehicle weaponry is much more dependent on the combat system in question. With hand weapons, one really just has to rez a bullet moving at over 17.5m/s and have it hit the target, and it will automatically be compatible with DCS2.

Ivniciix Wemyss: but is such a technique strictly incompatible with something like ics2 or spd?

Ordinal Malaprop: I have seen vehicle weapons, which are actually two separate systems. If they are sensor-based, the projectile is _purely_ a special effect, and may not correspond at all to scores, but looks nice. It will depend a lot on the system, yes. I did mean to read up on the VICE system, but unfortunately was not organized enough so to do but I understand that that uses projectile impact as well. In general though, vehicle weapons would work in the same way to generate effects.

Ivniciix Wemyss: quite true as it currently stands re spd and ics2 I believe

Ordinal Malaprop: If larger and more spectacular ones. In fact the subprim-rezzing method might be _more_ convenient for them. As one doesn't then need to mess around with modifying the system script in the projectile.

Ivniciix Wemyss: let me ask this a different way, is the size of these projectiles such that your technique is less necessary?

Ordinal Malaprop: Well, if the projectile is complex enough, it may have all of the prims necessary.

Ivniciix Wemyss: as far as improving accuracy?

Ordinal Malaprop: Ahhhh Sorry, I have misunderstood. The "spike."  Sometimes, it will be necessary, yes - I usually have a spike of 1.5 - 2m length just in case.

Jedburgh30 Dagger: for handhelds also?

Ordinal Malaprop: Specifically for handheld weapons. Though vehicles are quite big, so if there is no need to register collisions with avatars or glass, a spike may not be required. One can calculate the required size to be sure of collisions by dividing the projectile speed by the physics frame rate and probably increasing it a little.

Bela Lubezki: ah, like radio waves and antennas

Ordinal Malaprop: Along those sorts of lines, indeed! Well, it seems that time is ticking merrily on a bit. The Grid is an everyday illustration of the uncertainty principle. And prim tunneling. Well, I hope that I have managed to illustrate at least a little that a "weapon,"  whilst being a thing that goes bang, is also more than that when taken apart into component bang-ness. 

Very pleased to have been able to attend! Even if it was postponed a little, my apologies for that. If workshops and such occur I would be delighted to pop along to any, the hour permitting.

Viv Trafalgar: Folks, if you've been with us before you know we put out a craft as much to amuse as reward. This time it's a group project: a design your own target and a gag gun. And for you all - the community support is amazing. All of which will be given to Miss Malaprop now. The salon does not keep the speakers' pot. We thank you so very much for your support and encouragement.

No comments: