You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am wondering whether we can make the templates serializable, specifically, serializable with DataContractSerializer and BinaryFormatter. By storing the template in resources instead of hard-code in C# one by one, it will definitely make the built-in template more useful when we are serializing a game scene.
I am also wondering whether we can add a list/array of FixtureTemplate in BodyTemplate, which allows us to store only one BodyTemplate to create on body. Now we need to specify a BodyTemplate and attach several Fixtures. Also this does the same as FixtureTemplate, which contains a Shape (or ShapeTemplate, please below). The final goal is to make template easier to use, especially more friendly to game scene serialization.
If you think it's reasonable, I can make a pull request. This requires the following work:
Add attributes to classes and properties.
Add default constructors.
Change Shape in FixtureTemplate to ShapeTemplate, and Body to BodyTemplate in JointTemplate. Compared with their templates, Shape and Body are difficult to serialize.
Add an array of FixtureTemplate in BodyTemplate.
Add a helper function in Factory class to create Body and Joint objects in a World.
This may requires more tests, but I don't have a clear idea on how to do that yet. What are your suggestions?
Thanks.
The text was updated successfully, but these errors were encountered:
My team did this with an earlier version of Farseer. If you request I can upload it to a new fork for your reference. We put DataContract directly into the Body and Fixture class you'd just have to search for it. Fixtures can be generated from the state in body, and/ or directly serialized. We had created content before finalizing it, and maybe it is not ideal code, but the result is serialization in .net with reasonably sized files and decent level-loading performance. The best part is that is is 99% tagging the non-derivative state and super easy to maintain with customization to the engine. This could be merged into the main branch because its mostly just tags and helps to see what is minimal description of physical state and what is cache state.
Hi,
I am wondering whether we can make the templates serializable, specifically, serializable with DataContractSerializer and BinaryFormatter. By storing the template in resources instead of hard-code in C# one by one, it will definitely make the built-in template more useful when we are serializing a game scene.
I am also wondering whether we can add a list/array of FixtureTemplate in BodyTemplate, which allows us to store only one BodyTemplate to create on body. Now we need to specify a BodyTemplate and attach several Fixtures. Also this does the same as FixtureTemplate, which contains a Shape (or ShapeTemplate, please below). The final goal is to make template easier to use, especially more friendly to game scene serialization.
If you think it's reasonable, I can make a pull request. This requires the following work:
This may requires more tests, but I don't have a clear idea on how to do that yet. What are your suggestions?
Thanks.
The text was updated successfully, but these errors were encountered: