For the behavior tree editor I need to save the modified trees somewhere and somehow. After looking into code and some chats on IRC, I came up with the following solution. Just want to talk about its pros and cons.
The behavior trees are normal assets. They are serialized into a hierarchical json structure. Using the ingame editor you can modify every behavior tree asset that is included in any active module. You may even create new trees, that become a new asset.
The worst solution is to overwrite the asset files. We don't need to talk about this, I think But the engine has an asset override mechanism. Using this, you can override any existing asset in your module. All you need to do is place the modified file into a directory below 'overrides' in your module (example).
So, when the editor needs to save a changed asset from module 'foo', a new asset is stored to the correct override directory in a special module (called 'Behaviors' for now).
Completely new behavior trees are stored into the normal asset directory of 'Behaviors'.
Now, if you set this special module as a dependency of your module, the modified assets will be loaded automatically.
To get rid of all modifications, just delete the Behaviors module. Its even possible to use git to have a history of all modifications you made (mh.. even committing changes from ingame should be possible somehow :-D).
The bad thing right now is, the write file to directory in this special module code is "hardcoded", though not very flexible or reusable (its not much code anyways, but it just does not look that good).
To create the special module for the behavior editor use:
All required subdirectories are created on demand, so saving will work without the module.
The behavior trees are normal assets. They are serialized into a hierarchical json structure. Using the ingame editor you can modify every behavior tree asset that is included in any active module. You may even create new trees, that become a new asset.
The worst solution is to overwrite the asset files. We don't need to talk about this, I think But the engine has an asset override mechanism. Using this, you can override any existing asset in your module. All you need to do is place the modified file into a directory below 'overrides' in your module (example).
So, when the editor needs to save a changed asset from module 'foo', a new asset is stored to the correct override directory in a special module (called 'Behaviors' for now).
Completely new behavior trees are stored into the normal asset directory of 'Behaviors'.
Now, if you set this special module as a dependency of your module, the modified assets will be loaded automatically.
To get rid of all modifications, just delete the Behaviors module. Its even possible to use git to have a history of all modifications you made (mh.. even committing changes from ingame should be possible somehow :-D).
The bad thing right now is, the write file to directory in this special module code is "hardcoded", though not very flexible or reusable (its not much code anyways, but it just does not look that good).
To create the special module for the behavior editor use:
Code:
./gradlew createModuleBehaviors