bevyengine / bevyengine/bevy

Reflection: support "sparse" serialization / deserialization, that only includes changed values

Open
#5,562 0 comments 1 reaction 0 assignees View on GitHub
A-Reflection C-Feature
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## What?

We should have a ser/de implementation that can "diff" against a "base instance" of a struct (could be a user-provided instance, or Default, ...).

The serializer should only encode fields whose values differ from the "base instance".

The deserializer should take an existing instance, and just update the values of any fields it encounters.

## Why?

This has many applications:
- networking: send "sparse" messages that only contain data that has changed
- saving/loading settings, user preferences: only put values that were customized into the config files
- scenes, game saves: save space by only encoding things that are different from the defaults

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by reviewing Bevy's existing serialization and deserialization entry points, then determine how a base instance and an existing target instance should be supplied. Done means changed fields alone are encoded and decoded values update the supplied instance without replacing unchanged fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.