Skip to content

Using serde to save the world#23

Open
ReCore-sys wants to merge 3 commits intomasterfrom
feature/serde-world-format
Open

Using serde to save the world#23
ReCore-sys wants to merge 3 commits intomasterfrom
feature/serde-world-format

Conversation

@ReCore-sys
Copy link
Copy Markdown
Contributor

This PR swaps the world format to a serde-based approach for better compatibility with other libraries

Description

Currently we use bitcode for serialization which works fine, but has the major issue of not working with 3rd party libraries. This means we can't really store any data types that aren't from the standard library or us, so no dashmaps, bevy_math types, etc. This PR swaps it to use serde, but stil using bitcode as the actual serializer. This keeps a good chunk of the speed from bitcode while adding 3rd party lib compatibility.

It is about 3-10x slower, but thats absolutely dwarfed by the compression step so it's not a big deal unless someone invents a compression algorithm that can hit gigabytes of throughput.
The normal bitcode encoder is still used for player data mostly cos I CBA dealing with serde's lifetimes nonsense.

Main reason for all of this is to get started on storing entities.

How has this been tested?

World seems to load fine and benchmarks don't crash

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (restructuring code, without changing its behavior)

Checklist:

  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Clippy passes with no warnings.

@ReCore-sys ReCore-sys added enhancement New feature or request refactor Something isn't right in terms of orgnisation labels Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request refactor Something isn't right in terms of orgnisation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant