[MUD-Dev] weather

Matthew Mihaly diablo at best.com
Sat Oct 9 01:56:00 CEST 1999


Hi everyone. I'm wondering if any of you have good weather systems in your
game, and if so, how it works. Achaea's weather "system" at the moment is
a pile of crap, and I've designed a new one. I'm hoping that you all can
suggest some improvements. I'm reasonably happy with my design, but there
is definitely room for improvement.

I've included my design notes below, though the design isn't complete. I'm
mainly interested in a) criticism of my formulas to determine
temperature, wind, and humidity, and b) my system of generating storms. 

If anyone has any good criticism, I'd appreciate hearing it. (Note that I
just copied and pasted from my notes to my coders, so ignore any specific
details.)

Weather design:


Each area in the game will have the following data associated with
weather:

Base Temperature (base_temp) (in degrees F)
Base Humidity (base_humid) (1-100)
Base Wind (base_wind) (1-infinite, though 100 is considered
hurricane-force winds)

   The above three statistics indicate a sort of average for those
factors, for that area. They are the points towards which the "current"
equivalents (see directly below) statistics will gravitate towards, by
virtue of some formulas I've come up with.

Current Maximum Temperature (current_max_temp) (in degrees F) (This is the
maximum
  temperature at approximately 3 pm. It's assumed that as you move away
from 3
  pm in either direction in time, the day gets cooler, generally speaking)
Current Actual Temperature (current_temp) (in degrees F) (This is the
current_max_temp modified for time of day and humidity. The higher the
humidity, the more heat the air retains)
Current Humidity (current_humid) (1-100)
Current Wind (current_wind) (1-infinite)


Beta (beta) (indicates how sensitive the area is to overall weather
change. Practically speaking, the higher the beta, the bigger swings in
weather. Chicago would have a large beta, for instance, whereas Death
Valley or the Arctic would have a low beta. A beta of 100 (100%) indicates
that the area will tend to change exactly with the weather front. A beta
of 1% indicates that an area will be hardly affected at all by continental
fronts or time of year. A beta of 200% would be somewhere like chicago,
where the weather swings wildly from season to season, and with various
atmospheric conditions)


The "base" factors will bet set by me, and we will need the following
commands to deal with setting and looking at area weather data:

WEATHER <area short name> <statistic> <value>. Make this performable by
coders only.

If the final two fields are omitted, then the WEATHER verb should just
display all the stats for an area. Incidentally, the replica that hold the
information for an area are held in data 23 in a room.

WEATHER FRONTS

Approximately every 2 hours (don't make it exactly two hours, make it like
an hour and 51 minutes, for instance, to spread loads), a new weather
front system will begin affecting each continent. There's only one
continent right now, but it'd probably be good if this was coded in order
to work with multiple continents. How a weather front is determined will
be detailed further below in this document. However, each weather front
will have the following stats:

Temperature modifier
Humidity modifier
Wind modifier

These modifiers will be applied to the current weather in a location with
the formulas I'll include below.


APPLYING WEATHER FRONTS TO CURRENT WEATHER IN A LOCATION

This is the core of the weather system. Every minute, check all the areas
in the game. For each area, do a random(45). If the result is 1, then the
below formulas will be applied to change the current temperature,
humidity, and wind in a location. 

First, I will explain how temperature is determined. Temperature is a
combination of the following factors:

Beta, that continent's weather front, base temperature, current
temperature, current humidity, time of year, and time of day.

The idea behind the formula is to allow temperature to vary within an
area, but to tend towards the base_temperature for the area, modified by
time of year and time of day.

The weather_diverge variable is set to 20 by me. It determines how far
away from the basepoint temperatures can freely swing before force is
exerted on the calculation. 

The front_temp_mod variable is how many degrees + or - F that the front
has (yes, I know this isn't realistic in the sense that it makes all areas
on the continent vary somewhat in the same direction, but the formulas are
complicated enough so that it shouldn't really be too noticeable)

The month_mod variable is the modifier in degrees C for the month. The
months and their corresponding constants are:
1: -30
2: -20
3: -10
4: 0
5: 10
6: 20
7: 30
8: 20
9: 10
10: 0
11: -10
12: -20


The distance_from_3pm will be a number 1-30. Our days are 1 hour long, and
the day is advanced every minute. 3 pm is 37.5, so just use 38 as the high
point of the day, temperature-wise. thus, if the day counter was 28,
distance_from_3pm would be 10. If the day counter was 1, then
distance_from_3pm would be 22. It can never be negative.

The formula is:

var=((beta*front_temp_mod/100)+current_temp - base_temp)
If var is negative, change it to positive.

modifier=weather_diverge/var

current_max_temp=((modifier*(beta*front_temp_mod)+current_max_temp)+(beta*month_mod)*random(.85-1.15)

current_temp=current_max_temp-((distance_from_3pm*2)*(100-current_humidity)). 

The current_actual_temp can have some other modifiers, and needs to be
calculated on the fly.

>From day counter 48 to 11, inclusive, the current_temp will be
random(5-10) degrees lower. This is to represent that the direct radiation
from the sun contributes to warming during the day.

If the current weather conditions are light clouds, drop temperature
random(2-4) degrees. If current weather conditions are heavy clouds
(necessary for any sort of precipitation), then drop temperature
random(4-6 degrees) (more about these issues below).

That, then is how temperature is determined. I will design the effects of
weather on players later, and will probably use heat indexes so that
players are more affected by wet heat than dry heat.

DETERMINING HUMIDITY

The principle behind humidity is much the same as behind temperature, but
it's a simpler formula. You modify current humidity in two conditions:

1) if it is to be affected by a weather front (remember, every minute,
1/45 chance of this)
2) periodically during precipitation


Formula for when it needs to be affected by a weather front:

var=((beta*front_mod)+current_humid-base_numid)
if var is negative, make positive

modifier=weather_diverge/var

current_humid=(mod*(beta*front_humid_mod)+current_humid)

The second way of changing humidity will be dealt with under the
precipitation section.

WIND

The formula for determining how much the wind in an area is currently
blowing (not adding in direction. Too complicated and artificial seeming
considering there aren't exits from every direction in every room, even
while flying in the air) is:

var=((beta*front_mod)+current_wind-base_wind)
if var is negative, make positive

modifier=weather_diverge/var

current_wind=(modifier*(beta*front_wind_mod)+current_wind)


WEATHER CONDITIONS AND PRECIPITATION

If, during a weather front change, the temperature drops more than 20
degrees from the max temp for that day, and the temperature is still above
32, then we get fog. The practical effects of fog are that you cannot see
adjacent locations with glance or squint. Have fog in an area last random
10-25 minutes.  Remember that room flag 59 means that the room is
permanently fogged.

Precipitation works as follows:

Weather goes in the following order:
clear skies
light clouds
heavy clouds
drizzle/flurries
Light rain/light snow
Heavy rain/heavy snow
Downpour/blizzard

If the current temp is below 32, then precipitation will be of the snow
variety. 

Every minute, all the areas will be cycled through. The chance of going
either up or down a level of weather is the beta for that area. If it is
going to change, then the chance that it will move UP a level is the
current humidity of the area. (if it's at clear skies, it can't go down,
and if it's at downpour/blizzard, it can't go up). If it's going to change
and doesn't move up, it will move down.

During precipitation, humidity will be lowered as follows:
Every 5 minutes of drizzle: -1
Every 5 minutes of light rain: -2
Every 5 minutes of heavy rain: -3
Every 5 minutes of downpour: -4

Precipitation will stop, and things will revert to heavy clouds when
precipitation reaches the base humidity for that area.


That's the rudimentary design then. I have to write messages for a)
changing weather conditions, b) sentences describing weather conditions
that will be pre-pended to outdoor rooms descriptions, and c) periodic
'atmospheric' messages reflecting the current weather.

--matt




_______________________________________________
MUD-Dev maillist  -  MUD-Dev at kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev



More information about the mud-dev-archive mailing list