amethyst / amethyst/legion

Configurable granularity for query change detection

未關閉
#121 0 則留言 3 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Rust
星號
1.7k
分支
140
PR 合併指標
30 天內沒有已合併 PR

描述

Currently, the behavior of the `changed` filter is such that it filters by chunks whose components have been updated. It would be useful if the granularity could be changed based on the user's needs. Here are the useful options I can think of:
* `Chunk`, which exhibits the behavior of the current `changed` filter. The most efficient granularity but also the least accurate.
* `Component`, which filters based on individual components. This could be useful where it is not desirable to iterate over components which have not actually changed. The implementation of this filter brings up some questions:
* A `u32` version for each individual component would have to be stored, which is not ideal for memory usage and cache locality. It may be useful to only store this version where there exists a filter that needs it, although I'm not sure how this could be detected efficiently.
* `ComponentAdded`, which filters on components that have been _added_ to entities since the last query iteration, i.e. components which have been updated using `World::add_component`. I have a use case for this in a project, and its implementation shouldn't be too difficult after the component granularity above is implemented.

This could be implemented by passing a `Granularity` enum to the `changed` filter, or alternatively a different filter function could be implemented for each granularity. I'm not sure which option is superior.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。