Guest Posted October 9, 2002 To the OFP makers, Can you release the formulas for sunrise/sunset, moonrise/moonset and high/low tides? It would be very useful in both Map and Mission making to have this information readily available, and surely it doesn't compromise your long hard work in making OFP? This is one of the best features of OFP, and it would be nice to be able to exploit it a bit more fully and easier. Already I have seen a very nice map made for one of the larger Mods that at certain times of the year has a main town 1.5m underwater because of surge tides (nice feature though). Please please please? Leone Share this post Link to post Share on other sites
suma 8 Posted October 9, 2002 Here you are. Enjoy. Tides formula: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> const float maxTide=5; Vector3 sunDir = sun->SunDirection(); Vector3 moonDir = sun->MoonDirection(); Vector3 sunTide = sunDir[1]*sunDir; Vector3 moonTide = moonDir[1]*moonDir; float tide01 = (sunTide.Y()+moonTide.Y())*0.5; float tideAbs =maxTide*tide01; <span id='postcolor'> Note: we are aware the tide formula contains a bug. Correct should be: float tide=(fabs(sunTide.Y())+fabs(moonTide.Y())*0.5; We did not fix this bug as it would make many older mission unplayable. Sun & moon position formula: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> float latitudeCoord = world ? world->GetLatitude() : -40*H_PI/180; Matrix3 moonOrbitAngle(MRotationZ,5*H_PI/180); Matrix3 earthAxis=Matrix3(MRotationX,23*H_PI/180); Matrix3 latitude(MRotationX,latitudeCoord); // -40 - Croatia, -90 - north pole const float initMoonOnOrbitPos=0.5; const float day=1.0/365; const float lunarMonth=28*day; float timeInYear = Glob.clock.GetTimeInYear(); float timeOfDay = Glob.clock.GetTimeOfDay(); float moonOnOrbitPos=initMoonOnOrbitPos+timeInYear*(1.0/lunarMonth); Matrix3 moonOnOrbit=moonOrbitAngle*Matrix3(MRotationY,moonOnOrbitPos*(H_PI*2)); Matrix3 earthOnOrbit=Matrix3(MRotationY,timeInYear*(H_PI*2)); // note - midnight is on the point furthest from the sun Matrix3 midnightToCurrent=Matrix3(MRotationY,timeOfDay*(H_PI*2)); // calculate sun and moon position relative to current postion Matrix3 cameraToCosmos=earthAxis*midnightToCurrent*earthOnOrbit*latitude; Matrix3 cosmosToCamera=cameraToCosmos.InverseRotation(); // use rotation of PI/2 to achieve this Matrix3 normalDirection(MRotationX,-H_PI/2); Matrix3 convert=normalDirection*cosmosToCamera; _direction=convert*earthOnOrbit.Direction(); _moonDirection=convert*moonOnOrbit.Direction(); // reverse N-S, W-W _direction[0]=-_direction[0]; _direction[2]=-_direction[2]; _moonDirection[0]=-_moonDirection[0]; _moonDirection[2]=-_moonDirection[2]; _direction.Normalize(); _sunDirection=_direction; <span id='postcolor'> Share this post Link to post Share on other sites
Blomstermann 0 Posted October 9, 2002 See... THIS is why we love BIS Share this post Link to post Share on other sites
GAMEER_77 0 Posted October 9, 2002 I presume this is for an add-on, because i've seen nothing like this in mission editing PEACE Share this post Link to post Share on other sites
Mister Frag 0 Posted October 9, 2002 I understand that the default can't be changed so as not to break existing missions, but it might be nice to be able to select the corrected tide formula through a setting in the DESCRIPTION.EXT file or a trigger. Share this post Link to post Share on other sites
Spitfire 0 Posted October 9, 2002 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (GAMEER_77 @ Oct. 09 2002,20:39)</td></tr><tr><td id="QUOTE">I presume this is for an add-on, because i've seen nothing like this in mission editing  PEACE<span id='postcolor'> That's a piece of something top secret, called OFP source code in C++. Share this post Link to post Share on other sites
IceFire 0 Posted October 9, 2002 Shouln't this be in "mission editing"? Share this post Link to post Share on other sites
Blomstermann 0 Posted October 9, 2002 addon and mods would be more correctly Share this post Link to post Share on other sites
Skunk Monkey 0 Posted October 9, 2002 Yeah, I noticed this too with 1.75 and we have made use of it in a few of the maps we have on our server, and seen it on others. one of the easiest place to see the dramatic effect of tides is the twin little islands to the south of Nogavo. The tides can make them 1 big island joined by a sand bank or two little ones... and yes its stuff like this that makes us all love OFP and those wonderful guys at BIS Share this post Link to post Share on other sites
walker 0 Posted October 9, 2002 Hi all Has anyone produced tide tables for the islands in OFP? It would be useful particlarly for use with the new LSD and forces doing an sea-bourne invasion. Regards walker Share this post Link to post Share on other sites
Kermit 0 Posted October 10, 2002 We worship you, Bohemia Interactive Studios people! Share this post Link to post Share on other sites
Mister Frag 0 Posted October 10, 2002 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (walker @ Oct. 09 2002,16:20)</td></tr><tr><td id="QUOTE">Hi all Has anyone produced tide tables for the islands in OFP? It would be useful particlarly for use with the new LSD and forces doing an sea-bourne invasion. Regards walker<span id='postcolor'> You'd have to know the location of the islands in order to produce the tide tables. Share this post Link to post Share on other sites
Guest Posted October 10, 2002 Thank you Suma....excellent stuff As someone else said....this is why we love BIS and OFP. Hopefully some clever boffin will have the calculator soon (I can barely program a VCR). As to which forum this should be in...I did check posts...and most that were to do with tides/times were in General....so I thought when in Rome.....(it was only my first post). From a very grateful Leone Share this post Link to post Share on other sites
suma 8 Posted October 10, 2002 I think this belongs to mission editing. Share this post Link to post Share on other sites