Current edition: Vol.4, No.8, August 2001
 

Active Worlds News


AW Website
Bot of the Month
Truespace3 Tip
Worlds to Watch
Hot Spots to Visit
AWEC Calendar
AWCOMREG Articles
Cy Awards
The AWeakest Link
Community Groups
WVRN World Radio
XBOX Info Station
AWHS Tour
Oregon Reunion

Resources

Building Links
Community Links
AWCOM Links

 

 

icon

 

icon

 

icon

 

 

HamFon's Bot of the Month

HamFon & the HamBots Active Worlds citizen Brant has been VERY busy writing bots. He's also the caretaker of AWTeen. Another of Brant's bots was featured earlier this year, also. This month's Bot of the Month is Brant's Weather Simulator bot - "Thor". It's a very impressive environment simulator, producing realistic weather and lighting changes. If you would like to contact Brant, you can email him. Please do NOT contact Brant in Active Worlds by telegram - he will not be able to respond to telegrams - only to emails. Also, please stop by AWTeen to say "hi"!


A lot of people have been talking about Thor, the weather simulator that's now active in AWTeen.  What is Thor?  Who worked on Thor?  How was Thor created?

Thor is the new weather simulator unveiled on July 27 that attempts to create realistic weather throughout AWTeen.  While many people have seen Thor in action, few realize the massive amount of work that went into the Thor project.

History

My experiments with simulating day and night date back to late 1999, when I used a HamBot to program a simple script that operated the now-extinct world SVillage.  The bot had four modes - day, dawn, dusk, and night.  It used standard AlphaWorld backdrops and operated on a one-hour cycle - thus, at 11 minutes after each hour, the sunset mode appeared, and at 19 minutes after the hour, it was night.  The sun then rose again at the top of the next hour.  When a user entered the world, he or she was greeted by the bot, which told him or her what time of "day" it was.  Eventually, I programmed more and more complicated commands, such as the ability to change the cycle to whatever mode was wanted with a simple command.

Shortly before SVillage expired, I discovered AWTeen in early 2000, and became more involved with affairs in the world.  In early July, I went on a vacation, and came back to find that I had been appointed Caretaker of AWTeen (to begin in September), and had won a p-50 world through the Activeworlds Committment to Education program, all in the same day.   I decided to turn this world (Gulakon) into an RPG world, which naturally required a realistic day/night system.  Since ActiveWorlds 3.0 had now arrived, it was possible to make all kinds of interesting weather, and since XelaG had released a Xelagot script that did just that, I investigated the possibility further.  Eventually, I modified the script so that its user could change the time of day on command, and released it at http://www.shoemakervillage.org/programs.html.  The script is still available to the public to this day.

I then did some searching and found some backdrops at awcommunity.org, which I used in conjunction with the bot in Gulakon.  I arranged an agreement with Cahalane, then-Caretaker of AWTeen, to operate the day/night cycle bot in the world.  However, because the bot operated on a 24-hour VRT cycle, and had just four backdrops, citizens and tourists alike shortly became annoyed because of the abrupt changes and the time zone problem, which meant that if a person lived in Australia, he or she would only see the nighttime part of the cycle.  Time zone differences quickly became a major problem because it was impossible to lighten the scene at night with any building command.  Because there was no way for builders to work at night without a light command, the cycle was scrapped shortly after.

When 3.1 arrived with its new light command in March, 2001, I began work on a better bot that operated on what I coined a "smooth change" system.  The bot changed the ambient light of the world gradually, instead of abruptly like the previous two attempts had.  Instead of a sudden eye-splitting change between day and night, visitors now hardly noticed the change in light as they were in the world near sunrise or sunset.  They were also treated to special effects such as fog, and were able to build in the dark with the light command.  While this version still only used four backdrops, the smooth change made the environment more realistic.  However, this bot met its end after AWTeen's object path was deleted.  When the path was restored, the entire project was forgotten.

Soon enough, people began to ask about what had happened to the day/night cycle.  It was in June that AWTeen's suggestion box was opened (at 1300s 0e), and even to this day the most popular topic for suggestions is the weather system in AWTeen.  Everyone had their own opinions about what makes a day/night cycle realistic. Some simply wanted the bot that had been active in March to be reactivated.  Others wanted a full-fledged weather simulator.  One point was clear - almost nobody wanted a static backdrop like AlphaWorld had.  Thus, Thor came into existence.

Development

It was almost by coincidence that I discovered Beardo's site while browsing through awcommunity.org for backdrops one day in early June.  Soon enough, I contacted Beardo about making backdrops for the weather simulator, and he gladly accepted.  The next four weeks were spent deciding on a backdrop scheme, and designing and perfecting the images for all three series (sunny, partly cloudy, and cloudy).

There was quite a bit of controversy between Core members and those members of the public who stopped into Gulakon at that time over the design of the backdrops.  At first, three designs were rejected because the mountains were too high off the screen to be seen.  Beardo's imaging program, Corel Draw, didn't allow him to specify the size of the image, so he suggested cropping the images after they were rendered to solve the problem.  Because none of the people involved in the simulator's creation possessed expensive image editing software (such as Paint Shop Pro), it took over a week for Beardo to zip and upload all the backdrops (in bitmap format), and for David15 to crop them using MSPaint and to convert them back to jpeg images.  The process was completed by early July, and the images were later sent to Lucrezia Borgia for upload.

After the backdrop images had been designed, another problem was encountered.  In most worlds, the background color of the world is the same as the upper limit of the backdrop.  The previous World Controller bot hadn't changed the backdrop according to the time, and was criticized for this inadequacy.  Using a technique found on Mauz's pages (http://tnlc.com/mauz/worldrunning.html), David15 sampled each image in MSPaint and took several hours to write fifteen pages of Visual Basic source code that changed the backdrop color to match the top of the backdrop for each of the 77 images.

Preparing the rainfall object was another matter.  Poseidon originally found the object (created by Rehabber) and sent it to me for testing, but the textures with which it shipped did not appear correctly.  RavenShadow corrected some errors in the object, but it still didn't display the correct texture.  Finally, Lady Murasaki came through with one of her waterfall textures and masks, which created the smooth rainfall effect that you see on a rainy day or during a thunderstorm.  (Unfortunately, pictures cannot recreate the rain effect, which is why none of the images in this article show rain.)

We also decided to make thor operate on a 26-hour cycle. Why 26 instead of 24 hours? A 26-hour cycle, most importantly, allows the state of the world to change at the same time on different days. Therefore, if a citizen can only be logged in between 10pm and 11pm VRT, then a traditional 24-hour day would leave him or her only able to build at night. A 26-hour cycle, however, enables this same person to be allowed to build during the night and day because the sunrise and sunset times change drastically each day.

For example, let's say that on day one, the sun rises at 4AM. The next day, the sun will rise at 6AM, two hours later than it did the previous day. In this way, every 13 days, the sun will rise at the same time, and the cycle will repeat.

Also, it was decided to create the cycle with 18 hours of daylight and eight hours at night becuase many users wished to see their creations at night, but didn't want to be inconvienenced by building during the dark. Furthermore, we lightened all of AWTeen's objects so that, while they appear bright enough to build at night, they also absorb light more than the objects did before they were modified. In addition, it doesn't look like the middle of the night at high noon anymore, as some visitors complained about the darkness of the objects. The overall effect allows for an unprecidented level of realism without spoiling the building environment.

Behind the Scenes

Each time the simulator makes a change to the world attributes, it calls eight routines that perform specific functions, including calculating the current time it should use for determining the weather, setting the probabilities for each type of weather, changing the world's title to include the current AWTeen time, changing the ambient light color of the world, changing the directional light color, changing the background color, changing the backdrop, changing the angle of the directional light, and determining if any fog is needed.

First, the simulator calculates the time that it should use for determining the weather.  In technical terms, this function is performed by taking a modulo of the number of seconds since January 1, 1970. Put more simply, the simulator assumes that a 26-hour day were repeated over and over since then, and calculates what time of day it would be now.  Even if the simulator crashes, it never loses track of the time of day.

Next, the simulator determines what type of weather should be occurring.  To make the effects of the weather more similar to those in real life, the simulator calculates two sets of probabilities - weather modes, and weather systems.  The weather mode directly determines the current weather in the world out of five possible choices - sunny, partly cloudy, cloudy, rainy, and a full-fledged thunderstorm.  The weather system determines how likely the weather mode is to change.  If a rainy system is in effect, the weather mode is likely to stay either cloudy or rainy, but, as in real life, there is a small chance that the sun could come out suddenly, or that a severe storm could strike without warning.  Each time the function is called (every minute), the simulator chooses a random number, and if the number is within a specific range, it changes the weather mode.  The routine then chooses another number and determines whether the weather system should change based on a similar range.  The range of numbers is determined by such variables as the time of day, whether it has rained often the past few days or not, and so forth.  Therefore, the range of numbers that would result in a thunderstorm is larger when it is afternoon, and it would be more likely to rain after three days of sunshine instead of switching between rain and sun every five minutes.

Next, the simulator changes the title of the world to display the current time.  It uses a simple function that I developed in the freely available "AW SDK Functions.bas" file (http://www.shoemakervillage.org/programs.html).

After changing the world's title, the simulator calculates the ambient light based on the cloudiness of the atmosphere, the time of day, and other factors.  During the sunrise and sunset periods, the simulator adds a slight tinge of color that fades from yellow to red to grey-blue.  Overall, this method provides for a smooth change that, when applied every minute, decreases one component color of the ambient light and is hardly noticeable to the visitor.

The directional light, on the other hand, is directly proportional to the amount of cloudiness that is present.  On a sunny day, the directional light is set to pure white; on a cloudy day, it is set to black.  At night, the moon shines a dark grey light that produces a "soft" luminance on one side of objects.  Of course, during sunrise and sunset, the directional light's brightness decreases or increases gradually as suited to the current weather mode.  Unlike the ambient light, however, the directional light is always a shade of grey, which, when darker, serves to dampen the "spectacular sunset" colors used when the day is sunny.

The backdrop change routine changes the world's backdrop once about every 67 minutes according to the time of day and whether the weather is sunny, partly cloudy, or cloudy/raining/thunderstorming.  The world's background color is also changed to match the top of the specified backdrop.

The angle of the light source is calculated using a complicated trigonometric formula involving sines and cosines of a number representing the time of day.  The result of the formula is that, every minute, the angle of the sun changes as if the observer were standing at 40 degrees north latitude.

Finally, the fog setting routine simply chooses a random number, and has a one in eight chance of resulting in a foggy morning.  The "dice routine" is run in the evening, and the fog develops overnight according to the number that is chosen.

The Big Event

I scheduled the unveiling of Thor for a Friday night after TechTalk.  I had wanted to hold the event that Friday, but I feared that people would abandon the unveiling of the simulator to talk with Roland.  Therefore, I decided to schedule it after TechTalk concluded almost as a second thought.

I attended TechTalk like any other person.  While TechTalk was being held, I made plans with Mountain Myst for her to speak at the ceremony.  When it neared 9:00, I received this interesting telegram and got the point to hurry over to the ceremony:

Telegram from Mountain Myst, sent Fri Jul 27, 2001 7:08 PM: 
oh good........ they're now saying "stupid bot" to the Roland bot....... and it keeps saying "same to you" back....... oh good........ someone turned it off LOL Was flooding the screen

When TechTalk was over, I announced the big event. Of course, I had no idea that half the people who were at TechTalk as well as Roland himself would attend the unveiling.

In the half-hour time span of the ceremony, more than 94 people stopped by to see the new and simulator.  AWTeen reached a record high of 87 people.  Mountain Myst started off with a few comments, and I then went through a few of the various modes.  At one point, I accidentily entered a negative sign for the fog visibility, and the world turned bright yellow.  As renowned programmer Magine commented, the scene looked like "LA noon".  Showing all the modes of the bot would have been impossible because I calculated that there are 182,880 possible states from which Thor can choose every minute.

In the end, there was the countdown to the start of the simulator, a few parting words, and then the combined effort of more than fifteen people that easily encompassed more than one hundred hours of work was finally realized.  Just as it did in the picture above, the sun set on only one of many projects, leaving many possibilities open for the future of AWTeen.

 

 
  Active Worlds   |   Newsletter Home   |   Newsletter Archive   |   Contact Us    |   Disclaimer