Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

"Flying Tako" Sailboat Script

Kanker Greenacre
Registered User
Join date: 17 May 2003
Posts: 178
06-27-2005 17:47
I put the "Flying Tako" sailboat script on my LSL Wiki page: http://secondlife.com/badgeo/wakka.php?wakka=KankerGreenacre

It doesn't have many comments.

I'm hoping people will at least glance over it. Feel free to use it in-world, as long as you don't sell it. If you have any questions, post them below and I will try to answer them. If you have suggestions or criticisms, post those here too.

In case you haven't tried the "Flying Tako", you can read about it here
/110/13/51075/1.html

and here
/invalid_link.html
_____________________
Living La Vida Segunda
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
06-28-2005 07:31
I sneeked a few changes into the script that should have it running a bit faster. I would recommend rewriting the listen so it parses the text from the listen to a list and using the space as the deliminator. Then just using string functions. The advantage is the ability to dynamicly handle spaces in the strings without effort.

Something like...

CODE

listen(integer a, string b, key c, string d)
{
list e = llParseString2List(d,[" "],[]);
b = llList2String(e, 0); //rarely do we ever care about the name, so we recycling.
if(b == "monkeys")
monkeys(llList2String(e,1));
else if(b == "more")
more(llList2String(e,1), llList2String(e,2));
else if(b == "sub")
{
b = llList2String(e,1); //we already got the match so we again recycle.
if(b == "monkeys")
monkeys(llList2String(e,2));
else if(b == "more")
more(llList2String(e,3), llList2String(e,4));
}
}


I like to recycle variables i'm not using, lists, strings and keys just waste memory if your not going to use the data.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Jamie Marlin
Ought to be working....
Join date: 13 May 2005
Posts: 43
Script Extensions
06-28-2005 13:09
Hi Kanker!

Just found your script, and I am green with jealosy. I've been thinking about building this boat since the day I discovered SL. I haven't had time to study the code you have yet - and I will, just not on my employer's time. I do see one thing that may have been left out, however - apparent wind.

Apparent wind is the vector sum of the boat's velocity and the wind's velocity. ie If you are going 5 kts into a 3 kt breeze the apparent wind is 8 kts and if you go 5 kts downwind with a 3 kt breeze the apparent wind is 2 kts. This effect is very important in sail boat physics, because it is part of the effect that allows a boat to sail closer than +/- 45 degrees to the wind. (The airfoil shape of the sail is the other part of this...). When you are close-hauled (sailing as close to up-wind as possible) the boats velocity causes the wind to appear to shift a little more behind you, allowing you to sail a few degrees closer to upwind. Practically, this has the effect of shifting the boat's ideal angle with respect to the wind as the boat's velocity increases.

Don't know if you wish to model this or not, but it is one of the things that wins and looses races in RL.

Another feature I would really love to see if you have any prims left - a spinnaker. You could probably simulate one with a single spherical section attached to the bow and texture animation. It adds a whole new dimension to racing downwind, since the boat handles differently and the sails must be trimmed differently under spinnaker.

Anyway - great work! I can't wait to sail one. If you are interested, I would love to discuss the details of this with you... and I definitely plan to attend your races, no matter what.

-Jamie
PetGirl Bergman
Fellow Creature:-)
Join date: 16 Feb 2005
Posts: 2,414
06-28-2005 13:15
I miss the Jules Verne ship... the air one... flying around in SL..
Kanker Greenacre
Registered User
Join date: 17 May 2003
Posts: 178
06-28-2005 14:13
From: Jamie Marlin
Hi Kanker!

Just found your script, and I am green with jealosy. I've been thinking about building this boat since the day I discovered SL. I haven't had time to study the code you have yet - and I will, just not on my employer's time. I do see one thing that may have been left out, however - apparent wind.

Apparent wind is the vector sum of the boat's velocity and the wind's velocity. ie If you are going 5 kts into a 3 kt breeze the apparent wind is 8 kts and if you go 5 kts downwind with a 3 kt breeze the apparent wind is 2 kts. This effect is very important in sail boat physics, because it is part of the effect that allows a boat to sail closer than +/- 45 degrees to the wind. (The airfoil shape of the sail is the other part of this...). When you are close-hauled (sailing as close to up-wind as possible) the boats velocity causes the wind to appear to shift a little more behind you, allowing you to sail a few degrees closer to upwind. Practically, this has the effect of shifting the boat's ideal angle with respect to the wind as the boat's velocity increases.

Don't know if you wish to model this or not, but it is one of the things that wins and looses races in RL.

Another feature I would really love to see if you have any prims left - a spinnaker. You could probably simulate one with a single spherical section attached to the bow and texture animation. It adds a whole new dimension to racing downwind, since the boat handles differently and the sails must be trimmed differently under spinnaker.

Anyway - great work! I can't wait to sail one. If you are interested, I would love to discuss the details of this with you... and I definitely plan to attend your races, no matter what.

-Jamie



You're right, Jamie. Apparent wind is not calculated in my script. Its effects may be modeled indirectly in the formulas I concocted for the sail "trim factor" and boat speed, but those formulas were not derived from aerodynamic theory. Right now, the "irons" angle for the boat is simply set to 35 deg, but for angles greater than that, sail thrust depends on how close the sail angle is to some optimal angle, which, again, was not derived from aerodynamic theory... merely from personal experience and the typical sail trim diagram. Suffice it to say, there is plenty of room for improvement in the dynamics modeling.

I've thought about adding a spinnaker, along with a jib. I've seen static SL boats with huge realistic-looking spinnakers, so I know it can be done. I couldn't guess how to model the speed increase from a spinnaker, not having any practical experience with them. Any ideas?

Here are a few realistic details I'd like to add eventually:
- Jib & spinnaker
- Rudder drag
- Capsizing
- Planing
- For displacement hulls, max theoretical speed
- Weather helm
- Sailing backwards
_____________________
Living La Vida Segunda
Kanker Greenacre
Registered User
Join date: 17 May 2003
Posts: 178
06-28-2005 14:23
Strife - thanks for the script upgrades. I'm incorporating them into my retail version.
_____________________
Living La Vida Segunda
Jamie Marlin
Ought to be working....
Join date: 13 May 2005
Posts: 43
Apparent Wind...
06-29-2005 14:05
Looking at your code...

Apparent wind should be easy to implement. In CalcWindAngle replace:
wind=llWind(ZERO_VECTOR);

with:

wind=llWind(ZERO_VECTOR) - llGetVel();

I believe both of theses functions work in the global coordinate system.


Assuming that the wind speeds are on the same order of magnitude as the boat velocities, I suspect that this might have a radical effect on the handling characteristics of the boat. Not certain it it would be an improvement, but it might be worth a try. Would limit downwind velocity to no more than wind velocity, for example.

-Jamie
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
06-29-2005 17:31
I'm hoping everyone understands how the weather system SL uses works; and that they understand it to be unreliable for this sort of thing.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Jamie Marlin
Ought to be working....
Join date: 13 May 2005
Posts: 43
06-29-2005 17:38
When I was imagining this... before Kanker did all this great work... I was envisioning a "weather broadcaster" that sent randomly changing wind messages to all the boats. I assumed that the winds generated by sl were either to variable or not variable enough.

Do you know how SL generates its weather? I tried to follow a lonk in the wiki (from llWind() ) and it appeared to be broken.

-Jamie
Easy Wheeling
Registered User
Join date: 18 Jun 2004
Posts: 28
06-29-2005 17:54
I'm not up to speed on how SL generates it's weather, but I was able to get all the clouds in Olopue to flow in a fairly brisk circular motion, just by flying in circles over my airport there to get it going and speed it along... Spiraling circles up and down seems most effective.

Seems we can make our own wind.... :rolleyes:

(uh, what I mean is not what that sounds like, lol...)

-Easy Wheeling
_____________________
- Life is precious. Live it well.
Eazel Allen
EA-design™
Join date: 11 Feb 2007
Posts: 123
link dead
09-05-2008 04:02
Hi does anyone have this script or a link to it the lsl pages dont seem to exist anymore.
_____________________
http://secondlife://cub/235/190/465/

http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=48444
Talon Brown
Slacker Punk
Join date: 17 May 2006
Posts: 352
09-05-2008 04:47
http://lslwiki.net/lslwiki/wakka.php?wakka=LibrarySailboat