Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
 parse description bug
Yesterday, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!

Members: 0
Guests: 7
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » Smaug Snippets » weather code cell climate bug?
Forum Rules | Mark all | Recent Posts

weather code cell climate bug?
< Newer Topic :: Older Topic >

Pages:<< prev 1, 2, 3 next >>
Post is unread #1 Apr 6, 2008, 2:43 am
Go to the top of the page
Go to the bottom of the page

Llarn
Apprentice
GroupMembers
Posts63
JoinedNov 25, 2007

Something just doesn't seem right with this...


Current Weather State for:
Cell (2, 1)
Climate: desert
Hemispere: southern
Cloud Cover: 19
Energy: 75
Temperature: 19
Pressure: 100
Humidity: 24
Precipitation: 2
Wind Speed XAxis: -41
Wind Speed YAxis: 19

Weather: X Coord: 2 Y Coord: 1

So the cell is a desert climate in southern hemisphere, and I'm getting frigid temperatures and snow in my
desert area I assigned the corridnates too.

A few scattered snowflakes fall to the ground.

       
Post is unread #2 Apr 6, 2008, 7:57 am
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

It does snow in the desert, occasionally. I don't know if the weather system takes day/night into account, but it can get very cold at night. However, snow is unusual because precipitation is generally rare.

I would expect Cloud Cover to normally be pretty sparse, unless a storm system is moving through. Likewise for Humidity. And those two together should keep Precipitation pretty low.

Llarn said:

Something just doesn't seem right with this...

Energy: 75
Pressure: 100


I don't know what Energy is, so I can't comment on that other than to inquire. I *hope* Pressure is not in standard inches of mercury! A pressure of 100in would be the middle of a hurricane (today, it's 30.06in where I live).
       
Post is unread #3 Apr 6, 2008, 6:19 pm
Go to the top of the page
Go to the bottom of the page

Llarn
Apprentice
GroupMembers
Posts63
JoinedNov 25, 2007

Could be, but I don't want snow in my desert. Like you said the precipitation should be very low. I have been in the desert many times myself, it does get cold at night, but not likely to snow.

       
Post is unread #4 Apr 6, 2008, 6:48 pm
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

The system does indeed take day/night into account.

Energy is exactly what it says, the energy in the air and potential for thunder and lightning. Of course, that would require rain, not snow.

Now, for the snow in the desert, that is indeed probably something I should double check, but it might be because of the season, and your choice of hemisphere. (2, 1) doesn't really fit with a southern hemisphere anyway I position the 3x3 grid that represents the weather map. But aside from that, try switching it to northern hemisphere. And if you can, let me know what season it is.

Once, I have all the data, I can attempt to flesh out why you're getting snow in a climate that isn't supposed to fall below certain temperatures.
       
Post is unread #5 Apr 6, 2008, 6:54 pm   Last edited Apr 6, 2008, 10:50 pm by Llarn
Go to the top of the page
Go to the bottom of the page

Llarn
Apprentice
GroupMembers
Posts63
JoinedNov 25, 2007

setweather 2 1 hemisphere northern
Cell Hemisphere set.

showweather 2 1
Current Weather State for:
Cell (2, 1)
Climate: desert
Hemispere: northern southern
Cloud Cover: 76
Energy: 93
Temperature: -6
Pressure: 79
Humidity: 33
Precipitation: 32
Wind Speed XAxis: -88
Wind Speed YAxis: -72

Thats odd it added northern, but kept the southern in it. I noticed it does that with climates too, if you add one
it doesn't delete the old one, and there doesn't appear to be a way to do so, unless you edit the weathermap.dat.
Bah it actually is buggy about changing it in weathermap.dat too. It was at 3, I changed it to 1 and still shows both northern and southern hemispheres in showweather 2 1.

       
Post is unread #6 Apr 7, 2008, 1:16 pm
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

Kayle said:

Energy is exactly what it says, the energy in the air and potential for thunder and lightning. Of course, that would require rain, not snow.


Actually, keep your options open there. I live in Michigan, and we do indeed get the occasional "Thundersnow" storm, usually in very early winter or very early spring. So, snow shouldn't rule out lightning entirely, just probably make it far less likely (I suspect you need a layer of cold, dry air near the ground with a layer of moist air above, so there is lots of water and conductivity in the sky, but it turns to snow very close to the ground).
       
Post is unread #7 Apr 8, 2008, 1:48 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Don't forget that neighboring cells will have an influence over your desert. If it's surrounded by frozen tundra for instance, that will have a pretty powerful affect on it. What are the settings for the cells surrounding this one?
       
Post is unread #8 Apr 8, 2008, 11:03 am
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

I'll update the code to just apply the one instead of toggling them.

You'll need to just setweather 2 1 hemisphere southern to remove it.
       
Post is unread #9 Apr 8, 2008, 12:17 pm
Go to the top of the page
Go to the bottom of the page

Llarn
Apprentice
GroupMembers
Posts63
JoinedNov 25, 2007


Samson said:

Don't forget that neighboring cells will have an influence over your desert. If it's surrounded by frozen tundra for instance, that will have a pretty powerful affect on it. What are the settings for the cells surrounding this one?


Current Weather State for:
Cell (2, 0)
Climate: arctic
Hemispere: northern
Cloud Cover: 90
Energy: 0
Temperature: -22
Pressure: 85
Humidity: 0
Precipitation: 70
Wind Speed XAxis: 97
Wind Speed YAxis: -100


Current Weather State for:
Cell (2, 2)
Climate: rainforest savanna
Hemispere:
Cloud Cover: 42
Energy: 29
Temperature: 26
Pressure: 100
Humidity: 32
Precipitation: 26
Wind Speed XAxis: -38
Wind Speed YAxis: -16

this is what your asking for right? Intesting that the cells next to it would affect it, I had thought maybe the areas connected next to the area would affect it.
       
Post is unread #10 Apr 8, 2008, 12:32 pm
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

Areas have nothing to do with weather anymore. aside from where a player has to be to see the messages. and what the weather is affecting. All influence on the weather is from surrounding cells.
       
Post is unread #11 Apr 8, 2008, 1:57 pm   Last edited May 21, 2008, 5:29 pm by Kayle
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

Alright, So, Couple of things to update.

Update your do_setweather and do_showweather functions with the following:

void do_setweather( CHAR_DATA *ch, char *argument )
{
	char arg[MIL], arg2[MIL], arg3[MIL], arg4[MIL];
	int value, x, y;

	argument = one_argument( argument, arg );
	argument = one_argument( argument, arg2 );
	argument = one_argument( argument, arg3 );
	argument = one_argument( argument, arg4 );

	if( IS_NPC( ch ) )
    {
      send_to_char( "Mob's can't setweather.\r\n", ch );
      return;
    }

    if( !ch->desc )
    {
      send_to_char( "Nice try, but You have no descriptor.\r\n", ch );
      return;
    }
	
    if( !arg || arg[0] == '\0' || !arg2 || arg2[0] == '\0' || !arg3 || arg3[0] == '\0' )
    {
	send_to_char( "Syntax: setweather <x> <y> <field> <value>\r\n", ch );
        send_to_char( "\r\n", ch );
        send_to_char( "Field being one of:\r\n", ch );
        send_to_char( "  climate hemisphere\r\n", ch );
	send_to_char( "Climate value being:\r\n", ch );
        send_to_char( "  rainforest savanna desert steppe chapparal arctic\r\n", ch );
        send_to_char( "  grasslands deciduous_forest taiga tundra alpine\r\n", ch );
	send_to_char( " See Help Climates for information on each.\r\n", ch );
   	send_to_char( "Hemisphere value being:\r\n", ch );
        send_to_char( "  northern southern\r\n", ch );
	return;
    }

	

	x = atoi( arg );
	y = atoi( arg2 );

	if( x < 0 || x > WEATHER_SIZE_X )
	{
		
		ch_printf( ch, "X value must be between 0 and %d.\r\n", WEATHER_SIZE_X );
		return;
	}	
		
	if( y < 0 || y > WEATHER_SIZE_Y )
	{
		
		ch_printf( ch, "Y value must be between 0 and %d.\r\n", WEATHER_SIZE_Y );
		return;
	}

	struct	WeatherCell *cell = &weatherMap[x][y];

	
    if( !str_cmp( arg3, "climate" ) )
    {
      if( !arg4 || arg4[0] == '\0' )
      {
         send_to_char( "Usage: setweather <x> <y> climate <flag>\r\n", ch );
         return;
      }

         value = get_climate( arg4 );
         if( value < 0 || value > MAX_CLIMATE )
            ch_printf( ch, "Unknown flag: %s\r\n", arg4 );
         else
	 {
            cell->climate = 0;
            SET_BIT( cell->climate, 1 << value );
			send_to_char( "Cell Climate set.\r\n", ch );
	 }

      return;
    }

    if( !str_cmp( arg3, "hemisphere" ) )
    {
      if( !arg4 || arg4[0] == '\0' )
      {
         send_to_char( "Usage: setweather <x> <y> hemisphere <flag>\r\n", ch );
         return;
      }

         value = get_hemisphere( arg4 );
         if( value < 0 || value > HEMISPHERE_MAX )
            ch_printf( ch, "Unknown flag: %s\r\n", arg4 );
         else
	 {
            cell->hemisphere = 0;
            SET_BIT( cell->hemisphere, 1 << value );
		send_to_char( "Cell Hemisphere set.\r\n", ch );
	 }

      return;
    }
    else
    {
		send_to_char( "Syntax: setweather <x> <y> <field> <value>\r\n", ch );
        send_to_char( "\r\n", ch );
        send_to_char( "Field being one of:\r\n", ch );
        send_to_char( "  climate hemisphere\r\n", ch );
		send_to_char( "Climate value being:\r\n", ch );
        send_to_char( "  rainforest savanna desert steppe chapparal arctic\r\n", ch );
        send_to_char( "  grasslands deciduous_forest taiga tundra alpine\r\n", ch );
		send_to_char( " See Help Climates for information on each.\r\n", ch );
   		send_to_char( "Hemisphere value being:\r\n", ch );
        send_to_char( "  northern southern\r\n", ch );
	    return;
	}

}

void do_showweather( CHAR_DATA *ch, char *argument )
{
	char arg[MIL], arg2[MIL];
	int x, y;

	argument = one_argument( argument, arg );
	argument = one_argument( argument, arg2 );

	if( IS_NPC( ch ) )
    {
      send_to_char( "Mob's can't showweather.\r\n", ch );
      return;
    }

    if( !ch->desc )
    {
      send_to_char( "Nice try, but You have no descriptor.\r\n", ch );
      return;
    }
	
	if( !arg || arg[0] == '\0' || !arg2 || arg2[0] == '\0'  )
	{
		send_to_char( "Syntax: showweather <x> <y>\r\n", ch );
	    return;
	}

	x = atoi( arg );
	y = atoi( arg2 );

	if( x < 0 || x > WEATHER_SIZE_X )
	{
		
		ch_printf( ch, "X value must be between 0 and %d.\r\n", WEATHER_SIZE_X );
		return;
	}	
		
	if( y < 0 || y > WEATHER_SIZE_Y )
	{
		
		ch_printf( ch, "Y value must be between 0 and %d.\r\n", WEATHER_SIZE_Y );
		return;
	}

	struct	WeatherCell *cell = &weatherMap[x][y];

	ch_printf_color( ch, "Current Weather State for:\r\n" );
	ch_printf_color( ch, "&WCell (&w%d&W, &w%d&W)&D\r\n", x, y );
	ch_printf_color( ch, "&WClimate:           &w%s&D\r\n", flag_string( cell->climate, climate_names ) );
	ch_printf_color( ch, "&WHemispere:         &w%s&D\r\n", flag_string( cell->hemisphere, hemisphere_name ) );
	ch_printf_color( ch, "&WCloud Cover:       &w%d&D\r\n", cell->cloudcover );
	ch_printf_color( ch, "&WEnergy:            &w%d&D\r\n", cell->energy );
	ch_printf_color( ch, "&WTemperature:       &w%d&D\r\n", cell->temperature );
	ch_printf_color( ch, "&WPressure:          &w%d&D\r\n", cell->pressure );
	ch_printf_color( ch, "&WHumidity:          &w%d&D\r\n", cell->humidity );
	ch_printf_color( ch, "&WPrecipitation:	   &w%d&D\r\n", cell->precipitation );
	ch_printf_color( ch, "&WWind Speed XAxis:  &w%d&D\r\n", cell->windSpeedX );
	ch_printf_color( ch, "&WWind Speed YAxis:  &w%d&D\r\n", cell->windSpeedY );
	
}

**Blasted tabbing...

Also, what kind of objections would there be for me to convert this to C++ in the next release update? By C++ I mean, making it into a class, utilizing std::bitset, etc.
       
Post is unread #12 Apr 8, 2008, 3:41 pm
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Llarn said:


Samson said:

Don't forget that neighboring cells will have an influence over your desert. If it's surrounded by frozen tundra for instance, that will have a pretty powerful affect on it. What are the settings for the cells surrounding this one?


Current Weather State for:
Cell (2, 0)
Climate: arctic
Hemispere: northern
Cloud Cover: 90
Energy: 0
Temperature: -22
Pressure: 85
Humidity: 0
Precipitation: 70
Wind Speed XAxis: 97
Wind Speed YAxis: -100

Current Weather State for:
Cell (2, 2)
Climate: rainforest savanna
Hemispere:
Cloud Cover: 42
Energy: 29
Temperature: 26
Pressure: 100
Humidity: 32
Precipitation: 26
Wind Speed XAxis: -38
Wind Speed YAxis: -16

this is what your asking for right? Intesting that the cells next to it would affect it, I had thought maybe the areas connected next to the area would affect it.


Heh. You'e produced a rather interesting climate there. Rainforest on one side, arctic on the other, with desert touching both. No wonder it ended up with high winds, snow, and insane pressure differences :P

Kayle said:

Also, what kind of objections would there be for me to convert this to C++ in the next release update? By C++ I mean, making it into a class, utilizing std::bitset, etc.


You'd get no objection from me obviously and the FUSS base can handle it just fine as well. The effort has been expended to push FUSS more in that direction, may as well go for it.
       
Post is unread #13 Apr 8, 2008, 6:14 pm
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

std::bitset is just so easy to use, and it basically removes the limits of BVs and EXT_BVs, so I like using it now. :P

I mean, when you can have an array of 200 flags for various things, it's pretty nice, especially since 200 is no where near the limit of std::bitset.
       
Post is unread #14 Apr 9, 2008, 6:52 pm
Go to the top of the page
Go to the bottom of the page

Llarn
Apprentice
GroupMembers
Posts63
JoinedNov 25, 2007

Added your fixes to setweather and showweather thanks. However, at 10am mud time with climates surrounding 2, 1 as desert southern still get extremely low temperatures. I can make adjustment in my code, just wanted to let you know.

Current Weather State for:
Cell (2, 1)
Climate: desert
Hemisphere: southern
Cloud Cover: 48
Energy: 1
Temperature: 5
Pressure: 100
Humidity: 22
Precipitation: 12
Wind Speed XAxis: -30
Wind Speed YAxis: -6

It is 10 o'clock am, Day of the Sun, 7th day in the Month of the Great Evil.
It is the season of winter, in the year 5.
The mud started up at : Wed Apr 9 20:41:45 2008

The system time : Wed Apr 9, 2008 8:49:28 PM CDT
Your local time : Wed Apr 9, 2008 2:49:28 PM Eniwetok
The next pfile cleanup is in 1 day 6 hours 10 minutes 32 seconds.

Current Weather State for:
Cell (2, 2)
Climate: desert
Hemisphere: southern
Cloud Cover: 77
Energy: 47
Temperature: 13
Pressure: 100
Humidity: 32
Precipitation: 45
Wind Speed XAxis: -60
Wind Speed YAxis: -42

Current Weather State for:
Cell (2, 0)
Climate: desert
Hemisphere: southern
Cloud Cover: 98
Energy: 0
Temperature: -28
Pressure: 100
Humidity: 0
Precipitation: 45
Wind Speed XAxis: -92
Wind Speed YAxis: -68
       
Post is unread #15 Apr 9, 2008, 7:11 pm
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

Something's not right then, and I'll have to look. Winter in the southern hemisphere should be pushing the temperature through the roof.
       
Post is unread #16 Apr 9, 2008, 7:38 pm
Go to the top of the page
Go to the bottom of the page

Llarn
Apprentice
GroupMembers
Posts63
JoinedNov 25, 2007

Are the extreme high pressures supposed to be from 80 to 100 each time?

I thought that might be the problem so I did this....

else if( cell->climate == CLIMATE_DESERT )
{
if( ( time_info.sunlight == SUN_SET || time_info.sunlight == SUN_DARK ) && cell->temperature > 30 )
delta->temperature += -5;
else if( ( time_info.sunlight == SUN_RISE || time_info.sunlight == SUN_LIGHT ) && cell->temperature < 64 )
delta->temperature += 80; // this change doesn't fix problem temps still barely making it to the 60's during daytime in desert.
else if( cell->humidity > 10 )
{
delta->humidity += -2;
}
delta->pressure = number_range( 0, 20); // this change doesn't fix problem pressure still at 100.

Also negative wind speeds is that possible?
}
       
Post is unread #17 Apr 10, 2008, 7:11 am
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006


Also negative wind speeds is that possible?

struct WeatherCell
{
	int climate;        // Climate flag for the cell
	int hemisphere;     // Hemisphere flag for the cell
	int	temperature;    // Fahrenheit because I'm American, by god
	int	pressure;       // 0..100 for now, later change to barometric pressures
	int	cloudcover;     // 0..100, amount of clouds in the sky
	int	humidity;       // 0+
	int	precipitation;  // 0..100
	int energy;			// 0..100 Storm Energy, chance of storm.
    /*
     *  Instead of a wind direction we use an X/Y speed
     *  It makes the math below much simpler this way.
     *  Its not hard to determine a basic cardinal direction from this
     *  If you want to, a good rule of thumb is that if one directional
     *  speed is more than double that of the other, ignore it; that is
     *  if you have speed X = 15 and speed Y = 3, the wind is obviously
     *  to the east.  If X = 15 and Y = 10, then its a south-east wind. 
     */
	int	windSpeedX;    //  < 0 = west, > 0 = east
	int	windSpeedY;    //  < 0 = north, > 0 = south
};


See Comments.

Also, never EVER propogate a change of over 10. It will cause a cascading ripple that you'll only be able to fix by deleting your map and starting a fresh one. Influence maps are very very sensitive. And this map works a lot like real weather does. You can't just seed in huge values for things, you'll cause values in other cells to get skewed, and then you'll have awkward values in all climates.
       
Post is unread #18 Apr 10, 2008, 3:21 pm   Last edited Apr 10, 2008, 3:36 pm by Llarn
Go to the top of the page
Go to the bottom of the page

Llarn
Apprentice
GroupMembers
Posts63
JoinedNov 25, 2007

I am thinking of removing 2 function calls from weatherupdate


weatherupdate function

// These two functions here seem to be preventing my desert climate temperatures from going past 40 degrees
CalculateCellToCellChanges( );
EnforceClimateConditions( );

Adding Randomizingcells( ); to weatherupdate before saveweather is called

and just putting in randomizingcells what temps and stuff I want for each climate, instead of worrying about
what cell is next to what other cell.

I have tried it and it seems to work with no errors, or crashes taking my desert temps to 90 degrees.
I know it's not your intent at all for your weather snippet, but if someone just wants to set the climate to
areas and not worry about connecting cells, and wants more control over what a climate can and can't
do, do you agree that this is the method to use?

And or ---- make setweather so I can set all the variables for climates, like setweather 2 1 mintemp maxtemp

       
Post is unread #19 Apr 10, 2008, 5:56 pm
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

What would happen if you just increase the number of cells in the given area? It seems like that would cause the weather systems to stabilize with the ones on the borders remaining "extreme".
       
Post is unread #20 Apr 10, 2008, 7:20 pm   Last edited Apr 10, 2008, 7:24 pm by Llarn
Go to the top of the page
Go to the bottom of the page

Llarn
Apprentice
GroupMembers
Posts63
JoinedNov 25, 2007

Unless I'm mistaken I don't see where Randomizecells function is ever called by anything in the weather code. I think that maybe the problem with the weather code.

Hrm, well it is in time update in update.c.


       
Pages:<< prev 1, 2, 3 next >>