You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Based on the idea about component proxies in bitECS intro, I put together a little pattern for wrapping simple queries (queries that don't use e.g. Changed, Not, enterQuery, exitQuery) over "component bundles" (taken from Bevy ECS language -- just a plain JS object containing bitECS components) into a .forEach style api that let's you supply a function that allows you to access/mutate all of the entities matching the query via a proxy object that has all of the fields of the various components in the query. But the best part is that it's all typed, so you get intellisense inside the function to help you make sure you are only accessing components available on the entity, to give you autocomplete about available properties on each component, and all that nice stuff.
createComponentForEachSys-2022-06-12_12.59.45.mov
Here's a gist of the code, I hope someone finds it useful.
@NateTheGreatt -- I'd be down to work with you to try to wrap this functionality into a PR if it would be desirable, but are you no longer working on this project? I've seen references to "webecs"-- is bitECS deprecated and it's not recommended to be investing time building new tooling around it? I've been having fun with bitECS, if you have something new in the works I'll be excited to see it :-)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Based on the idea about component proxies in bitECS intro, I put together a little pattern for wrapping simple queries (queries that don't use e.g.
Changed
,Not
,enterQuery
,exitQuery
) over "component bundles" (taken from Bevy ECS language -- just a plain JS object containing bitECS components) into a.forEach
style api that let's you supply a function that allows you to access/mutate all of the entities matching the query via a proxy object that has all of the fields of the various components in the query. But the best part is that it's all typed, so you get intellisense inside the function to help you make sure you are only accessing components available on the entity, to give you autocomplete about available properties on each component, and all that nice stuff.createComponentForEachSys-2022-06-12_12.59.45.mov
Here's a gist of the code, I hope someone finds it useful.
https://gist.github.com/bcolloran/a58866b3633aadb0aff76d9feb781e1
@NateTheGreatt -- I'd be down to work with you to try to wrap this functionality into a PR if it would be desirable, but are you no longer working on this project? I've seen references to "webecs"-- is bitECS deprecated and it's not recommended to be investing time building new tooling around it? I've been having fun with bitECS, if you have something new in the works I'll be excited to see it :-)
Beta Was this translation helpful? Give feedback.
All reactions