-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non synchronous moon phases #36549
Non synchronous moon phases #36549
Conversation
static constexpr time_duration synodic_month = 29.530588853 * 1_days; | ||
const time_duration moon_phase_duration = | ||
calendar::season_from_default_ratio() * synodic_month; | ||
// Switch moon phase at noon so it stays the same all night |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment will not be necessarily true with non synchronous moon cycles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right that this was broken, but I think it was already broken before my changes. In any case, I've now fixed it, and added a test.
010156f
to
77e7e5b
Compare
Previously the in-game lunar month was exactly one third of a season (30.333 days, by default). This meant that the lunar cycle matched perfectly with the seasons / years, unlike the real-world lunar cycle which is inconveniently mismatched with other calendar units. Switch it so that, for the default season length, the lunar cycle matches the real-world synodic month of about 29.5 days. Also tidy up the code so that it's clearer how this value is arrived at.
Pull these values out as global statics to make it clearer that the default season length is the real-world season length.
This was failing on Mingw, probably due to -ffast-math optimizations.
This was already theoretically implemented, but it didn't work. Fix it and add a test.
77e7e5b
to
31bae0e
Compare
This one is in Catch2 internals and triggered by using generators.
Summary
SUMMARY: Features "Make lunar cycle not exactly match season changes"
Purpose of change
Previously (since #35246) the in-game lunar month was exactly one third of a season (30.333 days, by default). This meant that the lunar cycle matched perfectly with the seasons / years, unlike the real-world lunar cycle which is inconveniently mismatched with other calendar units.
Describe the solution
Switch it so that, for the default season length, the lunar cycle matches the real-world synodic month of about 29.5 days.
Also tidy up the code so that it's clearer how this value is arrived at.
Add some tests for the lunar cycle code.
Describe alternatives you've considered
Having a fixed lunar month regardless of season length setting.
Testing
Unit tests, including the newly added test.
Additional context
I'm using Catch2 generators for this test. That's a relatively new feature which I believe we should be using in more places. This is a simple test case for that.