Showing posts with label scripting. Show all posts
Showing posts with label scripting. Show all posts

Tuesday, December 6, 2016

Reader Submitted: My Psychotic Little Friend


By Kain Scalia (Maus Merryjest)

Coming back to your hold hunting grounds after a prolonged absence  always brings with a certain feeling of nostalgia.  There are inevitable changes, places and people gone. If you've been absent long enough, the landscape that greets you might convince you that you've arrived at your haunting grounds, instead.

But then there are also the welcome surprises, new vistas that, although not able to replace the longing for the old, certainly have new and wonderful innovations. New faces and old friends step forth to greet you, and recently the Lindens seem to be plunging their hands into the depths of oblivion itself to pluck echoes of the primmy past and bring them into our midst.

In a way, like the Gardens of Apollo, I am a vestige of the antediluvian days of Second Life, freshly plucked. Though I assure you, gentle reader, that the plucking was done by my own hand- I would hate for any Linden to have to be held accountable for my existence.

Between all of my accounts, I have been Second Life now twelve years, prim and dance-ball, and I have seen a lot. I've seen things you wouldn't believe. Ships on fire off the prow of the SS Galaxy (this was shortly before they reconsidered having those 'ornamental' antique cannons on board. And before they considered not allowing me any matches while on deck.) I watched floating objects in obscene shapes glitter in the studio lights as they interrupted Anshe Chung's press conferences. All those moments will be lost in time, like that latest new outfit you bought for the most recent social shindig and which has now been forgotten in the depths of an inventory so vast that entire sims go offline every time you connect. 

Well, they will be lost in time, unless we talk about them, of course, and I can't think of a better way to introduce myself (anew) than to share one such moment of my Second Life past with you. After all,  I have returned and intend to stay for the duration (knock on wood, right?)

I am sure we all  have one of those stories from our salad days in Second Life, when we were bright-eyed and bushy-tailed, so full of innocence and faith in humanity before that accidental teleport landed you in Midian City. You know what I'm talking about: the first time you accidentally wore a whole house on your heads because you didn’t understand how to rez things in-world, or the time I broke my hair  by fiddling around with it  so that I ended up looking like something right out of a Buggles video, or that time you accidentally ran over a Linden with a flying genital…

This story hearkens back to the days when I was trying to learn how to script the hard way- by tinkering around with the code, and may god have mercy on your soul...

You see, one of the things I wanted, more than anything in the world back in 2006, was a little virtual pet.  Something that would follow me around, like a little drone or an obsessed stalker.

I always made the best of choices.

 So I created this little computer monitor with a goofy smile. A pixelated, green-glowing tiny maniacal grin the likes one is likely to see shining at you from the darkness of an opium den. To this magistral idea, I added a bit of  floating text. This text proclaimed in yellow capital letters, "WILL YOU BE MY FRIEND?" 
 
  I want to remind you, reader, that I found absolutely nothing wrong with this at the time. What's more, I decided that I wanted the damned thing to not just follow me, but to follow anyone that got close. I guess I was going after the impression of  a lost puppy which would follow you if it had lost sight of its owner, lost and alone. 
 
 Being, as I told you, new at all of this, and only having the slightest idea of what I was doing, I ended up miscalculating how fast the screen from Hades would go. 

The moment I released this homunculus of chaos, my screen froze. Once the client got its bearings,  I suddenly found myself halfway across the next sim, without a clue about  what had happened. 

Let me remind you, this was back in the day before Linden Labs added some safeguards against what would happen when an object traveling at high speed would impact you.

On my map, could see this little  light-blue blip on the map moving here, then there, then there, then here. It was moving awfully fast.

You see, there had been a wedding going on not too far away from me. 

Just as the beautiful, veiled  bride was making her way down the aisle, or so was reported to me, my most terrible Frankenstein's monster comes speeding in, psychotic grin on full display. "DO YOU WANT TO BE MY FRIEND?"

And then it twanged the bride into, and through, a tree.

To this day, songs are still being sung of how my makeshift scud stalker bounced off the gathered guests who were unlucky enough to be standing. Several of them made it into the stratosphere. I hastily made my way to the commotion only to find a scene straight out of a George R. R. Martin wedding, if the good people of Westeros had invested more in catapults than in daggers.  

Once the intervention of a Linden had been secured in order to tame the tiny prim Antichrist, the guests and the bride were free to gather anew. The groom, however, had not yet come back online after being propelled across the sim and crashing. I hastily apologized, gathered up my electronic enfant terrible, and performed a retreat worthy of Napoleon attacking Moscow.

I didn't log back to Second Life for a week, and it would be a full year before I would try coding again.

But if you, dear reader, think that was the end of my misadventures, then you clearly don't know Second Life. I could tell you, for example, of the time that a most unfortunate sim crash led me to being teleported to another location and, to my great surprise, materializing hovering on top of an altar, completely naked before a congregation that was, at the time, celebrating the sacraments (to THEIR great surprise.) 

But that would be overstaying my welcome in an almost Baron Munchausian way. I look forward to our future and frequent rendez-vous, because surely I will have more stories and items of interest to share with you. Second Life being what it is, hardly a day passes where something out of the ordinary doesn't come to pass. 

-Kain

Tuesday, July 23, 2013

Commentary: Scripting and its Corruption


By Theonlyjohnny Resident

    Scripting is the foundation of Second life fun. It's used for simple things, like a title above your head, and it's used for complex things, like a DJ board. However, scripting has opened up a new chapter in history. A chapter of corruption.

    Most people use scripts to better either their sim, products, or to help better others. Some people use scripts to infringe upon rights of others. These people have been corrupted by the power that the knowledge of scripts has bestowed upon them.

    There are many scripts that are used by corrupted people. Of these, a few scripts stand out from the rest. One of these scripts is the one that is in a lot of attack huds. The script is known as the banishment script, and is used for banning someone from a sim, or even a full region. This script is one that should never have been created, since you can use it, even though you do not have admin powers in the sim, or region.

    Another script, believe it or not, is a game script. It is one that many people have simply called an incomplete script. Sometimes, it is, but other times it's that way for a reason. The script has everything that a normal game script has, with the exception of one crucial part, the prize giver part. Unsuspecting people will pay to play the game, and when they win, it will not give them anything. This script hasn't been one that people care about a lot, because most people assume it's just taking a while, but the prize never shows up.

    Another script, surprisingly, is an anti-fly script. However instead of just banning you from the sim or region temporarily, it will permanently ban the person. Not only that, but some of them, that people buy from shops, have a network wide ban. This means, if you're banned from one place that uses that anti-fly script, you will be banned from every single one of them that use that same anti-fly script.

    Most of you probably have not seen these scripts, but believe me, I not only have seen them, I have been a victim of all three. Scripting is a great thing, but there is a line between scripting to help others, and scripting to make a joke for you. The way things are going, it won't be long before people won't even be able to go afk in their own homes, without being banned.

Theonlyjohnny Resident

Thursday, February 28, 2013

Rua Whitepaw's Keyboard

By Bixyl Shuftan

While talking to Nydia Tungsten recently about her new radio station for KVXN, she wanted to show me something else. We went to a place at the Angels Estates, and there was Rua Whitepaw, whom had a large keyboard before her that reminded me of the one Tom Hanks was dancing on in the movie "Big."

"THIS is the other news Item I wanted to tell you about," Nydia told me, "She has even been awarded Lindens to continue working on this." Rua shyly greeted us, and then explained how the piano worked. "You can click on the keys to play," she stated, then explained there was another method, "You can say the name of a note in channel 2 chat. So for example /2 C4 … It goes from C2 to C6, and the back notes are with #. So C2 C#2 D2... and so on. You can also combine keys to make chords... try /2 C4 E4 G4." I did, and the result was a short melody.

"The real fun part is that you can write scripts that say the right things at the right time," She explained, "Like this …" And the piano began playing a tune familiar to those playing Nintendo games. She then did a second one from a familiar Russian drop piece puzzle game, though there was a pause, "SL lag sometimes messes it up a bit. … I think it's actually flood protection. You definitely need a lag free sim to make it work right."

When I asked her where she had got the idea from, Rua answered, "I remember seeing a piano that you could play by clicking in Rocket City. But that could only be played by clicking so it was cumbersome and I felt that it limited me in expressing myself musically. So I wondered what if I make something that lets you play several notes at once And then I thought, if I make it listen to chat, then I could tell it to play as many notes as I want. So two days ago I thought I'd try it out to see if I could make it work."

"Then yesterday I made the basic idea, it was the same as now except with less keys, and then I showed it at Rocket City. And they liked it a lot and offered me money so I could improve it and then sell it. I don't think they want to sell it there though. I think they just liked the idea and wanted me to finish it." "I think they do," Nydia commented, "or they wouldn't have given you the money." Rua explained there were expenses in building the keyboard, "each key has its own sound, so that's 10 L$ each to upload. It has 4 octaves and 12 keys per octave... so 48 keys, that's 480 L$ that has gone into it already." Of what Rocket City wanted with the keyboard, "maybe they'll put it out there too so others can use it, like the old piano."

Rua continued, "I guess the nice part is that the sounds can easily be replaced. So if someone has sounds of a proper piano or some other instrument, they can put them in. … I can show you the scripts I used to make those three songs. Basically every note is one message. So if it were to appear in local chat there'd be hundreds of messages. The scripts work by saying the note names, and then waiting a certain time. The shorter the time, the faster the song plays. But it sounds strange when it's too fast, because the sounds all mix together. And it also causes more flooding."

Rua called the keyboard, "more of a proof of concept more than anything. But I like that it works so well. It's amazing what SL can do really. And I'm kind of curious to see what others can make out of it. You can be creative and express yourself with it, that's what I think is important. It opens doors." Nydia was all smiles about her friend and what she had done, "She has done EXTREMELY well, and I am VERY proud of her. She is a VERY smart girl." Later on,  Jasmine Dawn Shuftan saw the piano and commented, "Rua you made a wonderful thing in this, made SL a little more beautiful."

Bixyl Shuftan

Monday, May 7, 2012

Lindens Launch 100 Pathfinding Sims

Artificial Intelligence (AI) has gone viral on Second Life's main grid. A new technology called pathfinding embeds AI in SL servers. On over 100 sims, AI characters can navigate intelligently among avatars, terrain, walkways, and obstacles, with behaviors such as pursuit, wander, evade, patrol, and navigate to location.

Any of these behaviors can be invoked with 2 lines of Linden Scripting Language (LSL)… to automatically move mesh or classic prim objects… possibly replacing hundreds of lines of vehicle animation code. Is this just a reduction in user code or something more? Yes, much more.

Pathfinding is a new mobility ecosystem. Pathfinding can calculate all feasible pathways across land and prims (e.g. bridges), generating a navimesh (picture 1). Pathfinding characters (aka Non Player Characters or NPC) use AI searches to find navigable pathways to their target avatar, object, or location. Throw up a roadblock? No problem, they will find another way round. There is enough randomness and simulated nervousness in the solution, that NPCs have distinctively organic motions.

Yeah, but what about lag? Everyone asks. Okies. I ran stress tests with my animated NPCs on the Snack Sandbox regions. Kitty is a 4 legged animated critter that walks. Funky Munky is a humanoid NPC that strides and does a funny skit. I took baseline performance stats, then starting rezzing wandering NPCs simwide; hundreds of them.

As I watched the lag numbers; a startling result! At first, only 2 numbers trended with added NPCs, Physics Time went up and Spare Time went down. All other numbers flatlined... no effect. Just over 100 NPCs and Spare Time hit zero; the first noticeable lag. Amp that up to 200 NPCs, and yes, we are driving frame time up as well, but linearly, not aggressively. Even more surprising, virtually no NPCs crashed. After rezzing 200 kitties, I only lost 2 and the population held steady for several hours. Conclusion: multiply your Spare Time by 5 and that's how many animated NPCs you could rez on your sim without any noticeable lag.

That means, Lindens created a very reliable and efficient infrastructure, but only for NPCs. Of course, all this AI is beta test, and sim crashes happen often outside the sandbox. You know this when you can't move or chat… you've got crash! The sim does an auto-rollback, including your inventory; and sometimes you relog to a place you left hours ago! Time Warp! Coolies!

The Lindens should be congratulated for these achievements... but that's not enough. User generated NPCs should support animations, in other words, NPCs with moving limbs that walk and gesture. I used the very popular prim animation script by Ferd for my NPCs. My teaching NPCs worked for weeks… umm… until Wednesday, when Lindens rolled out a new server beta that broke all my prim animations and everyone else's. Ugh! Fix that bug!

To date, Lindens test pathfinding with the default cubes that you rez when you start building (Picture 2). This testing scales to other non-articulated NPCs such as rubber duckies, plastic bunny toys, and snails. Clever use of flexiprims gives you a few more options (Picture 3). Let's see, hmmm, NPC can only travel on land and float but not animate… maybe ghosts? daleks? spaghetti monsters?

To fill the vast depopulated regions of SL with engaging content, citizens of SL need animated NPCs… i.e. NPC people and realistic, animated NPC critters. I'm just saying... pathfinding has tremendous potential. Linden Prayers that it lives up to expectations!

Picture 4: Any, Lorca Linden, Maestro Linden, and Falcon Linden, "the genius behind pathfinding AI. Dude! ... You ROCK!

The Pathfinder Users Group (PUG) meets Thursdays at 4pm SL time on Aditi test grid at the PathTest megaregions (use the Map to find us!). Chat log from this meeting: http://wiki.secondlife.com/wiki/Pathfinding_in_Second_Life/2012-05-03


Any1 Gynoid

Original published on CNN 

Monday, October 11, 2010

Scripts and Lag

I recently had a talk with EriX Oh of the Skybeam Estates. He wanted to discuss something many residents in Second Life don’t seem to be aware of: script lag.

Most residents are aware of the fact that more prims are around, the more lag there is, as each one takes a little bit of processing time. Scripts, however, also take time. So objects with scripts will create more lag than those without. EriX just shook his head at the mention of builders whom obsess with economizing their creations to have the fewest prims possible, yet stuff them full of redundant scripts.

“Many avatars with huge script-times/script-counts, they always tell me Linden Lab is the problem. I say to them they are the first problem. When I then ask the users to detach something or leave, they get angry. And even when I explain in detail, ... they still do not understand it.”

Of the subject on avatars and lag being written about more after the Avatar Rendering Cost (ARC) became available to view as an option, Erix commented, “That’s what many say, ‘Yes, but my ARC is low.’ That’s wrong. Scripts do not count in the ARC, and the ARC is only to detect local lag, not server lag. I must say my ARC may be high, but I’m not hogging the server (grin).”

As the manager of a sim, Erix had tools to help him see how much lag various objects created, sending me a couple pictures, “what you see here are all ‘ heavy loaded’ scripts .... - as this display is only limited to display ~100 scripts at one time. What you see here are times, how much time scripts need to execute.” By “heavy loaded,” he meant scripts particularly long and full of instructions, “and cause a lot of CPU load. The quantity of scripts does not matter if it lags or not, it’s the quality. What I look for often here ... generally speaking for an av, under 1 ms is okay, under 0.5 ms is perfect. When the sim has many scripts to execute, it all raises the times a bit. So on a full sim, I don’t care when I see avs under 1 ms.”

So when does script lag really begin? “Generally it’s a bit by bit feeling. You can’t say that avs over 1 ms are automatically ‘lagger: out!’ You need to think every av, even scriptless ones, cause CPU load on the sim. All objects with and without scripts cause lag. I look first at the sim itself. Are there many people? In a sandbox for instance, over 20 people around means it’s likely to lag. Who has objects with scripts? They cause lag. What I want to say, an avatar with more than 1 ms, is built wrong.”

Erix informed me that the fox avatar he uses most of the time is a modified copy of the original with redundant scripts removed, “removed over 300 scripts ... I’ll put on my original, and show you how ugly the times will be. You can potentially as one av lag a whole sim.” He then changed into his original av, which did seem a little slow to load. At first, the only difference seemed to be it’s use of invisiprims (EriX replaced them). Then he gave me a couple pictures of his sim statistics, and the difference was more obvious, :3.665 on an *idling* sim! Why that happened, if you look at me closely, you’ll see in *every* prim a script: Foxcolor. I counted them - 328 scripts!” These scripts were solely used for changing the color of his avatar fur. Since it was fully modifiable, after choosing a final color he removed all the scripts, “I also got rid of the original HUD, which I counted around 50 scripts.”

I mentioned some of my avatars had the option to change hair color. Erix answered, “Then they MAY have in every hair a script. May, because LL introduced a command in LSL to change child-prims from the root-prim on. So *one* script can change up to 255 child prims.” I changed to a "furry" skunk avatar with had a number of options which required some scripts, including changing hair color, as well as a radar, male AO, and flight feather. Erix looked at the statistics, “still under me (0.342), you’re 0.257. Nothing to worry about from my view.”

“A huge amount of scripts has other side effects. TPs often fail. And lagging, lagging, lagging. And because there's no quick, easy way to remove these scripts, I made a program, this: http://foxreports.lu/software_slavscrm.php . Note that those who use the program: I'm NOT responsible for ANY damage.”

“So girls, with many hairs, check the script-counts, and remove them if not needed.”

We talked a little more, and soon parted ways, me knowing a little more about scripts and lag, and how a sim administrator saw it.

Bixyl Shuftan