Author |
Topic: Raining Weather |
The_Caretaker |
General Member Since: Jun 8, 2004 Posts: 11625 Last: Jul 7, 2009 [view latest posts] |
|
|
|
WuphonsReach |
General Member Since: Aug 16, 2004 Posts: 276 Last: May 7, 2006 [view latest posts] |
|
|
|
WuphonsReach |
General Member Since: Aug 16, 2004 Posts: 276 Last: May 7, 2006 [view latest posts] |
|
|
|
WHC_Grassy |
General Member Since: Apr 20, 2005 Posts: 1426 Last: Aug 25, 2007 [view latest posts] |
|
|
|
WuphonsReach |
General Member Since: Aug 16, 2004 Posts: 276 Last: May 7, 2006 [view latest posts] |
|
|
Category: CoDUO Mapping Posted: Saturday, Mar. 11, 2006 06:27 am |
|
I shall have to experiment with that. For historical value, here's the code that I'm using to randomly pick the ambient sound and the fog values at the start:
Code: // Set the CullFog randomly, most of the time we pick a moderate value
fogclass = randomint(10);
switch(fogclass)
{
case 0: // Super dense, 4000-6000 far plane, 10% chance
println("Today will be bitterly cold with poor visibility.");
syb_fognear = randomint(500);
syb_fogbase = 4000;
syb_fogfar = syb_fogbase + randomint(2000);
ambientPlay("syb_ambient_heavysnow");
break;
case 1: // Super clear, 8000-10000 far plane, 10% chance
println("The forecast calls for no precipitation and clear visibility.");
syb_fognear = randomint(2500) + 2500;
syb_fogbase = 8000;
syb_fogfar = syb_fogbase + randomint(2000);
ambientPlay("syb_ambient_clear");
break;
default: // Moderate (default), 6000-8000 far plane, 80% chance
println("The forecast calls for moderate conditions and visibility.");
syb_fognear = randomint(1500) + 1000;
syb_fogbase = 6000;
syb_fogfar = syb_fogbase + randomint(2000);
ambientPlay("syb_ambient_moderate");
break;
}
iprintln("Fog: " + syb_fognear + " to " + syb_fogfar);
setCullFog (syb_fognear, syb_fogfar, .32, .36, .40, 5);
Notes:
- The println() statements aren't really working well (they don't send messages to the player). There's a different way to do this, but I haven't gotten to it yet.
- Naturally, I have my own custom sound alias CSV for the ambient sounds of "syb_ambient_heavysnow", "syb_ambient_clear", and "syb_ambient_moderate".
- It's interesting that sometimes the map has good visibility, while other rounds are poor visibility. It changes the long-range game where tanks and infantry become more difficult to spot at a distance.
(The map that I'm testing on is about 18000 x 28000, but the longest view is only 10000.) |
|
|
|
WHC_Grassy |
General Member Since: Apr 20, 2005 Posts: 1426 Last: Aug 25, 2007 [view latest posts] |
|
|
|
WuphonsReach |
General Member Since: Aug 16, 2004 Posts: 276 Last: May 7, 2006 [view latest posts] |
|
|
Category: CoDUO Mapping Posted: Saturday, Mar. 11, 2006 03:18 pm |
|
Thanks.
That's (randomness) the main reason I figured out how to randomize the fog values. It changes the map slightly every round because you can no longer go to point X and know that you'll be able to see point Y. Some rounds, you're going to have to use alternate spot Z to see point Y.
Crystal clear day (around 9000u for fog distance):
Not so clear (this is the 80% pick), around 6500u far distance on the culling fog setting
Really foggy (about 10% of the rounds), about 4500u far distance value:
...
My ideas for randomly changing the fog value during a round:
1) Pick 2 far plane fog values (start / goal) within a band that are at least 1000u different (10 notches). So 4500 and 5500. Also setup boundary values (4000 and 6000).
2) Once a minute, change the fog value slightly by 50-100u (random).
a. A 33% chance of moving away from the goal. But not past the lower/upper boundary.
b. A 67% chance of moving towards our current goal value.
3. If we reach our goal value, pick a new goal value.
...
So, on average, it would take about 20 minutes to go from start to goal. Not sure if that's too long or if the increments are too large. I think that once a minute shouldn't be overly noticable if we're only moving the far plane around 2% at a time. |
|
|
|
WHC_Grassy |
General Member Since: Apr 20, 2005 Posts: 1426 Last: Aug 25, 2007 [view latest posts] |
|
|
Category: CoDUO Mapping Posted: Sunday, Mar. 12, 2006 05:38 am |
|
Well I tried, the news is not good at this stage.
My code looks like it should work but unfortunately again UO seems to not as Flexible as MOH/sh was.
I am getting an error on the setcullfog command,
unknown builtin method error.
For what it's worth here is the code, I expanded on your random selection code as it seemed a good place to start :)
Regards Grassy
Code: //------------------------
//incremental in game fog
//------------------------
//setCullFog(start dist, cull dist, RGB Red colour, RGB Green colour, RGB Blue colour, time);
//setCullFog(0, 8000, 0.8, 0.8, 0.8, 0);
//setExpFog(the thickness of the fog, RGB Red colour, RGB Green colour, RGB Blue colour, time - which is always 0);
//setExpFog(.00070, .40, .40, .40, 0);
main ()
{
level thread SetupFog();
}
SetupFog() {
// This code was written by WuphonsReach & posted in ModsOnline forums
// Set the CullFog randomly, most of the time we pick a moderate value
fogclass = randomint(10);
switch(fogclass) {
case 0: // Super dense, 4000-6000 far plane, 10% chance
println("Today will be bitterly cold with poor visibility.");
syb_fognear = randomint(500);
syb_fogbase = 4000;
syb_fogfar = syb_fogbase + randomint(2000);
// ambientPlay("syb_ambient_heavysnow");
break;
case 1: // Super clear, 8000-10000 far plane, 10% chance
println("The forecast calls for no precipitation and clear visibility.");
syb_fognear = randomint(2500) + 2500;
syb_fogbase = 8000;
syb_fogfar = syb_fogbase + randomint(2000);
// ambientPlay("syb_ambient_clear");
break;
default: // Moderate (default), 6000-8000 far plane, 80% chance
println("The forecast calls for moderate conditions and visibility.");
syb_fognear = randomint(1500) + 1000;
syb_fogbase = 6000;
syb_fogfar = syb_fogbase + randomint(2000);
// ambientPlay("syb_ambient_moderate");
break;
}
iprintln("Fog: " + syb_fognear + " to " + syb_fogfar);
setCullFog (syb_fognear, syb_fogfar, .32, .36, .40, 5);
//-----------------------***********************
//New section added by <|WHC|>Grassy
//Creates stepping fogplane & some random colors
//-----------------------***********************
colmin = 0.2; //minimum fogcolor is 0.2
fogcolor = ( colmin + randomfloat(0.8)); //maximum fogcolor could be 1
iprintln ("FogColor = " + fogcolor);
fogplane_step = 50;
step_speed = 5;
fogplane = syb_fogfar;
fogplanemin = syb_fognear;
fogplanemax = 10000;
if (fogplane < 7000)
acending = true;
for (;;)
{
if(acending)
fogplane += fogplane_step;
else
fogplane -= fogplane_step
setCullFog(fogplanemin, fogplane, fogcolor, fogcolor, fogcolor, 0);
wait step_speed;
if((fogplane >= fogplanemax) || (fogplane <= fogplanemin))
acending = false;
}
}
/*
****Notes****
Ideas for randomly changing the fog value during a round - posted by WuphonsReach in ModsOnline forums
1) Pick 2 far plane fog values (start / goal) within a band that are at least 1000u different (10 notches). So 4500 and 5500. Also setup boundary values (4000 and 6000).
2) Once a minute, change the fog value slightly by 50-100u (random).
a. A 33% chance of moving away from the goal. But not past the lower/upper boundary.
b. A 67% chance of moving towards our current goal value.
3. If we reach our goal value, pick a new goal value.
So, on average, it would take about 20 minutes to go from start to goal. Not sure if that's too long or if the increments are too large.
I think that once a minute shouldn't be overly noticable if we're only moving the far plane around 2% at a time.
*/
Ps: where did all those br additions come from???
edited on Mar. 12, 2006 12:41 am by WHC_Grassy |
|
|
|
WHC_Grassy |
General Member Since: Apr 20, 2005 Posts: 1426 Last: Aug 25, 2007 [view latest posts] |
|
|
Category: CoDUO Mapping Posted: Sunday, Mar. 12, 2006 05:55 am |
|
Dammit, I ran out of edit time.
I noticed an error in the script, so here is an updated version.
Quote: //------------------------
//incremental in game fog
//------------------------
//setCullFog(start dist, cull dist, RGB Red colour, RGB Green colour, RGB Blue colour, time);
//setCullFog(0, 8000, 0.8, 0.8, 0.8, 0);
//setExpFog(the thickness of the fog, RGB Red colour, RGB Green colour, RGB Blue colour, time - which is always 0);
//setExpFog(.00070, .40, .40, .40, 0);
main ()
{
level thread SetupFog();
}
SetupFog() {
// This code was written by WuphonsReach & posted in ModsOnline forums
// Set the CullFog randomly, most of the time we pick a moderate value
fogclass = randomint(10);
switch(fogclass) {
case 0: // Super dense, 4000-6000 far plane, 10% chance
println("Today will be bitterly cold with poor visibility.");
syb_fognear = randomint(500);
syb_fogbase = 4000;
syb_fogfar = syb_fogbase + randomint(2000);
// ambientPlay("syb_ambient_heavysnow");
break;
case 1: // Super clear, 8000-10000 far plane, 10% chance
println("The forecast calls for no precipitation and clear visibility.");
syb_fognear = randomint(2500) + 2500;
syb_fogbase = 8000;
syb_fogfar = syb_fogbase + randomint(2000);
// ambientPlay("syb_ambient_clear");
break;
default: // Moderate (default), 6000-8000 far plane, 80% chance
println("The forecast calls for moderate conditions and visibility.");
syb_fognear = randomint(1500) + 1000;
syb_fogbase = 6000;
syb_fogfar = syb_fogbase + randomint(2000);
// ambientPlay("syb_ambient_moderate");
break;
}
iprintln("Fog: " + syb_fognear + " to " + syb_fogfar);
//setCullFog (syb_fognear, syb_fogfar, .32, .36, .40, 5);
//-----------------------***********************
//New section added by <|WHC|>Grassy
//Creates stepping fogplane
//-----------------------***********************
colmin = 0.2; //minimum fogcolor is 0.2
fogcolor = ( colmin + randomfloat(0.8)); //maximum fogcolor could be 1
iprintln ("FogColor = " + fogcolor);
fogplane_step = 50;
step_speed = 5;
fogplane = syb_fogfar;
fogplanemin = syb_fognear;
fogplanemax = 10000;
if (fogplane < 7000)
acending = true;
for (;;)
{
if(acending)
fogplane += fogplane_step;
else
fogplane -= fogplane_step
setCullFog(fogplanemin, fogplane, fogcolor, fogcolor, fogcolor, 0);
wait step_speed;
if(fogplane >= fogplanemax)
acending = false;
if(fogplane <= fogplanemin)
acending = true;
}
}
edited on Mar. 12, 2006 12:56 am by WHC_Grassy |
|
|
|
WuphonsReach |
General Member Since: Aug 16, 2004 Posts: 276 Last: May 7, 2006 [view latest posts] |
|
|
|