Better Playback #5
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been using this to record macros in fighting games; which require very precise input. There are two primary issues with file recording:
(1) Playback is frame-based rather than time-based. Meaning that if there's descrepency between the FPS of the recording & the FPS of the playback, then two fall out of sync.
(2) The code spams the input stack a lot more than necessary. This makes debugging a general pain for recorded macros as file-sizes grow at an unnecessary rate.
Solutions:
(1) Add a timestamp to every button click during recording/creating macros. Wait for the proper time (relative to the start of the script) before sending the write input to the controller. We a class called ControllerStateTime which stores the controller message and timestamp. This class is pickled to a file upon recording, and can be deserialized on playback.
(2) Because of solution #1, we can now only send/write inputs when a change in controller state occurs! On every frame we compare the current message with the last message to decide whether nor not we want to spam the controller, and potentially write to a file.
P.S: This library is great, and you're amazing!!!