Open genaray opened 4 years ago
Man you are an idea machine. Appreciate the posts. I'm reading it in backwards order.
Do you have any usecases of ReactiveSystem? I'm looking for a reason why everyone should be using this (and it should be integrated in core instead of a plugin). It feels fairly specialized.
A command pattern might improve the design to preserve order of operations, otherwise you get strange behavior when somebody adds, deletes and adds again. Something like what the operations plugin does (functionally very close to this but currently no callbacks). https://github.com/DaanVanYperen/artemis-odb-contrib/wiki/Operations-Plugin
Well its me again... yeah i know, but i recently used Unitys ECS and came across [CommandBufferSystems] (https://docs.unity3d.com/Packages/com.unity.entities@0.4/manual/entity_command_buffer.html).
Those are used to "buffer" the creation, destruction and composition of entities, great if you wanna create a bunch of entities at the start of the frame for example. Or if you have multiple threads working on entities.
As i did for the Job-System Feature Request, i came along my own implementation aswell. It would be great if artemis ODB would provide such "simply" but "essential" tools itself :) Its honestly a pain to take care of that, but i hope that my "idea" of the buffer system is a good point to start.
Currently im using it in my own game, there probably still some little bugs. I havent found a nice solution for buffering changes to component attributes... but the current implementation should do the trick for the first.
Dont get confused by all the maps, buffered maps contains all buffered elements for entites not existant yet. And the other maps ( without buffered in their name ) contain buffered elements for already existing entities. The system either uses the artemis entity id for applying buffered changes to existing entities or generates a internal id for the buffered creation of entities, that one is also used to modify the buffered entities.
Here a little example of how to use this buffer system ;)