heinrich5991 / libtw2

Some Teeworlds stuff in Rust.™
Apache License 2.0
50 stars 16 forks source link

Demo rewrite #74

Closed Patiga closed 10 months ago

Patiga commented 1 year ago

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 :)

Patiga commented 1 year ago

I think the snapshot would be easier to work with, if it wasn't exposed as an Iterator or single HashMap, but instead as a struct with a HashMap for each snap object type.

struct Snapshot {
    player_input: HashMap<u16, PlayerInput>,
    projectile: HashMap<u16, Projectile>,
    laser: HashMap<u16, Laser>,
    ...
}

Each field would map each id to the object. That struct could be generated using the gamenet python scripts, which I'm not familiar enough with. (The fields could be suffixed with an s for a more intuitive plural form, but that wouldn't work all that well with all names)

Patiga commented 11 months ago

Rebased and with a tool to resave demos, in order to detect differences in parsing/saving. Currently, it doesn't produce the same file, but visually the demo seemed correct. It would require further investigation, maybe Kaitai could help.

I think it is ready to merge for now. The gamenet and demo crate will be more actively used by me now, so maybe I'll need to develop this further soon.

Patiga commented 11 months ago

Fixed failed build

Patiga commented 11 months ago

I'm not sure what to do about the 2 failing checks. They appear to be about the Rust edition 2021(?). Should I try to lower the Rust version @heinrich5991?

heinrich5991 commented 11 months ago

Why does it fail with nightly? 🤔

You can ignore the failure with old Rust for ow.

Patiga commented 11 months ago

A simple cargo update fixed the failed build. If preferred, I could probably also only run the command for proc_macro.

Patiga commented 10 months ago

After the latest change, which has nothing to do with any dependencies, rustc-serialize fails to build on ubuntu-latest, nightly??? I'll try another cargo update -p rustc-serialize, but I feel like I'm fixing symptoms of something I have no control over.

Patiga commented 10 months ago

Welp, that fixed it again

heinrich5991 commented 10 months ago

I didn't know about the binrw crate. It looks pretty nice: https://docs.rs/binrw/0.13.3/binrw/.