Spielerando

Work out sunrise and sunset for a northern story, including nights that never end

A tale set in the far north has weeks of endless daylight and weeks of endless dark, and a day-night cycle that always gives twelve hours each cannot show them. The usual formula also breaks right where this gets interesting. Here is how to get day length from the place and the date, and what to do when the sun never sets.

Why this works

How long the day lasts depends on how far north you are and the time of year, and near the pole the sun may never rise or never set. Treating those two cases as their own outcome stops the numbers from breaking.

When not to use it

Don't use it for an invented world with its own sky, or when the story needs sunrise at a set hour. Set the times by hand there, since real sun rules would only get in the way.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 3 common mistakes and the fix
  • 37 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 "Work out sunrise and sunset for a northern story, including nights that never end" (read_entry day-length-with-midnight-sun-and-polar-night) 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