# Order fixed simulation steps around dawn at accelerated time

- **Status:** current.
- **Engine:** ue6-main `61e2877e`, Linux x86_64, Epic clang 23.1.5.
- **Context:** Standalone UE6 actors with a native farm clock and BPVerse policy callbacks.
- **Prerequisites:** A world clock that drives fixed simulation steps, a phase-change event, and an incubator whose hatch registers a chick for the dawn callback.

## Symptom

When a single frame crosses dawn, simulating the whole frame after broadcasting dawn can omit a chick that should have hatched before the boundary. Moving the broadcast to the end of the frame can also grow a chick that hatched after dawn.

## Smallest example / reproduction

In Coop Zero Step 08, use a 245-second light phase and a 95-second dark phase. Disable need drain, pick up Aster's first egg after about 108 simulated seconds and put it in the incubator. Launch with `-UseFixedTimeStep -FPS=120` and switch to `coop.timescale 6000`. One game frame now advances about 50 farm seconds. An incubation time of 225 seconds puts the hatch just before the first dawn. An incubation time of 245 seconds puts it just after dawn in the same frame. The exact packaged commands are in Coop Zero's Step 08 `REPORT.md`.

## Solution

Split the elapsed simulation time at each phase boundary. Run fixed simulation steps strictly before the boundary in the closing phase. Then broadcast dawn or dusk and run steps at or after the boundary under the new phase. In Coop Zero, `ACoopDayNight::Tick` advances phases and `UCoopGameSubsystem::StepFarm` steps incubators after the flock, because a hatch registers a new bird.

## Why it works

The dawn handler sees the flock exactly as it exists at the phase boundary. A hatch in the closing phase registers before dawn. A hatch in the new phase becomes eligible at the following dawn. Running the incubator after flock iteration also avoids modifying that iteration from inside a hatch.

## Verified

- **Evidence level:** runs in packaged build.
- **How:** In `Saved/step08-packaged-before-dawn.log`, frame 299 logs `HATCHED chick`, `DAWN` and `GROWN hen=Chick_2147482123 t=340.00` in that order. In `Saved/step08-packaged-after-dawn.log`, frame 299 logs `DAWN` then `HATCHED chick`. Frame 306 logs the following `DAWN` and `GROWN hen=Chick_2147482123 t=680.00`.
- **Date / by:** 2026-11-25, Coop Zero Step 08.

## Limits and assumptions

The fixture exercises simulated advancement at high timescale in a Linux Development package. It covers an incubation on either side of a natural dawn. Future bed skips and save restoration need their own checks.
