webatintel / aquarium

BSD 3-Clause "New" or "Revised" License
26 stars 7 forks source link

Expected behavior of updating fish positions #141

Open hujiajie opened 4 years ago

hujiajie commented 4 years ago

Proposal A: Update fish positions according to wall clock time (current behavior, as well as that of the original WebGL implementation)

Proposal B: Update fish positions according to frame number

Proposal C: Add an option for switching between A and B

gyagp commented 4 years ago

For a real application, the position has to be calculated by the wall clock time. So Proposal A should be the default behavior. For test, actually the expectation can be impacted by many factors, including fish count, MSAA, screen resolution, elapsed time and so on. Regarding the impact of elapsed time, I'd prefer we can make the whole screen stationary. That is we have exactly the same result for different frames.

hujiajie commented 4 years ago

Proposal D: Update fish positions according to wall clock time, and hook the time function in testing so it returns mocked wall clock time

Hooking can be implemented with LD_PRELOAD on Linux, but I'm not sure about the feasibility on Windows and macOS.

The method is analogous to using a patched libc during testing, where the time function returns deterministic values and ignores the hardware clock. Aquarium will not need a separate path for testing then.

gyagp commented 4 years ago

We shouldn't introduce too much complexity for the tests. I still prefer some changes within Aquarium to facilitate the tests.