-
Notifications
You must be signed in to change notification settings - Fork 18
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
Demo rewrite #74
Demo rewrite #74
Conversation
I think the snapshot would be easier to work with, if it wasn't exposed as an struct Snapshot {
player_input: HashMap<u16, PlayerInput>,
projectile: HashMap<u16, Projectile>,
laser: HashMap<u16, Laser>,
...
} Each field would map each id to the object. |
10cb702
to
aff9b03
Compare
Rebased and with a tool to resave demos, in order to detect differences in parsing/saving. I think it is ready to merge for now. The |
Fixed failed build |
I'm not sure what to do about the 2 failing checks. They appear to be about the Rust edition 2021(?). |
Why does it fail with nightly? 🤔 You can ignore the failure with old Rust for ow. |
A simple |
After the latest change, which has nothing to do with any dependencies, |
Welp, that fixed it again |
3d7d301
to
59359eb
Compare
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.
Looks good to me. Is this ready to merge?
I left a couple of nits, but this can be merged without fixing them. In this case, I'd go over these myself and make a PR. :)
keyframe: bool, | ||
}, | ||
Snapshot(&'a ArrayVec<[u8; MAX_SNAPSHOT_SIZE]>), | ||
SnapshotDelta(&'a ArrayVec<[u8; MAX_SNAPSHOT_SIZE]>), |
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.
Maybe rather &'a [u8]
, I see no reason to make the type more specific.
} | ||
|
||
let mut builder = snap.recycle(); | ||
for size in &self.sizes { |
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.
for size in &self.sizes { | |
for &size in &self.sizes { |
gets rid of the need to dereference below.
Snapshots provide the full game state. In demos, they are used to provide | ||
additional entry points for the stream of snapshot deltas. | ||
|
||
- `data_size` is a positive signed 32-bit integer describing the amount of |
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.
Here and below: nonnegative or positive?
(0 is nonnegative but not positive.)
The `chunk_data` of snapshots and snapshot deltas goes through variable-int | ||
compression once, and twice for messages. |
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.
Does "twice" mean decoded as ints twice, and the resulting bytes are then unpacked using TW variable int encoding a third time if the message has an int?
Or does it only go through int decoding once if the message doesn't contain any integers?
Inner(#[from] reader::ReadError), | ||
#[error("{0:?}")] | ||
Snap(snapshot::snap::Error), | ||
#[error("Uuid item has an incorrect size")] |
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.
#[error("Uuid item has an incorrect size")] | |
#[error("UUID item has an incorrect size")] |
Snap(snapshot::snap::Error), | ||
#[error("Uuid item has an incorrect size")] | ||
UuidItemLength, | ||
#[error("Uuid type id that is not registered")] |
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.
#[error("Uuid type id that is not registered")] | |
#[error("UUID type ID that is not registered")] |
I didn't know about the |
Also add `thiserror` dependency
doc/demo Add variable-int compression
Abstracts away compression, snapshot parsing and applying of deltas
Usage: Find out if the Reader and Writer work as expected. Currently, it does produce a different file on a randomly selected demo. However, I didn't see any visual differences.
`cargo update -p proc-macro2@1.0.51` (two different versions exist in the dependency tree)
Grants access to all header data. Fixes pub attributes and exports. Adjust names of methods on `Reader`.
59359eb
to
1b2be88
Compare
Some relatively minor things like naming might still need to be changed
I haven't tested the demo writing yet, would be appreciated if someone else could do that.
I'm ofc open to changes :)