Comments (10)
It would be great to have two types of serializers human readable and binary, text serialization is great during development, you can easly check previous versions, merge conflicts, comparing.
from entitas.
Started implementing the core functionality after comparing and trying different approaches.
The idea:
- I’d like to reuse the Inspector for EntityBehaviour we all know from VisualDebugging to create and edit Blueprints
- Provide sth to easily set the format how to serialize Blueprints (XML, YAML, JSON, FlatBuffers, ProtoBuf, ScriptableObject, etc)
- Add a code generator to read all blueprints and generate code for better performance compared to pool.CreateEntity(blueprint), e.g. pool.CreateHero()
- Cache blueprints at runtime when used raw (e.g. loaded OTA) to avoid reflection
You can follow and diff here #84
from entitas.
API sneak peak:
var blueprint = new Blueprint("Hero", e);
e.ApplyBlueprint(blueprint);
from entitas.
Blueprints means serializing and deserializing components. Shall I enforce that every component that can be used with blueprints has to be tagged with [Serializable]
? It would def help to raise awareness that not every type can be easily serialized and that you'd have to provide a converter for those cases
from entitas.
Too bad that Unity's mono version is sooo old. I cannot use built in json and Unity's json implementation is very limited and doesn't support serializing System.Object. Also no public access to Unity's yaml parser...
I guess for now I have to stick with xml 😱
from entitas.
Too bad C++ doesn't have reflection, i can't think on this feature even a bit xD
It could have been worse 😱
from entitas.
Poll
I was thinking if we actually need the option to serialize to different formats like xml, json, etc.
Ok, it's nice that the serialized file is human readable, but it doesn't really need to be.
What about going binary only? The file size might be smaller, parsing might be faster, and we can always edit the blueprints with the Entity Inspector known from Visual Debugging.
It would also work with A/B Testing by providing a new binary file.
The only downside that I see atm is, that C#-only-projects don't have a visual editor for Blueprints and would benefit from a human readable text file.
Two ways to work around this would be
- declaring entities in temp code to generate blueprints and binary files
- Getting the free Unity version to get a visual editor :)
What do you guys think? Can/Should we go binary only?
from entitas.
Maybe binary at first but using an file-access-like interface to allow other formats in the future? (for C#-only)
from entitas.
Personally I don't like to store data files like blueprints in a binary format. Simply because of the quick iterations you get with human readable files. So my vote is on that type of serialization format.
But as @JuDelCo mentioned. The binary way might be the way to go at first?
But in the future It would be really cool to be able to choose the blueprint serialization of your choosing
from entitas.
Update:
I've got the basic mechanic working. In phase 1, you can create new Blueprints as a ScriptableObject which serializes the data in a binary format. The EntityInspector know from VisualDebugging is used to set up the blueprints.
Next step is to support different pools and automatically resolve potential pool and component index mismatches from the deserialized blueprint (when you load an old blueprint and you refactored the pool name or added new components and the index is out of date)
I did lot of profiling and managed to use blueprints without creating garbage.
If you already want to see the first result checkout #84
Happy Easter! :)
from entitas.
Related Issues (20)
- Unity crashes when clicking on a GameObject with Component of Entitas HOT 8
- Remove DesperateDevs dependencies
- [SOLVED] Unity 2022.3.4f1: Exceptions + broken inspector when looking at any entity HOT 16
- Add/Replace/Remove vs Set/Unset HOT 5
- Boolean in setttings for unique components to actually be unique
- A component with multiple contexts +events, only make event listeners for 1 context
- Could not resolve type with token ... expected class System.Threading.CancellationToken HOT 10
- How to generate codes in a project which has several csproj files? HOT 1
- Update on Entitas 2.0-beta and my situation HOT 3
- [1.14.1]code gen twice and compile error HOT 1
- there is a Error, on click Tools/Jenny/Gennerate, how can I do? HOT 4
- _group.GetEntities().AsParallel().ForAll(Execute);这段语句有GC HOT 2
- Is it feasible to use Entitas in the backend? HOT 7
- Entity Behaviour in Unity inspector not visible HOT 2
- Removal of crucial SearchPaths when executing the wiz command
- How to get all group in some context, without reflection。
- GUI Null ref when trying to view entity in inspector HOT 1
- generator issues HOT 1
- Error running dotnet Jenny/Jenny.Generator.Cli.dll gen -v command - System.IO.FileNotFoundException HOT 1
- Bro i want remove this how i remove
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from entitas.