Author Topic: [Resource] Environment information! DayCycle and other stuff!  (Read 696 times)

Finding the correct position of the sun in dayCycles
Here's some data that I gathered using a test .daycycle file and another script
.daycycle Fraction is the fraction found in the .daycycle file under FRACTION #
The Time Fraction is the fraction by taking %timeOfDay/%dayLength.



I also have the file in .xls and .ods (for you OpenOffice users like me).
http://filesmelt.com/dl/sunTrackingData.ods
http://filesmelt.com/dl/sunTrackingDataXLS.xls

Here is some code snippets to convert from each fraction type as well as the simplified functions and their ranges from the data
Code: [Select]
//Simplified equations: f(x) is Sim Time Fraction, x is DayCycle Fraction
//f(x) = (7/6)x where x <= 0.6
//f(x) = (1/3)x where x > 0.6 and x <= 0.9
//f(x) = 2x where x > 0.9
function simTimeFractionToDaycycleFraction(%dayCycleFraction)
{
%dayCycleFraction = mClampF(%dayCycleFraction, 0.0, 1.0);

%simTimeFraction = (7/6) * %dayCycleFraction;
if(%dayCycleFraction <= 0.6)
return %simTimeFraction;

%simTimeFraction += (1/3) * %dayCycleFraction - 0.6;
if(%dayCycleFraction < 0.9)
return %simTimeFraction;

%simTimeFraction += 2 * %dayCycleFraction - 0.9;
return %simTimeFraction;
}

//Simplified equations: f(x) is DayCycle Fraction, x is Sim Time Fraction
//f(x) = (6/7)x where x <= 0.7
//f(x) = 3x where x > 0.7 and x <= 0.8
//f(x) = (1/2)x where x > 0.8
function simTimeFractionToDaycycleFraction(%simTimeFraction)
{
%simTimeFraction = mClampF(%simTimeFraction, 0.0, 1.0);

%dayCycleFraction = (6/7) * %simTimeFraction;
if(%simTimeFraction <= 0.7)
return %dayCycleFraction;

%dayCycleFraction += 3 * %simTimeFraction - 0.7;
if(%simTimeFraction <= 0.8)
return %dayCycleFraction;

%dayCycleFraction += (1/2) * %simTimeFraction - 0.8;
return %dayCycleFraction;
}

Now this is all cool, but the hell is it useful for?
Well, you could read a .daycycle file and grab specific values based on the time of day now, you can correctly determine whether it's day or night, and any other things you want :D

Other stuff
coming soon

More resources
You can use this in conjunction with http://forum.blockland.us/index.php?topic=241022.0
« Last Edit: September 07, 2013, 05:55:56 PM by DYLANzzz »