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

Serializing/Deserializing Relations #25

Open
TheSamsa opened this issue Jun 29, 2024 · 7 comments
Open

Serializing/Deserializing Relations #25

TheSamsa opened this issue Jun 29, 2024 · 7 comments

Comments

@TheSamsa
Copy link

Hey,

right now I'm trying out some ECS for a little pet project of mine. Even though it is no game I thought I try out some ECS out of curiosity.
I fiddled around a bit to get the serialization working, after which I was testing if Relations can also be serialized. Because somewhere in the docs I read relations are special components.
But after a short test it seems they are not beeing serialized.
Is this intentional or did I do something wrong?

Also, as far as I could see I can only serialize 16 components for any Entity (A, B, ..., P). Any way to increase the components serialized?

@zakarumych
Copy link
Owner

Hi!

Serialization currently serializes only components, relation are special components under the hood, but you can't name them to serialize.
So relations serialization would have to be handled in the serialization module.

It is the most undeveloped feature :)

@TheSamsa
Copy link
Author

Thank you!

I am however not sure what you mean by "So relations serialization would have to be handled in the serialization module."
Is it possible to serialize relations right now, or do you mean it's something that has to be prepared first?

@zakarumych
Copy link
Owner

It is something that needs to be handled on library.
So currently you can't serialize relations

@TheSamsa
Copy link
Author

Thanks again.

Some ideas about this, or is this not yet fleshed out? Maybe I can look into this!

@zakarumych
Copy link
Owner

Just an oversight mostly.
Inside the lib it is possible to manipulate relations as components.

The only problem is to decide when to serialize relation.
Should it be serialized if only one entity of the pair passes the filter.
If yes, should the other one forced to be serialized? With or without its own components? etc

@TheSamsa
Copy link
Author

I will look into the implementation, maybe I can provide something. Not sure though.

And just as a gut feeling:
The relation should be serialized if only one entity is filtered.
And the other one should not be serialized, since it didn't pass the filter.

@zakarumych
Copy link
Owner

zakarumych commented Jun 29, 2024

If only one entity and relation will get serialized, then on deserialization, if second entity is not already present, relation must be dropped immediately, as relation can exist only on both entities at once.

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

2 participants