Microbe City

Using virtual worlds for education
Post Reply
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Microbe City

Post by Graham Mills »

I've decided to build-out Oddball Otoole's public domain Mall as Microbe City to highlight some of the positive and negative aspects of our microscopic "friends". I've barely started but one of the possible applications in my teaching is running virtual poster sessions in which the students produce posters in PowerPoint (basically a single slide saved as a PNG image).

Rather than having to upload the textures to individual display boards, I'm using a scripted controller prim to do the distribution for me. I just load the textures into the prim, touch it and they're sent to the poster stations around the "City". The seats at the stations use camera control to optimize the view and there's a magnified/focus prim for fine detail/discussion. It will also rez an object and give a notecard with the latter in turn being used to specify a web hyperlink and quiz question. Finally, there are built-in teleport and (basic) voting systems to move avatars around and get them thinking about the posters.

Skilled scripters will appreciate that there's nothing particularly clever about this but it does address a real logistical need (cost of printing, space shortage for long-term display) in what is hopefully a time-efficient manner for staff. Of course, it's not a finished product yet and there may be issues with lag. We shall see.

Image illustrating facets of Distributed Poster System (DPS): https://files.app.net/qthmbu2l

(Note "mini-me" version of poster station as rezzed object)
These users thanked the author Graham Mills for the post (total 3):
Constance PeregrineMarstol NitelyKeith Selmes
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: Microbe City

Post by Graham Mills »

I wanted a tourbot that avatars could sit on and that would take them on a guided tour of Microbe City. This script is by Rebekka Revnik and builds on work by Kayaker Magic pre-llSetKeyframedMotion. Guidance on deployment is provided in the script but basically you need a config notecard with "DRIVE = <position> = <rotation>" for each of the waypoints. I changed the value of TIME to 3.0 to speed up movement and it seemed reasonably smooth with just my avatar inworld. There are options to pause and emit chat as well. I haven't tried to implement a version using llSetKeyframedMotion and have no idea of the relative lag issues -- Kayaker might have some ideas there.

Script: http://forums.osgrid.org/viewtopic.php? ... 7&start=10

PS. I used the code below in a prim to generate the points, moving and rotating the prim as appropriate before touching it to generate chat that could subsequently be copied and edited to remove the timestamp. The eventual tour encompassed 56 waypoints (the number is inflated by turns) and took 8 min.

Code: Select all

default
{
    touch_start(integer i)
    {
        llOwnerSay("DRIVE = "+(string)llGetPos()+" = "+(string)llGetRot());
    }
}
Last edited by Graham Mills on Sun Jan 26, 2014 6:17 pm, edited 1 time in total.
User avatar
Constance Peregrine
Posts: 2349
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2778 times
Been thanked: 1482 times

Re: Microbe City

Post by Constance Peregrine »

I used to use this but have not confirmed it still works, or, if so, if it works in Kitely. It is kinda useful tho and maybe someone can even fix it up more...so, ymmv:

Code: Select all

//Scripted by Invalid Caproni, feel free to use it in your own creations, DO NOT under any condition sell this code as is for any amount of money.
vector StartPos;
vector SecondPos = <190.000,165.000,36.500>;
vector Corner1;
vector Corner2;
vector Corner3;
vector Corner4;
vector TargetPos;
vector Rot = <0.000,0.000,90.000>;
key av;
show()
{      
    llSetAlpha(100, ALL_SIDES);
}

hide()
{ 
    llSetAlpha(0.0, ALL_SIDES);
}
default
{
    touch_start(integer total_number)
    {
        //hide();
        StartPos = llGetPos();
        StartPos.x = (integer)StartPos.x;
        StartPos.y = (integer)StartPos.y;
        StartPos.z = (integer)StartPos.z;
        TargetPos = StartPos;
        Corner1 = StartPos;
        Corner1.y = Corner1.y + 10;
        Corner2 = Corner1;
        Corner2.x = Corner2.x + 10;
        Corner3 = Corner2;
        Corner3.y = Corner3.y - 10;
        llSetPos(StartPos);
        do {
            TargetPos.y = TargetPos.y + .5;
            llSleep(.01);
            llSetPos(TargetPos);  
            } while (TargetPos != Corner1);
        do {
            TargetPos.x = TargetPos.x + .5;
            llSleep(.01);
            llSetPos(TargetPos);  
            } while (TargetPos != Corner2);
        do {
             TargetPos.y = TargetPos.y - .5;
            llSleep(.01);
            llSetPos(TargetPos);  
            } while (TargetPos != Corner3);
        do {
            TargetPos.x = TargetPos.x - .5;
            llSleep(.01);
            llSetPos(TargetPos);  
            } while (TargetPos != StartPos);
            //To Turn the object
            //rotation rot = llGetRot();
            //rotation delta = llEuler2Rot(<0,0,(PI/2)>);
            //rot = delta * rot;
            //llSetRot(rot);
            //llSleep(0.25); 
            //show();
    }
}  
Laissez faire et laissez passer, le monde va de lui même!
My little sounds store https://www.kitely.com/market?store=2040306

Ephemeral wanderer...
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: Microbe City

Post by Graham Mills »

There's probably a marketplace product opportunity going begging although having code in the public domain is important for what I'm trying to do here.
Minethere Always wrote:I used to use this but have not confirmed it still works, or, if so, if it works in Kitely. It is kinda useful tho and maybe someone can even fix it up more...so, ymmv:
These users thanked the author Graham Mills for the post:
Constance Peregrine
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1142 times

Re: Microbe City

Post by Graham Mills »

This is the current version of the PubMed rezzer. You do a search of the PubMed biomedical bibliographic database and results are returned as prims with titles and sources on them. You can touch to link out to the original PubMed record on the web or highlight the ones you want to keep and store their IDs on an autogenerated notecard. The notecard can be dragged back onto the dashboard to regenerate the prims. You can take copies of the prims and incorporate them in builds as an inworld bibliography.

What is needed, of course, is a Minority Reports-style interface that can be used immersively with the Rift and Leap Motion (or whatever) and, when your arms get tired, with the good old mouse and desktop. Add limited voice input/control, shared media and a couple of other databases and I think it might be quite interesting if only because it is inherently multi-user.

Picture: https://photos.app.net/21048942/1
User avatar
Kayaker Magic
Posts: 354
Joined: Sun Dec 01, 2013 8:40 am
Has thanked: 52 times
Been thanked: 393 times

Re: Microbe City

Post by Kayaker Magic »

Minethere Always wrote:I used to use this but have not confirmed it still works, or, if so, if it works in Kitely. It is kinda useful tho and maybe someone can even fix it up more...so, ymmv:
OH NO! Please everyone do not use this script that Minethere has in her post!!!

There are several bad things about this script:
1) It is violating the basic idea of event-driven programming. Performing long involved loops inside a single event is very bad. This is locking up SIM resources doing loops that will prevent other scripts from running. The idea of event-driven-programming is to respond to an event with a small amount of code, then exit from the event. This gives other scripts a chance to perform their operations and release resources for your script to get it's next event.
2) That script is calling llSleep() to create delays. This is especially bad in Open Simulator because llSleep() locks up a 'thread' (A valuable and limited SIM resource) for the whole time it is 'sleeping'. This is a bad design feature of OpenSim that is unlikely to be fixed any time soon, so we just have to use llSleep ONLY WHEN ABSOLUTELY NECESSARY. You can measure how bad this is by looking at the "Top Scripts" in your Region Management Debugging pane. A script that does nothing else but llSleep() a little will get the WORST (top) score of any script on your SIM.
3) That script is also using llSetPos(), a function that internally does the same thing as llSleep(0.2) and is bad for the same reasons. See my post http://www.kitely.com/forums/viewtopic.php?f=26&t=1149

So what are you supposed to do when you have some long involved list of things you need to do? The official answer is to llSetTimerEvent() and do your task one step at a time in the timer() event. Then return from the timer event and allow other scripts their turns. Unfortunately there is a limitation to llSetTimerEvent(), you cannot set a time less than half a second. (You can set shorter times, but they are "rounded up" to 0.5 seconds). If you need things to happen more often than that, there is a trick where you call llSetTarget() to an impossible place, then do your task in the not_at_target() event, which is called 11 times a second (about once every 0.09 seconds). I did that in my original flier script.

Of course if the task that you want to do is to move a prim smoothly, we now have llSetKeyframedMotion to do that for us with a single system call, no loops in events, no llSleep() calls, and no calls to routines with built-in sleep delays. I posted a script that demonstrates one way to use llSetKeyframedMotion here: http://www.kitely.com/forums/viewtopic.php?f=26&t=1155
These users thanked the author Kayaker Magic for the post (total 3):
Constance PeregrineGraham MillsIlan Tochner
Post Reply