#bevy-ecs #serialization #bevy #ecs #serde #gamedev

bevy_serde_macros

Macros for easing use of serde on bevy entities and components

4 releases

0.2.2 Nov 29, 2023
0.2.1 Nov 28, 2023
0.2.0 Nov 28, 2023
0.1.0 Nov 27, 2023

#1506 in Game dev

Download history 6/week @ 2024-02-19 2/week @ 2024-02-26 1/week @ 2024-03-11 75/week @ 2024-04-01

76 downloads per month

MPL-2.0 license

14KB
205 lines

bevy_serde_macros

This crate lets you serialize specified components and their associated entities using a "list" of components, as well as the marked entities you wish to serialize. The result is that the intersection of marked entities and specified components are serialized.

Though this currently targets bevy ECS only, other aspects of bevy may be added in the future.

See the tests for usage examples (save_game and load_game). Currently, the list of components is specified by a macro that the user must implement (named execute_with_type_list in the examples).

Acknowledgments

  1. The original inspiration was from Herbert "TheBracket" Wolverson's Rust Roguelike Tutorial (Copyright 2019 Herbert Wolverson (DBA Bracket Productions)).
  2. One of the changes to the tutorial was largely thanks to the addition of execute_with_type_list!, with credit to Michael F. Bryan - see code comments for details.
  3. The code from the tutorial relied on some helper functions from specs (Copyright (c) 2017 The Specs Project Developers), which I had to rewrite for Bevy.
  4. Also thanks to the Bevy community for getting me up to speed on the Bevy ECS.

Dependencies

~11MB
~197K SLoC