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

bincode breaks Enums #12

Open
KuSpa opened this issue Aug 27, 2021 · 4 comments
Open

bincode breaks Enums #12

KuSpa opened this issue Aug 27, 2021 · 4 comments

Comments

@KuSpa
Copy link
Contributor

KuSpa commented Aug 27, 2021

The change from JSON to bincode introduced here breaks Enum transmissions. Upon receiving one gets the error

ERROR bevy_spicy_networking::client: Failed to decode network packet from [127.0.0.1:9999]: Bincode does not support Deserializer::deserialize_identifier

I set up a small example for verification here.

Reproduce

run

cargo run --package server

run

cargo run --package client

click on the grey server bevy app. Every click broadcasts an MyEnum::A wich cannot be parsed from the client.

@TheNeikos
Copy link
Contributor

You are correct, bincode has some weird restrictions as it is a self-describing format and thus can't work with things like that.

I do consider the use of bincode in that context sub-par, but couldn't find a suitable one. I am open for suggestions!

@KuSpa
Copy link
Contributor Author

KuSpa commented Sep 4, 2021

I don't know whether this is a limitation of bincode as they support Enums, which I verified here.

@TheNeikos
Copy link
Contributor

Yes, as it is able to differentiate the two. As you can see in this issue, this problem is known and probably will not be fixed: bincode-org/bincode#272 (comment)

I am open for alternate defaults. I plan on adding compile-time picking of encoding scheme, but did not get around to do that yet.

@benfalk
Copy link

benfalk commented Sep 5, 2021

I have a rough compile-time encoding scheme plan in my fork, I need to get it into a better place though before I do and then I'll submit a PR for it, been kicking the tires on it with this server mmo project and I've made way to many other changes that I should roll into a separate performance PR

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