Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request - Allow changing the system time during a TAS #474

Open
thearst3rd opened this issue Mar 19, 2022 · 2 comments
Open

Feature Request - Allow changing the system time during a TAS #474

thearst3rd opened this issue Mar 19, 2022 · 2 comments

Comments

@thearst3rd
Copy link

For some speedruns, it can be a requirement that the runner changes their system time mid-run in order to manipulate cycles or get things to spawn. For example, in the clock tower room in FEZ, four anticubes spawn based on time and speedrunners will change their system time to a few different times so they can collect all the cubes.

Currently, libTAS supports setting the system time before the run starts, but once the run has started the system time cannot be changed anymore. It would be great for it to work similar to the "variable framerate" option, where on any given frame, you can change the system time to a new value and that will be stored in the TAS. So when the TAS is played back, it will change the time on those same frames. That would be very useful for making TASes of the kind of runs I described above.

@marcelopio
Copy link

I like the idea, but for example, for Unity, I need to set the actual random seed, since the system time won't affect UnityEngine.Random

UnityEngine.Random sets it's initial random value from /dev/urandom, but after that, each call adds entropy to it, so actual random value is not dependent on system time, but on the number of calls do random.

A similar solution on Unity would help a lot with that use case. Currently I am modding the game to set a seed on a method call. If libTAS could set a seed on a frame this would be awesome

@clementgallet
Copy link
Owner

That is a different issue, but initial system time is actually used to set the values inside the fake /dev/urandom, so modifying the initial time does indeed seed UnityEngine.Random. see:

if (!datestr) {
time_t tsec = static_cast<time_t>(shared_config.initial_time_sec);
datestr = asctime(gmtime(&tsec));
}

I need to write a proper PRNG instead of filling with characters.

clementgallet added a commit that referenced this issue Apr 12, 2022
There are different clock times that can be queried on Linux, which are
well described in clock_gettime() manpage. There are two main
categories:

* a monotonic clock that starts at an arbitrary value and only
  increases. It cannot be modified by the user
* a realtime clock whose value corresponds to the Unix timestamp, and
  which can be modified by the user

In one speedrun we modify the system clock to save time, so in
preparation for its support, we need to know which function returns
which category of clock time. We make our monotonic clock starts at 0,
so that it is easier to compute movie length and such. Realtime is the
one that is set by the user at startup. Both are shown on GUI main
window, and realtime also has the corresponding date and time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants