-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Changed" iterable in archetype? #154
Comments
Hi again! Thanks for the kind words, I am happy that you are enjoying the library. I need to think about this a little. From my gut, I would say that you could model this with the current tools by hooking into an archetype's const withHealth = world.archetype("health")
withHealth.onEntityAdded.add((e) => world.createEntity({ entityAdded: e }))
withHealth.onEntityRemoved.add((e) => world.createEntity({ entityRemoved: e }))
/* etc. */ Would that help in your situation? (Addendum: these events are currently internal and thus not documented, and might change in signature or implementation, so I wouldn't currently recommend hooking into them, but I'd be happy to promote them to an official feature.) |
Thanks for the reply. Ye I think it would be great if you made them public they are useful for many things such as hooking into existing libraries and runtimes. Ye I thought it would be possible to do the archetype in userland but I was wondering if you had any thoughts on best-practices, should you handle entity additions inline-rather than out-of-band so that everything is deterministic and system-order is preserved. See this example from BitECS for how its managed there: https://github.com/ourcade/phaser3-bitecs-getting-started/blob/master/src/systems/sprite.ts#L22 |
I accidentally stumbled over a great pattern while working on 2.0 that I think will solve this nicely. Stay tuned! |
Firstly really nice work with this library!
I am in the process of looking for something new for our game battletabs.com and have been working my way through all the options listed here: https://github.com/noctjs/ecs-benchmark. Although I would love to get the best performance I can I just don't like the developer experience sacrifices that you have to make to make it as performant as an SoA implementation and quite frankly I dont think our game needs that level of ultra-performance.
One thing I was wondering about however was that bitecs has a concept of a "changed" query (https://github.com/NateTheGreatt/bitECS/blob/master/docs/INTRO.md#-query). This means that you handle entity additions and removals from an archetype within your main system loop rather than having some systems activated out-of-band.
What are your thoughts on this?
The text was updated successfully, but these errors were encountered: