Whether to consider supporting serialization, as it is required for our project
Now we modify the open source and compile it ourself.
Our modified file list as follows:
libgdx :
gdx/utils/Array.java
gdx/utils/Predicate.java
gdx-ai: gdx/ai/btree/BehaviorTree.java gdx/ai/btree/BranchTask.java gdx/ai/btree/Decorator.java gdx/ai/btree/LeafTask.java gdx/ai/btree/LoopDecorator.java gdx/ai/btree/SingleRunningChildBranch.java gdx/ai/btree/Task.java
Please select the affected platforms
- [ ] Linux
You're fully allowed to modify libGDX under the terms of its license. You'll have to be more specific for what you mean by "supporting serialization," because libGDX does support serialization via JSON or XML, using classes present in libGDX. We don't use java.io.Serializable because its use is generally discouraged by Java experts, like Joshua Bloch: https://stackoverflow.com/a/53889695/786740
Yes,Now our project is using java.io.Serializable. When I tried to use com.badlogic.gdx.utils.Json to serialize the object com.badlogic.gdx.ai.btree.BehaviorTree, StackOverflowError is occurred , maybe there is a circular dependency
I'm guessing something needs to be marked as transient to avoid a circular dependency, I just don't know what. Also, I can't merge PRs or commit to gdx-ai any more, and I don't know who can (and who cares about gdx-ai at all these days). Comments in gdx-ai suggest approaches that use Kryo ( https://github.com/EsotericSoftware/kryo ) for serialization.
I'm guessing something needs to be marked as
transientto avoid a circular dependency, I just don't know what. Also, I can't merge PRs or commit to gdx-ai any more, and I don't know who can (and who cares about gdx-ai at all these days). Comments in gdx-ai suggest approaches that use Kryo ( https://github.com/EsotericSoftware/kryo ) for serialization.
Thanks, i will try to use kryo