anticitizn / solnce

A (prospective) 2D space strategy game
2 stars 0 forks source link

Entity Serialization System #3

Open anticitizn opened 1 year ago

anticitizn commented 1 year ago

Ability to save and load arbitrary Entities and their Components

Mark the difference between an Entity Saving System and a more general Save System. The former's purpose is to serialize the data for one entity, while the latter's is to save overall game state.

Entity exporting might need to be tightly coupled to the ECS system since that's where the data is stored.

Use the Coordinator to fetch all Components for an Entity and call each one's export function. All of the components then get saved into a single XML container.

anticitizn commented 1 year ago

Cereal and other major serialization libraries appear to be very unconvenient for this. Will use pugixml and manually construct a user-friendly XML file instead

anticitizn commented 1 year ago

Small prototype added to the windows branch

anticitizn commented 1 year ago

Working system in master

anticitizn commented 1 year ago

The current macro implementation is crap, it's a bad idea to couple variable names to the serialization output