Spielerando

Show the right moon on each night, even before day zero

A night scene says the moon is full, three nights later it is full again, and the players notice. Here is how to turn the count of days into a moon that waxes and wanes in the right rhythm, lists the full-moon nights in a stretch of days, and does not break for days before the start.

Why this works

A cycle that is never stored cannot drift. Working out the moon from the day count alone means every saved game and every jump in time agree, and a cycle that is not a whole number of days keeps the pattern from looking like a machine.

When not to use it

Skip it when the moon matters for nothing, or when the story needs a particular moon on a particular night, such as a full moon at the climax. Then set it by hand; a computed cycle will not land where the plot wants it.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 3 common mistakes and the fix
  • A diagram of every state
  • 29 lines of example code with 4 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "Show the right moon on each night, even before day zero" (read_entry moon-phase-for-night-scenes-by-day-count) in my game. Build it step by step, and show me how you checked that it works.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP