GodotECS / godex

Godex is a Godot Engine ECS library.
MIT License
1.21k stars 68 forks source link

Add Systems cache and improve the changed mechanism #249

Closed AndreaCatania closed 3 years ago

AndreaCatania commented 3 years ago

Cache

void my_system(Query<TransformComponent> &p_query) {}

The Query used in a System were recreated each frame. Now they are cached, so it's possible to store some execution information, that will help on the following executions.

Dispatching improved The dispatching method got improved. Not it's necessary to use the Token, generated by the prepare_world function, to dispatch the pipeline on a World. This mechanism ensures the World is always bind to the Pipeline.

Changed mechanism The changed mechanism is not anymore relative to the World. Each System, tracks its component modifications by its own. This new method doesn't suffer of the issue of losing changed notification or capturing it twice.

Improved Scripted System The scripted Systems now use the DynamicSystemExecutionData, (before known as DynamicSystemInfo). It's created when the World is prepared by a Pipeline. This new mechanism removed the hard cap of 500 scripted Systems. Now we can have endless scripted Systems, and the compilation code is much simpler.

AndreaCatania commented 3 years ago

The Windows build is failing because there is a new Scons version that doesn't support has_key. The fix is already applied in godot: https://github.com/godotengine/godot/commit/c191cfbddfa2f26b22f8c3edbc529342cd2fe2e2#diff-2308ebd6c211bc5c868068f7009dca599fcc991b99063393fce0f48d6b172d44 and in order to fix this, we need to update to the latest godot version.

I'm afraid that I'll need to merge this with the failing Windows CI. I'll make sure update godot just after this one is merged.