I'm trying to fix the Moon

General Posts:
Post Reply
WxTech
Posts: 126
Joined: Sat Jan 14, 2017 4:05 pm

I'm trying to fix the Moon

Post by WxTech » Wed Sep 11, 2019 9:21 pm

I recently jumped from modded 4.09 to 4.12.2 Modact. The facility to set real mission dates (starting with 4.10, I gather) is exciting. (Not to mention the plethora of other features.)

However. To this day the Moon is and has always been incorrectly located, in that the code assigns to it the *same* declination as the Sun--always! This is wrong, because the ecliptic is tilted by 23.5 degrees (the game code, for some reason, uses, 22.5 degrees, to which I shall adhere.)

For instance. On the Summer solstice, when the Sun is farthest north in the sky at 22.5 degrees above the equator, an in-game full Moon is *also* placed the same 22.5 degrees north of the equator (!). In reality, being opposite the Sun, the Moon would be at -22.5 degrees. And so our game's summer full Moon is 45(!) degrees too high, rising long *before* sunset and setting long *after* sunrise on a mid- or far-northern map.

Conversely, a winter solstice full Moon is 45 degrees too low in the sky, rising long after sunset and setting long before sunrise.

Those are the extremes. But for other than about 20% of the time, when the Moon by chance is given roughly the correct declination, the discrepancies for non tropical latitudes can become significant when trying to adhere to history or basic realism for night ops. But in any event, it's jarring for an astronomer type like me to see the Moon wildly out of place.

The addition of a single line if code fixes that problem, which I've done.

But it gets worse!

Apparently, pre-4.10 il2_core.dll code used the moonPhase variable in Sun.class to set the correct moon000**.tga to use. But it seems that some other variable in the new MoonPhase.class is now used instead. If so, incorrectly chosen! Because now the moon phase graphic does NOT change from day to day. Furthermore, it's usually the wrong one to start with. A simple 60 second check was clearly not undertaken by the coder to verify that the Moon graphic was correctly selected.

And because the code I'd like to see is in a .dll, it's utterly inaccessible. The best any one of us might do is to insert some code into MoonPhase.java to reassign a variable at a time and see if we can hit upon the correct one.... I'm not sure where to start, but my instincts point to an array of variables, some of which appear to be angular values. My coding chops are practically non-existent, and so I don't know if I can safely come up with a routine to do this variable reassignment. ;)

Spitballing my naive notion: If we have ad[6], keep ad[0] to ad[4] unchanged, swapping ad[5] and ad[6]. And so on, until the right one is hit upon--if at all possible.

The reason I suggest this? Because I've cooked up some crude code in Sun.class that works well enough to set the correct Moon phase and its placement. Which renders MoonPhase.class redundant in this one respect. And so any other mixed up variables related to the Moon resulting from our experiment should be moot.

Another notion... Adding some kind of print commands in MoonPhase.java that will send the desired-to-know variable values to the console. If I could bring up the console (via SHF-TAB) after setting a date/time I would, for instance, see listed those ad[6] variables. This would permit to see what's what after a couple or few changes.

I feel that a proper Moon treatment is fundamental, and hence worth the effort.

Any ideas or suggestions?
Post Reply

Return to “Pilot's Pub”

Who is online

Users browsing this forum: No registered users and 16 guests