-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Refactor PlaybackSerialiser #203
Refactor PlaybackSerialiser #203
Conversation
Note to self: |
Note to self: |
64573de
to
d5b5188
Compare
- Preparing for developing and testing the flavor - Created package 'flavor'
- Moved each registration in it's own method - Moved /restartandplay functionality to PlaybackController - [MCTCommon] Added functionality to AbstractRegistry - Moved Keybind registering to TASmodKeybinds - Added TASmodRegistry
d5b5188
to
ae3c1dc
Compare
- Renamed PlaybackSerialiserFlavorBase to PlaybackFlavorBase - Renamed PlaybackSerialiserFlavorRegistry to PlaybackFlavorRegistry - Added PlaybackFlavorRegistry to TASmodRegistry - Continued on PlaybackFlavorBase
Note to self: |
fdf1953
to
17beb2a
Compare
17beb2a
to
91af4a2
Compare
- Added better container handling to flavor base - [PlaybackController] Removed tick field from TickInputContainer and added it to serialiser - [VirtualInput] Made toString() public
Note to self: |
- File reading to playback metadata - [PlaybackController] Changed setInputs to clear and add the inputs
- [PlaybackSerialiser] Added support for null values in Camera Angle
- Enabled DesyncMonitorFileCommandExtension by default
852d17a
to
86c5c52
Compare
This removes duplicate code in PlaybackMetadataRegistry, PlaybackFileCommandsRegistry and SerialiserFlavorRegistry - Moved TASmod specific configuration out of MCTCommon and created TASmodConfig - Added AbstractRegistry to Networking and Config - Renamed package "MCTCommon/server" to "MCTCommon/networking" - Added package registries - Renamed TASmodRegistry to TASmodAPIRegistry - Moved TASmodKeybinds to registries package - Moved TASmodPackets to registries package - Added seperate loading method for config. This is necessary as ConfigOptions need to be registered first
- This will only store files up to the stop index for savestate purposes
- Added EventSavestate, EventVirtualInput, EventTickratechanger
Note to self:
|
Metadata now looks like this: ---------------------- Test1 --------------------- Test1:This is a test ---------------------- Test2 --------------------- Test2:This is another test
Note to self:
|
Removed a lot empty slots from the file - [VirtualInput] Added #isEmpty() - Fixed currentLine not containing the rough line during serialisation
e80f464
to
d3a11d8
Compare
- Renamed PlaybackSerialiser to PlaybackSerialiserOld - Added documentation to PlaybackSerialiser - Removed BetaFlavorTest as that is tested in SerialiserFlavorBase - Fixed tests failing - Organised some imports
- Moved PlaybackMetadataExtension to PlaybackMetadata
🥳 🥳 🥳 🥳 🥳 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part 3 of my ongoing quest to refactor the mod.
While the first PR (#179) was hooking into the vanilla code,
the second PR (#200) was about storing the inputs and metadata in RAM.
In this PR I will tackle the task of storing all the inputs we recorded to the file.
Current
The current system is (as always) a hardcoded mess of stuff somewhat randomly put together...
Now with a bit more experience under my belt, I should be able to upgrade whatever I wrote 3 years ago...
Changes
PlaybackSerialiser
The serialiser has been completely rewritten to support the new subtick format that was introduced in #179.
Alpha
In Alpha, every line contained one tick, with the mouse being the only peripheral that supported subticks (in square brackets).
Monitoring was put at the end of the line in a comment, with an infuriating ~& inbetween, which was the only way for me at the time to seperate data from comments.
Overall the file format looks very messy.
Beta
Now in the beta, subticks are denoted with a TAB at the beginning, while the start of the tick is without it.
Keyboard, Mouse and Camera indicators have been removed as well as the ~& at the end of the file.
Monitoring is now done via "File Commands", which can be turned off if necessary.
Relative input
For cursor and camera angle, it is now possible to put ~ in front of your value (e.g. ~45), instead of hard values.
This will change the value relative to the previous value (e.g Add 45 units).
API
This PR adds 3 new registries related to serialisation.
PlaybackMetadata
Enables you to store things in the header of the TASfile
Register this with
TASmodAPIRegistry.PLAYBACK_METADATA.register(new YourMetadataExtension())
The resulting header in the TASfile should contain something similar to this:
PlaybackFileCommands
File commands are additions to the TASfile in the form of
$name(args);
for extended functionality.In Alpha, this was done using a system named "control bytes" made by @PancakeTAS.
It was possible to add certain lines to the TASfile, which executed functionality when the playback ran over that tick.
$interpolation on/off
: Turns on/off interpolation for playback$hud on/off
: Turns on/off hud during playback$info off/String
: Adds a box to the top left with a custom stringThis functionality has now been moved to file commands:
interpolation: Removed, as interpolation is now handled by subticks, you can delete the camera angle subticks to selectively turn off interpolation.$hud(true|false);
: Same as before$label(String)
: To turn off, leave the String empty.Additionally, desyncMonitoring was implemented during Alpha versions by being hardcoded at the end of the lines.
As seen in the examples above, desyncMonitor is now a file command.
File commands have the benefit, that they are easily extendible and can be turned off if needed.
Other specifications:
//$hud(false); $info();
//$hud(true); This is a comment
1File commands in these comments are only performed on the whole tick.
Similar to MetadataExtensions, you can create your own by extending
PlaybackFileCommandExtension
and registering it withTASmodAPIRegistry.PLAYBACK_FILE_COMMAND.register(new YourFileCommandExtension())
.Flavors can be turned off with
/filecommand <fcname>
, while/filecommand
shows, which fcs are enabled.SerialiserFlavor
If you want TASmod to support an entire new TASfile syntax, then you can create a new flavor2 by extending
SerialiserFlavorBase
and registering it withTASmodAPIRegistry.SERIALISER_FLAVOR.register(new YourFlavorExtension)
;You can specify the flavor during the
/saveTAS
command:/saveTAS <name> [flavor]
. When specifying a flavor, it will be set as the default, so the second save will not need the flavor.The defaultFlavor is currently called "beta1".
Renames
Fixes
TODO
CustomSerialisers
PlaybackExtensions
Footnotes
File commands can appear after or inbetween a comment, but when saving, file commands will be moved to the beginning of the file. ↩
It's called flavors, as markup languages like Markdown are not entirely the same across websites and apps. These versions are called "flavors". For example the github flavor of Markdown supports footnotes, while other flavors do not. ↩