Give the water and floor surfaces' fixed-step remainders as many slots as the waters' ripples.

Every interactive floor of a place and both water managers ask frame_rate_sim_host once an update, each for its own
object. With 8 slots, a place with more such objects than that had them take each other's slot in turn, start
without a remainder every update and stand still above 60 fps, as before the set owater. The table now has 64 slots,
as the ripples' has, and frame_step_check runs 32 surfaces at 144 fps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 05:46:58 -05:00
parent 2f7ddc884b
commit f512a98988
2 changed files with 14 additions and 1 deletions

View File

@@ -584,7 +584,10 @@ void frame_rate_water_host(Cpu *c) {
// that is not positive, or too large for a count, stays for the cut. The remainders are in a table of their own: an
// object that shares slots with the counters above would lose its fraction to them.
// NX2NAVI_TRACE=perf: every 10 s, the steps the objects were given beside those the cut alone would have given.
#define SIM_SLOTS 8
// Every interactive floor of a place (the Deku Tree's ground webs are such floors) and both water managers ask once an
// update, each for its own object, so the table holds as many as the waters' does: with fewer slots than objects each
// would take another's slot in turn, start without a remainder every update and stand still again above 60 fps.
#define SIM_SLOTS 64
static WholeSlot sim_slot[SIM_SLOTS];
void frame_rate_sim_host(Cpu *c) {

View File

@@ -277,6 +277,16 @@ int main(int argc, char **argv) {
sim(interactive, NAN) == 0, "no time, negative time and NaN are cut as fcvtzs cuts");
CHECK(sim(interactive, 1.0f / 15.0f) == 4, "four steps for a 15 fps update (the game's clamp to 3 follows)");
}
// A place with many interactive floors: 2 water managers and 30 floors, each asking once an update at 144 fps, all
// keep their own remainder and run 60 fixed steps a second (with 8 slots they took each other's and ran none).
{
const uint64_t first = 0x7600000000ull;
uint32_t steps[32] = {0};
for (int f = 0; f < 1440; f++)
for (int k = 0; k < 32; k++) steps[k] += sim(first + 0x1000 * (uint64_t)k, 1.0f / 144.0f);
for (int k = 0; k < 32; k++)
CHECK(steps[k] >= 599 && steps[k] <= 600, "surface %d of 32 at 144 fps: %u steps in 10 s", k, steps[k]);
}
printf("frame_step_check: %s\n", fails ? "FAILED" : "ok");
return fails != 0;
}