Understanding WWC wind (by Mothgirl Dibou)

Technical discussion of sailboat, wind, and racing systems for Second Life.

Understanding WWC wind (by Mothgirl Dibou)

Postby Caf Binder » Sun Nov 29, 2009 5:49 am

Understanding WWC wind
---------------------------
(by Mothgirl Dibou)


WWC is a very poor name and stands for Wind Waves and Current. I will try to explain only the Wind portion of it.


First, there is no wind in SL. There are only common parameters and program logic. If you want all boats to use the same wind, they need to have the same parameters and the same program logic. An alternative would have been to have a central wind system that informs all boats constantly, but the possibilities for such a system were inadequate at the time this was designed.


Before WWC there was a wind algorythm designed by Kanker Greenacre. It works by sending boats a simple set of wind parameters and deals with gusts and shifts that are time related. The basis of this system is also used in WWC, but enhanced and extended in various ways.


The WWC wind contains of 5 parts:
1. setting the wind parameters in the WWC Setter
2. communicating the parameters to the boats
3. interpreting local variances
4. generating gusts and shifts depending on time and location
5. implementing windshadow


I will try to explain each of these 5 parts.


1. Setting the windparameters in the WWC setter
The WWC setter itself is nothing more than a user friendly interface to set up the wind varibales for a certain location. I designed it to take care of an entire sea and be able to configure wind shifts around islands. shores and buildings.


WWC wind is not dedicated to be used with the WWC Setter exclusively. IN fact, anyone can build a setter that deals with the user interface of this rather complex matter. As long as it is able to communicate with the boats in the way that is described in the SLSA protocols.


The WWC setter has a chat interface with command like "cruise wind speed 15" which means: set the wind speed to 15 knots for cruising.


This command suggests that there is something besides cruise wind and there is.


Cruise wind is intended to set the standard comfortable wind speed/direction for a region or sea. It is to be used by every boat that sails there. It has all the features one would need, like lulls behind islands, wind changes, gusts.


But for the occassions when there is a race, the contestants will sometimes want to use a different wind. Maybe a stronger one, or one with more shifts to make the sailing more interesting. It wouldnt be fair to bother all the other boats in the neighbourhood with this and disturb someone's afternoon sail.


This is why there is a second set of wind parameters to be set called race wind. Race will always only last for the duration of a race and will always only be used by the contestants of a race. All the cruise commands are also available for races and to make sure that only racing boats will receive the race wind parameters a subscription method has been added (more about this later).


The WWC instructions can be entered manually, by using a menu or by predefining them in a notecard. Setting up local variances is only possible through the use of notecards. I made a WWC recorder to make the process of writing this notecard a little easier.






2. Communicating the parameters to the boats
This part is extensively described in the SLSA protocols. Everyone can set up there own WWC Setter, but it has to comply to these protocols for all the boats to respond to it.


Since there are 2 types of wind (cruise wind and race wind) I will try to describe both of them in short. For more details you'd better look into the protocols.


Cruise wind:
The WWC Setter broadcasts its own presence on a channel that can only be used by scripts, not by typing /channel say something. The boats in the neighbourhood pick up this broadcast (if they haven't locked the wind from another setter yet) and they reply to the setter by sending a wwc request by email.
The WWC setter picks up the email and sends another email back that contains all the parameters for wind waves and current, including the local variances. WWC Cruise wind can only be overruled by a new wind if the wind isnt locked by the sailor or it can always be overruled by subscribing to a race.


Race wind:
The WWC Setter broadcasts a race announcement just like cruise wind, only using another channel.
The boat requests for more info by email and receives an email back containing all the WWC parameters like with cruise wind, but also receives the race specific information. The extra bit of info contains the name of the race, the name of the boat class, the version number of the boat, the number of sailors that are required, the sailing mode and 2 other parameters that can be used freely by boatbuilders.
If the boat conforms to all this, the sailor is prompted with the question if he wants to subscribe to the race. The subscription is send back to the WWC setter and contains the names of the sailors. The WWC Setter stores this information so it can use it for creating better readable race results afterwards and inform the race line of the contestants (not implemented).


So in short: Only the boats that have subscribed to the race are using the race wind and only the subscribed boats will trigger the line. This is being implemented or is implemented by Yuu's line. The Flying Fizz uses the id box to show whether boats are using race wind or not.


Security:
I added an extra parameter to the subscription messages that contains a computed key. The value of this key depends on the scripts inside the boat, the notecards inside the boat and the prims. Since there is no way someone can recreate this key without using the exact same configuration as the other boats, the WWC Setter can be sure that all the boats that participate in the race are genuine and have not been tampered with. This functionality is implemented in the Flying Fizz only.






3. Interpreting local variances
Local variances are used to create lulls behind islands or trees and create local windshifts. The purpose of local variances is to make the WWC wind adapt itself to the environment. The process of setting this up is not easy and requires some knowledge of RL wind behaviour. (the same goes for waves and current, but i will not be discussing those now)


WWC local variances consist of a location, an inner circle in which the effect is 100% and an outer circle around the location where the effect is back to 0%. In between those 2 circles the strength of the effect is computed in a lineair way. (see SLSA protocols)


The local variance itself is set up by entering an offset in wind direction relative to the mean wind direction and a percentage of less or extra windstrength. For a large sea, setting up about 20-30 local variances should be enough.


The local variances make cruising more fun because there is more variation. you can look for the rough spots or seek shelter behind an island. It also makes racing more challenging because one has to think and use its knowledge to choose the port or starboard side of the course. 1 side may have more wind and the other may have more current.


The local effect is computed continuously inside the WWC interpreter script in the function getLocalFluctuation(float posX, float posY) where posX and posY are the global coordinates of the boat.






4. Generating gusts and shifts depending on time and location
The Tako wind algorythm uses 3 sine curves that are time related and adds them up. This creates a pseudo random wind shift/gust effect. The effect is the same wherever the boat is.


The WWC wind algorythm uses the same method with 4 time related sine curves for wind direction and 4 other sine curves for wind speed. But it also adds a location companent to this. The end result is that there may be a stronger wind in 1 location temporarily and 50 meters to the east of it there isnt. This feature is especially designed for racing. It will favour a tack to port over continuing in a straight line when you are in a lull. It will also favour 1 side of the race course over the other.


There have been big boards set up in sailing clubs when the WWC wind was introduced. they had 8x8 square on them that showed the wind direction and windspeed. It was designed to give people some insight on how this new wind worked.


Unfortunately this effect is invisible. I have been playing with the idea to use 4, 9 or 16 phantom prims per sim that are positioned just over the water surface. The prims have 5 faces and each face shows a smooth or wrinkled water surface texture that moves in the direction of the wind. This way the gusts would become visible.


The wind is computed in the WWC Interpreter in the function calcWind(float posX, float posY) This function also computes the apparent wind and implements the computed local variance and windshadow (more about this later).


The wind algorythm is not described in the SLSA protocols. I think it should because different algorythms would compute different winds and the whole idea was to standardize the wind.






5. Implementing windshadow
When I speak of windshadow I actually mean 2 effects. One is the occlusion of the wind which results in a less strong wind for the occluded boat and the other is the bending of the wind by the rounded sails of the shadowing boat.The occlusion effect is bigger directly behind the sail when you would draw a straight line in the direction of the wind. The beding effect is stronger directly behind the sail when you draw a straight line in the direction of the boom.


Each boat sends out a notification of its position, its sail area, the tack it is on, the boat length and its speed/heading. The other boats pick this up, compute a shadow and a wind bend effect and store these values in an array. The values in the array are reduced every clock cycle until they are zero and removed from the array. But if in the mean time a new message is picked up from the same boat, the shadow/bend values are computed again and it all starts from scratch. The array can holds shadow/bend values from multiple boats. This means that the more boats that are shadowing you, the less wind you get.


The shadow/bend itself is retrieved from the array and implemented in the actual wind by the calcWind(float posX, float posY) function inside the WWC interpreter.


- - - - - - - - - - -


I think this sums it all up. Everythin one needs to implement WWC wind is inside the WWC interpreter script. Everything one needs to receive the WWC wind is inside the WWC Receiver script. The endresult of it all is a set of variables that include wind speed, wind direction, apparent wind speed, apparent wind direction, etc. These variables are ready to use in any boat. You can find them at the bottom of the WWC Interpreter script. I have made a sample implementation of it in the Tako cube and made an implementation in the DIY kit.


If someone wants to learn about how to implement WWC wind, the best they can do is use either the Tako cube or the DIY kit.
User avatar
Caf Binder
 
Posts: 148
Joined: Tue Jan 08, 2008 4:31 pm

Return to Sailing Developers

Who is online

Users browsing this forum: No registered users and 1 guest

cron