Game Development Community

dev|Pro Game Development Curriculum

Realistic yearly atmospheric cycle system v0.1 beta

by Dimitris Matsouliadis · 09/15/2008 (2:14 pm) · 28 comments

Download Code File

for better
-----------------------------------------------------------------------------------------
. Set your sky name to "Sky"
. Set your sun name to "MySun" // not necessary
. Create a sunlightObject with "MyMoon" name // not necessary

execute the SunCycle.cs
execute the TimeCycle.cs
execute the WeatherCycle.cs

Any time you like after mission load or in consol use
TimeCycle(MyTime, 80);// 80 is the time ~1 gameday in 80 min

you can use
Mysun.Elevation = ; // degree to start or set the sun, default is 0 degree "sunrise"
Mysun.reset();
Mysun.Apply();
changeTheSky();
createTheMoon();
createTheSun();
MyMoon.delete();
Mysun.delete();

If you like place in PlayGui.gui a Textcontrol with name (isMyclock) to see the time
If you like place in PlayGui.gui a Textcontrol with name (isMyDater) to see the full date like "Sunday 1 January of 380 BC"

// here is the TimeCycle.cs
//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//
// Time/date 09/2008 Matsouliadis Dimitris
//------------------------------------------

//seasons = "seasonNow, Name, TimeEffect, baseEffect1, baseEffect2, baseEffect3, maxEffect1, maxEffect2, maxEffect3, Nightlight, fogRain"
$season[0] = "0 Spring 20 0 10 10 10 50 50 8 30";
$season[1] = "1 Summer 10 0 10 0 0 50 10 10 50";
$season[2] = "2 Autumn 30 0 10 10 10 50 50 5 20";
$season[3] = "3 Winter 60 0 10 10 1 50 50 1 10";

//Months = "SeasonIs, MonthName, DaysHave"
$setMonths = "12";
$Month[0] = "3 January 31";
$Month[1] = "3 February 28";
$Month[2] = "0 March 31";
$Month[3] = "0 April 30";
$Month[4] = "0 May 31";
$Month[5] = "1 June 30";
$Month[6] = "1 july 31";
$Month[7] = "1 August 31";
$Month[8] = "2 September 30";
$Month[9] = "2 October 31";
$Month[10] = "2 November 30";
$Month[11] = "3 December 31";

//weekdays = "Daynumder. Dayname"
$setWeekDays = "7";
$weekDay[0] = "0 Sunday";
$weekDay[1] = "1 Monday";
$weekDay[2] = "2 Tuesday";
$weekDay[3] = "3 Wednesday";
$weekDay[4] = "4 Thursday";
$weekDay[5] = "5 Friday";
$weekDay[6] = "6 Saturday";

$MyTime = new ScriptObject(Mytime);

// Starring values for >> Sunrise, Winter, Sunday 1 January of 380 BC
$MyTime.Year = "380 0"; //0= year ++. 1= year --
$MySeason = 3;
$MyTime.Month = 0;
$MyTime.week = 0;
$MyTime.hours = 7;
$MyTime.Day = 0;
$MyTime.MonthDay =1;
$MySunElevationNow = 1;
$ElevatorStep = 0;
$setSunRissing = 7;

//---------------------- Timer -----------------
function TimeCycle(%Mytime,%duration)
{
%Mytime.TimeCycleSec = %duration;
if((%Mytime.Pulse % %Mytime.TimeCycleSec) == 0)
{
$SetTheDuration = %duration;
$MyMoonElevationTime = $SetTheDuration * 10;
serverCmdDoTime();
}
%Mytime.Pulse++;
if(%Mytime.Pulse >= 3600)
%Mytime.Pulse = 0;
schedule(%duration, 0, "TimeCycle", %Mytime, %duration);
}
//---------------------------------------------

function serverCmdDoTime(%client)
{
if(isObject(MyTime))
{
$MyTime.minutes++;
$ElevatorStep++;
if($ElevatorStep >= 4)
{
$ElevatorStep = 0;
$MySunElevationNow++;
suncycle(Mysun,$SetTheDuration);
}
if($MyTime.minutes >=60)
{
$MyTime.minutes = 0;
$MyTime.hours++;
if(MyTime.hours >= 24)
{
$MyTime.hours = 0;
$MyTime.Day++;
$MyTime.MonthDay++;
%DayOfMonth = getword($Month[$MyTime.Month] , 2) +1;
if($MyTime.MonthDay >= %DayOfMonth)
{
$MyTime.MonthDay = 1;
$MyTime.Month++;
SetDefaultSeasonSky();

if($MyTime.Day >= $setWeekDays)
{
$MyTime.Day = 0;
$MyTime.week++;
if($MyTime.week >= 53)
$MyTime.week =0;
}
if($MyTime.Month >=$setMonths)
{
$MySeason = getword($Month[$MyTime.Month], 0);
$MyTime.Month = 0;
%yearSet = getword($MyTime.Year, 1);
%yearNow = getword($MyTime.Year, 0);
if(%yearSet == "0")
{
%yearNow++;
$MyTime.Year= (%yearNow SPC %yearSet);
}
else
{
%yearNow--;
$MyTime.Year= (%yearNow SPC %yearSet);
}


}
}
}
}
}
$DayNow = getword($weekDay[$MyTime.Day], 1);
$MonthNow= getword($Month[$MyTime.Month], 1);
$YearNow = getword($MyTime.Year, 0);
//%client = $playernow;
//%MyTimeWord = ("Time is: " @ $MyTime.hours @ ":" @ $MyTime.minutes SPC $MyTime.MonthDay SPC $DayNow SPC $MonthNow @ " of year " @ $YearNow);
//messageClient(%client, 'MyTime', %MyTimeWord);

if($MyTime.minutes == $MyTime.Prev)
{

}
else
{
$MyTime.Prev = $MyTime.minutes;
%SetClock = ($MyTime.hours @ ":" @ $MyTime.minutes);
%SetDater =($DayNow SPC $MyTime.MonthDay SPC $MonthNow @ " of " @ $YearNow SPC "BC");
isMyclock.text = %SetClock;
isMyDater.text = %SetDater;
}


}

//here is the SunCycle.cs

//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//
// day/night 09/2008 Matsouliadis Dimitris
//------------------------------------------

// sunrise set for winter
$Skymaterial = "scriptsAndAssets/data/skies/sky_blue/sky_blue.dml";
$FogSet = 150;
$fogColor = "0.92 0.69 0.431373 0";
$checkSunPlace = 0;
$MySundrl = 1.3;
$MyMoonDate =1;
$MySkyCloud1 = "0.05";
$MySkyCloud2 = "0.2";
$MySkyCloud3 = "0";
$MySkyClSpeed1 = "0.0001";
$MySkyClSpeed2 = "0.0001";
$MySkyClSpeed3 = "0.0001";
$MyHeliosMaxBrt = 0.6;

// ------------- checking the sun elevation
function SunCycle(%MySun,%duration)
{
if(isObject(%MySun))
{
if($MySunElevationNow> 359)
{
$MySunElevationNow = 0;
}

%MySun.Elevation = $MySunElevationNow;
%Sunelv = %MySun.Elevation; //support the sun degree
weatherCheck();

if($checkSunPlace == $MySunElevationNow)
{
//support the water, non contain
}
else
{
$checkSunPlace = $MySunElevationNow;

if(%Sunelv >=160 && %Sunelv <= 230) //sunset
{
$FogSet =690 -(%Sunelv * 3);
if($FogSet <=1)
$FogSet=1;

%fogClRed = "0.92" +((159 -%Sunelv) /70);
%fogClGreen = "0.92" +((159 -%Sunelv) /60);
%fogClBlue = "0.92" +((159 -%Sunelv) /45);
%nightLight = getword($season[$MySeason], 9) / 100;
if(%fogClRed <= %nightLight)
%fogClRed = %nightLight;
if(%fogClGreen <= %nightLight)
%fogClGreen = %nightLight;
if(%fogClBlue <= %nightLight)
%fogClBlue = %nightLight;
$fogColor = (%fogClRed SPC %fogClGreen SPC %fogClBlue SPC "0");
changeTheSky();
}

if(%Sunelv >=311) //sunrise
{
$FogSet = %Sunelv -300;
if(%Sunelv >=340)
{
%fogClRed = ((%Sunelv -339) /22.2);
%fogClGreen = ((%Sunelv -339) /29);
%fogClBlue = ((%Sunelv -339) /46.5);
$fogColor = (%fogClRed SPC %fogClGreen SPC %fogClBlue SPC "0");
}
changeTheSky();
}

if(%Sunelv >=1 && %Sunelv <= 90) //step to midday
{
$FogSet = 60 + (%Sunelv * 10);
if($FogSet >= 500)
$FogSet=500;
if(%Sunelv >=1 && %Sunelv <= 60)
{
%fogClRed = "0.92";
%fogClGreen = "0.69" + (%Sunelv /261);
%fogClBlue = "0.43" + (%Sunelv /120);
$fogColor = (%fogClRed SPC %fogClGreen SPC %fogClBlue SPC "0");
if(%Sunelv >=30)
}
changeTheSky();
}

if($MySundrl <= 0.01)
{
$MySundrl = 0.01;
}

%MySun.DrlMultiplier = $MySundrl;
%MySun.apply();

if(%Sunelv == 1)
{
$Skymaterial = "scriptsAndAssets/data/skies/sky_blue/sky_blue.dml";
$MySundrl = 1.3;
changeTheSky();
if(isObject(MyMoon))
MyMoon.delete();
}
if(%Sunelv == 160)
{
$MyMoonDate++;
if($StartRainNow == 0)
CreateTheMoon();
}
if(%Sunelv == 170)
{
$Skymaterial = "scriptsAndAssets/data/skies/sky_middle/sky_middle.dml";
$MySundrl = 0.8;
changeTheSky();
}
if(%Sunelv == 210)
{
$Skymaterial = "scriptsAndAssets/data/skies/sky_night/sky_night.dml";
$MySundrl = 0.1;
changeTheSky();
}
if(%Sunelv == 350)
{
$Skymaterial = "scriptsAndAssets/data/skies/sky_middle/sky_middle.dml";
$MySundrl = 0.6;
changeTheSky();
}
}
}
}

function changeTheSky(){

if($StartRainNow == 1)
{
%fogRain = getword($season[$MySeason], 10);
$FogSet = %fogRain;
}

%VisibleSet = $FogSet +100;
if(%VisibleSet >= 600)
%VisibleSet =600;
if(%VisibleSet <= 250)
%VisibleSet =250;

Sky.canSaveDynamicFields = "1";
Sky.Enabled = "1";
Sky.position = "336 136 0";
Sky.rotation = "1 0 0 0";
Sky.scale = "1 1 1";
Sky.materialList = $Skymaterial;
Sky.cloudHeightPer[0] = $MySkyCloud1;
Sky.cloudHeightPer[1] = $MySkyCloud2;
Sky.cloudHeightPer[2] = $MySkyCloud3;
Sky.cloudSpeed1 = $MySkyClSpeed1;
Sky.cloudSpeed2 = $MySkyClSpeed2;
Sky.cloudSpeed3 = $MySkyClSpeed3;
Sky.visibleDistance = %VisibleSet;
Sky.fogDistance = $FogSet;
Sky.fogColor = $fogColor;
Sky.fogStorm1 = "0";
Sky.fogStorm2 = "0";
Sky.fogStorm3 = "0";
Sky.fogVolume1 = "0 0 0";
Sky.fogVolume2 = "0 0 0";
Sky.fogVolume3 = "0 0 0";
Sky.windVelocity = "5 1 0";
Sky.SkySolidColor = "0.6 0.6 0.6 0.1";
Sky.useSkyTextures = "1";
Sky.renderBottomTexture = "0";
Sky.noRenderBans = "0";
Sky.renderBanOffsetHeight = "50";
Sky.skyGlow = "0";
Sky.skyGlowColor = "0 0 0 0";
Sky.fogVolumeColor1 = "128 128 128 0";
Sky.fogVolumeColor2 = "128 128 128 0";
Sky.fogVolumeColor3 = "128 128 128 0";
Sky.windEffectPrecipitation = "1";
Sky.locked = "false";
Sky.applySkyChanges(); // This need some fix in engine:)
}

function CreateTheSun(){

if(isObject(MyHelios))
{
MyHelios.delete();
}
%MyHeliosMinBrt = $MyHeliosMaxBrt /2;
new fxSunLight(MyHelios) {
canSaveDynamicFields = "1";
Enabled = "0";
position = "3774.41 772.596 26.5183";
rotation = "1 0 0 0";
scale = "1 1 1";
Enable = "1";
LocalFlareBitmap = "common/lighting/corona.png";
RemoteFlareBitmap = "common/lighting/corona.png";
SunAzimuth = "50";
SunElevation = "10";
LockToRealSun = "1";
FlareTP = "1";
Colour = "1 1 1 1";
Brightness = "1";
FlareSize = "1";
LocalScale = "1";
FadeTime = "0.1";
BlendMode = "0";
AnimColour = "1";
AnimBrightness = "1";
AnimRotation = "1";
AnimSize = "0";
AnimAzimuth = "0";
AnimElevation = "0";
LerpColour = "1";
LerpBrightness = "1";
LerpRotation = "1";
LerpSize = "1";
LerpAzimuth = "1";
LerpElevation = "0";
LinkFlareSize = "0";
SingleColourKeys = "1";
MinColour = "0.45 0.25 0.03 0";
MaxColour = "0.35 0.20 0.04 0";
MinBrightness = %MyHeliosMinBrt;
MaxBrightness = $MyHeliosMaxBrt;
MinRotation = "0";
MaxRotation = "359";
minSize = "0.5";
MaxSize = "1";
MinAzimuth = "0";
MaxAzimuth = "359";
MinElevation = "0";
MaxElevation = "360";
RedKeys = "AZA";
GreenKeys = "AZA";
BlueKeys = "AZA";
BrightnessKeys = "AZA";
RotationKeys = "AZA";
SizeKeys = "AZA";
AzimuthKeys = "AZ";
ElevationKeys = "AZ";
ColourTime = "5";
BrightnessTime = "5";
RotationTime = "600";
SizeTime = "5";
AzimuthTime = "5";
ElevationTime = "200";
};
MissionGroup.add(MyHelios);
}

function CreateTheMoon(){

if($MyMoonDate >=7) //7 days cycle (27 normal)
$MyMoonDate = 1;

if($MyMoonDate >=1)
%MyMoonFace ="common/lighting/MyMoon.png";
if($MyMoonDate >=2)
%MyMoonFace ="common/lighting/MyMoon1.png";
if($MyMoonDate >=3)
%MyMoonFace ="common/lighting/MyMoon2.png";
if($MyMoonDate >=4)
%MyMoonFace ="common/lighting/MyMoon3.png";
if($MyMoonDate >=5)
%MyMoonFace ="common/lighting/MyMoon4.png";
if($MyMoonDate >=6)
%MyMoonFace ="common/lighting/MyMoon5.png";

if(isObject(MyMoon))
MyMoon.delete();

new fxSunLight(MyMoon) {
canSaveDynamicFields = "1";
Enabled = "1";
position = "3774.41 772.596 26.5183";
rotation = "1 0 0 0";
scale = "1 1 1";
Enable = "1";
LocalFlareBitmap = %MyMoonFace;
RemoteFlareBitmap = %MyMoonFace;
SunAzimuth = "30";
SunElevation = "0";
LockToRealSun = "0";
FlareTP = "1";
Colour = "1 1 1 1";
Brightness = "1";
FlareSize = "1";
LocalScale = "1";
FadeTime = "0.1";
BlendMode = "0";
AnimColour = "1";
AnimBrightness = "1";
AnimRotation = "0";
AnimSize = "0";
AnimAzimuth = "0";
AnimElevation = "1";
LerpColour = "1";
LerpBrightness = "1";
LerpRotation = "1";
LerpSize = "1";
LerpAzimuth = "1";
LerpElevation = "1";
LinkFlareSize = "0";
SingleColourKeys = "1";
MinColour = "0.5 0.45 0.35 0";
MaxColour = "0.65 0.5 0.4 0";
MinBrightness = "0.6";
MaxBrightness = "0.9";
MinRotation = "0";
MaxRotation = "359";
minSize = "0.5";
MaxSize = "1";
MinAzimuth = "20";
MaxAzimuth = "160";
MinElevation = "45";
MaxElevation = "270";
RedKeys = "AZA";
GreenKeys = "AZA";
BlueKeys = "AZA";
BrightnessKeys = "AZA";
RotationKeys = "AZA";
SizeKeys = "AZA";
AzimuthKeys = "AZ";
ElevationKeys = "AZ";
ColourTime = "200";
BrightnessTime = "500";
RotationTime = "600";
SizeTime = "5";
AzimuthTime = "5";
ElevationTime = $MyMoonElevationTime;
};
MissionGroup.add(MyMoon);
echo("The moon is rissing at: " @ MyMoon.SunElevation @ " with face: " @ %MyMoonFace );
}

// here is the weatherCycle.cs

//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//
// weather 09/2008 Matsouliadis Dimitris
//------------------------------------------

$RainTimeCounter =0;
$StartRainNow = 0;

function weatherCheck()
{
if($MySeason == 0)
%CloudLevel = 30;
if($MySeason == 1)
%CloudLevel = 50;
if($MySeason == 2)
%CloudLevel = 30;
if($MySeason == 3)
%CloudLevel = 10;

%timeStorm = getword($season[$MySeason] ,2);
$timeRain = %timeStorm;
if($RainTimeCounter == 0)
{
%GotoRain = getRandom(1, (100 -%timeStorm));
//echo("GO to Rain Random : " @ %GotoRain);
if(%GotoRain == 35)
{
$SetCloudLevel = getRandom(1 ,%CloudLevel);
$StartRainNow = 3;
}
}

if($StartRainNow == 1)
{
$IsStorm = 2;
startTheRain();
}
if($StartRainNow == 2)
{
SetDefaultSeasonSky();
}
if($StartRainNow == 3)
{
SetRainPrepare();
}
}


function startTheRain()
{
$RainTimeCounter++;

//echo("Rain counter : " @ $RainTimeCounter);
if($RainTimeCounter == getword($season[$MySeason] ,2))
{
$RainTimeCounter =0;
$StartRainNow = 2;
}
if($RainTimeCounter >= (getword($season[$MySeason] ,2) -3))
{
if(isObject(MyRain))
MyRain.delete();
if(isObject(MyLightning))
MyLightning.delete();
}
if($RainTimeCounter <= 1 && $StartRainNow == 1)
{
$MySkyCloud1 = getword($season[$MySeason], 6)/100;
$MySkyCloud2 = getword($season[$MySeason], 7)/100;
$MySkyCloud3 = getword($season[$MySeason], 8)/100;

$IsStorm = getRandom(1 ,8);
//$IsStorm = 8; //use this to snowing cycle only for snowed mountans
$MySkyClSpeed1 = ("0.0001" * $IsStorm);
$MySkyClSpeed2 = ("0.0001" * ($IsStorm /2));
$MySkyClSpeed3 = ("0.0001" * ($IsStorm /3));
//echo("Storm size : " @ $IsStorm);
%SetDropsNumber = $IsStorm * 3000;
if($IsStorm >=3)
{
if($MySeason <=2){
if($IsStorm ==8)
$IsStorm =7;
}
%setRain = "Rain";
%SetSpeedmin = $IsStorm /3;
%SetSpeedmax = $IsStorm /2;
if($IsStorm >= 5 && $IsStorm <=6 )
{
%setRain = "Rain";
StartTheLighting();
}
if($IsStorm ==7 )
{
%setRain = "HeavyRain";
StartTheLighting();
}
if($IsStorm >=8)
{
%setRain = "Snow";
%SetSpeedmin = "0.3";
%SetSpeedmax = "0.5";
}
new Precipitation(MyRain)
{
datablock = %setRain;
minSpeed = %SetSpeedmin;
maxSpeed = %SetSpeedmax;
numDrops = %SetDropsNumber;
boxWidth = "200";
boxHeight = "100";
minMass = "1.0";
maxMass = "2.0";
rotateWithCamVel = true;
doCollision = true;
useTurbulence = false;
};
MyRain.modifyStorm(0.1, getword($season[$MySeason] ,2));
}
changeTheSky();
}
if(isObject(MyMoon)){
MyMoon.delete();
}
}

function StartTheLighting()
{
%GetStrikes = $IsStorm *2;
%GetStrikesWidth = $IsStorm * 0.01;
%GetPos = "0 0 0";
%numHumans = 0;
%count = ClientGroup.getCount();
for (%i = 0; %i < %count; %i++)
{
%client = ClientGroup.getObject(%i);
if( !%client.isAIControlled() )
{
if(isObject(%client.player))
{
%numHumans++;
%pos = VectorAdd(%pos, %client.player.position);
}
}
}

%GetPos = VectorScale(%pos, 1.0 / (%numHumans ));

if (!isObject(MyLightning))
{
new Lightning(MyLightning)
{
position = %GetPos;
scale = "250 350 450";
dataBlock = "LightningStorm";
strikesPerMinute = %GetStrikes;
strikeWidth = %GetStrikesWidth;
chanceToHitTarget = "0.02";
strikeRadius = "500";
boltStartRadius = "20";
color = "1 1 1 1";
fadeColor = "8 8 8 1";
useFog = "1";
locked = "false";
};
}
}

function SetDefaultSeasonSky()
{
%nowCloud1 = getword($season[$MySeason], 3)/10;
%nowCloud2 = getword($season[$MySeason], 4)/10;
%nowCloud3 = getword($season[$MySeason], 5)/10;
%Cloud1 = $MySkyCloud1 * 10;
%Cloud1--;
if(%Cloud1<= %nowCloud1){
%Cloud1 = %nowCloud1;
}
%Cloud2 = $MySkyCloud2 * 10;
%Cloud2--;
if(%Cloud2 <= %nowCloud2){
%Cloud2 = %nowCloud2;
}
%Cloud3 = $MySkyCloud3 * 10;
%Cloud3--;
if(%Cloud3 <= %nowCloud3){
%Cloud3 = %nowCloud3;
}
$MySkyCloud1 = %Cloud1 /10;
$MySkyCloud2 = %Cloud2 /10;
$MySkyCloud3 = %Cloud3 /10;
$MySkyClSpeed1 = getword($season[$MySeason], 2)/220000;
$MySkyClSpeed2 = getword($season[$MySeason], 2)/260000;
$MySkyClSpeed3 = getword($season[$MySeason], 2)/300000;
changeTheSky();

//echo($MySkyCloud1 SPC $MySkyCloud2 SPC $MySkyCloud3);
if(($MySkyCloud1 *10) <= %nowCloud1 && ($MySkyCloud2 *10) <= %nowCloud2 && ($MySkyCloud3 *10) <= %nowCloud3)
{
if($MySeason == 0)
$MyHeliosMaxBrt = "0.9";
if($MySeason == 1)
$MyHeliosMaxBrt = "1";
if($MySeason == 2)
$MyHeliosMaxBrt = "0.8";
if($MySeason == 4){
$MyHeliosMaxBrt = "0.6";
}
CreateTheSun();
$StartRainNow = 0;
}
}

function SetRainPrepare()
{
%nowCloud1 = getword($season[$MySeason], 6)/10;
%nowCloud2 = getword($season[$MySeason], 7)/10;
%nowCloud3 = getword($season[$MySeason], 8)/10;
%Cloud1 = $MySkyCloud1 * 10;
%Cloud1++;
if(%Cloud1>= %nowCloud1){
%Cloud1 = %nowCloud1;
}
%Cloud2 = $MySkyCloud2 * 10;
%Cloud2++;
if(%Cloud2 >= %nowCloud2){
%Cloud2 = %nowCloud2;
}
%Cloud3 = $MySkyCloud3 * 10;
%Cloud3++;
if(%Cloud3 >= %nowCloud3){
%Cloud3 = %nowCloud3;
}
$MySkyCloud1 = %Cloud1 /10;
$MySkyCloud2 = %Cloud2 /10;
$MySkyCloud3 = %Cloud3 /10;
changeTheSky();

//echo("Prapare>> " @ $MySkyCloud1 SPC $MySkyCloud2 SPC $MySkyCloud3);
if(($MySkyCloud1 *10) >= %nowCloud1 && ($MySkyCloud2 *10) >= %nowCloud2 && ($MySkyCloud3 *10) >= %nowCloud3)
$RainTimeCounter =0;
$StartRainNow = 1;
$MyHeliosMaxBrt = "0.2";
CreateTheSun();
}

//-----------------------------------------------------------------------------
datablock SFXProfile(MyHeavyRainSound)
{
fileName = "~/data/sound/environment/HeavyRain";
description = AudioLooping2d;
preload = true;
};

datablock SFXProfile(MyRainSound)
{
fileName = "~/data/sound/environment/Rain";
description = AudioLooping2d;
preload = true;
};

datablock SFXProfile(MySnowSound)
{
fileName = "~/data/sound/environment/snow";
description = AudioLooping2d;
preload = true;
};


datablock PrecipitationData(Rain)
{
soundProfile = "MyRainSound";
dropTexture = "~/data/environment/rain";
splashTexture = "~/data/environment/water_splash";
dropSize = 0.2;
splashSize = 0.01;
useTrueBillboards = false;
splashMS = 250;
};

datablock PrecipitationData(HeavyRain)
{
soundProfile = "MyHeavyRainSound";
dropTexture = "~/data/environment/rain";
splashTexture = "~/data/environment/water_splash";
dropSize = 0.3;
splashSize = 0.05;
useTrueBillboards = false;
splashMS = 250;
};

datablock PrecipitationData(Snow)
{
soundProfile = "MySnowSound";
dropTexture = "~/data/environment/snow";
splashTexture = "~/data/environment/water_splash";
dropSize = 0.1;
splashSize = 0.001;
useTrueBillboards = true;
splashMS = 0.1;
};

datablock SFXProfile(ThunderCrash1Sound)
{
fileName = "~/data/sound/environment/thunder1";
description = AudioClose3d;
preload = true;
};

datablock SFXProfile(ThunderCrash2Sound)
{
fileName = "~/data/sound/environment/thunder2";
description = AudioClose3d;
preload = true;
};

datablock SFXProfile(ThunderCrash3Sound)
{
fileName = "~/data/sound/environment/thunder3";
description = AudioClose3d;
preload = true;
};

datablock SFXProfile(ThunderCrash4Sound)
{
fileName = "~/data/sound/environment/thunder4";
description = AudioClose3d;
preload = true;
};



datablock LightningData(LightningStorm)
{
strikeTextures[0] = "~/data/environment/lightning.dml";
thunderSounds[0] = ThunderCrash1Sound;
thunderSounds[1] = ThunderCrash2Sound;
thunderSounds[2] = ThunderCrash3Sound;
thunderSounds[3] = ThunderCrash4Sound;
};

Click Here for screenshots

About the author

entelsoft, commercial accounting software

Page «Previous 1 2
#1
09/15/2008 (4:02 pm)
Thanks for this - looks great and I'll definately be looking into it when I get a bit of time.

One thing though - I'd suggest making it slightly more readable by using [code] blocks in your blog.
#2
09/15/2008 (11:07 pm)
Wao great news ! Good job !

But only one question ! Is a problem for me !
Where are the images used in the resource ???

Needed in these dml files :
sky_blue.dml => relative images
sky_middle.dml => relative images
sky_night.dml => relative images

and these ?

MyMoon.png - MyMoon1.png - MyMoon2.png - MyMoon3.png - MyMoon4.png - MyMoon5.png

can anyone include them to the resource !

THANKS VERY MUCH !!!

^_^
#3
09/16/2008 (5:34 am)
Ok download against the timedatecycle.zip and you can find the Mymoon.zip inside. Extract Mymoon.zip and put the images into 'common\lighting' folder.
Skys have biggers files like 4-5 mb and i cant trasmit this size to server, but dont worry...
sky_blue.dml is default in '\data\skies\' folder. Make a copy of 'sky_blue' folder to 'sky_middle' and 'sky_night'. Go in this folders and rename the 'sky_blue.dml ' to 'sky_middle.dml' and 'sky_night.dml'.
That is ... effect now:)
With a image maker program give your figure you like. 'sky_blue' folder is ok. To 'sky_middle' give -50% brightness, to 'sky_night' give -90% brightness. If you give a standard brightness level to sky images dont have any problem (this is important for evasion the boxes outlines in sky). In 'sky_night\blue_0005.jpg' create some stars with brush 1-3 pixel white :)
#4
09/16/2008 (6:28 am)
Hei thank you very much ;-)

^_^
#5
11/28/2008 (9:05 am)
very nice resource, just one thing, any way to blend the transitions? to make them smoother? the steps are a bit harsh.
#6
11/28/2008 (12:21 pm)
Yes is that you say. I am working on engine for fix. I need 20-25 days for the update because Nov and Dec is the right seasons for my work. I am developer on commercial-accounting software and end of the year is the dead-line for updates :)

Also this code is a good release for games with long date time ( 1day > 2 houres) i thing...
One that i hope to get on is the real time change terrain and dts textures from summer grass to winder snow step by step! ~
#7
11/28/2008 (11:13 pm)
Dimitris, now that sounds like a good idea, and slightly longer days in summer, and freezing the waterblocks in winter. keep it up.
BTW, this works in 1.7.1
#8
12/20/2008 (1:23 am)
very very niceful~ :)

but.. this code little problem with TGEA 1.7.1
#9
12/20/2008 (4:04 am)
what problem?
#10
12/26/2008 (5:41 am)
Datablock PrecipitationData is

have to copy in environment.cs
#11
01/12/2009 (8:09 am)
Dimitris?

any progress??
#12
02/09/2009 (12:15 pm)
this is really cool im gonna try this when i get home. Question though, does this automically overide any current weather setting you have? Or do i have to delete them from my current mission?
#13
02/15/2009 (5:53 pm)
Very Nice Dimitris!
Got this working in TGEA 1.8.1 great!!!

Sky transitions can be worked out by having more than just 4 ... maybe increase up to 16 ... blending them together in photoshop.
#14
03/03/2009 (12:24 am)
I can see the sky changes but i can't see the movement of the Sun, only the moon. Any idea ?
#15
03/30/2009 (2:42 pm)
This is absolutely fantastic. I love to watch this in action. Thank you!!!
#16
04/06/2009 (4:54 pm)
hello ... ill be back soon. I have finish a job in another place and come back to start programming :). Soon i can buy the 1.8 :) thanks for all.
#17
04/16/2009 (7:57 pm)
Es un pedazo de código muy util, que estoy seguro que alguna vez lo usaremos. Gracias Dimitris Matsouliadis, esto es un gran apoyo en la parte de programación y de ideas sobre todo
#18
04/24/2009 (11:36 am)
Where do u put the weathercycle.cs, suncycle.cs and the timecycle.cs. I am using tgea 1.81

Edit.....Got the skies to work but having problems with the precipitation. Up a couple of posts someone said adding precipitation to environment.cs. Is that what is needed? I cannot locate environment.cs in tgea 1.81 afx

Edit2.....precipitation is working. Now just gotta get the sounds to work. Moving right along.

Edit3...all is working, even the guictrl buttons.

One question: Is there a way to make the time real time?
#19
10/08/2009 (2:47 pm)
Any more progress on this Dimitris?
#20
11/28/2009 (5:45 am)
Hi all:) I am working on T3D now and this have some changes, t3d is fantastic for me. I can make any i like just i like :). I am back to programming torque after a long time by reason of job.
i am in progress for 1 MMOrpg based real combat :)

for any like i have ready:

yearly atmospheric cycle.
automatic AI/bots with classes, spawn points, paths (1 mouse click).
Read/write datafiles (condification files for itemDB, players and traders)
Inventory system, trade system (guis and code)

if any like something pm me to post here the code:)



Page «Previous 1 2