NSSTC / sim-ecs

Batteries included TypeScript ECS
https://nsstc.github.io/sim-ecs/
Mozilla Public License 2.0
88 stars 13 forks source link

Integration with ecosystem #66

Open minecrawler opened 1 year ago

minecrawler commented 1 year ago

Add missing demos for how to integrate sim-ecs into:

All demos should be in the /example folder. Each should get its own directory and show off the library/framework's basic usage example, but with sim-ecs.

Also add integration for the following tools:

If sim-ecs cannot be integrated, please open a PR to adapt sim-ecs, or document why it's not possible below.


*¹: The RPGMaker MV game loop is a mess and the recursion is spread across several methods. From my initial analysis, it would be enough to detour SceneManager.run() and call SceneManager.update() and the ticks manually. On top, SceneManager.requestUpdate() must become a noop. Everything can be driven by IRuntimeWorld.start()

drewww commented 8 months ago

I'm doing a Pixi integration at the moment and might be able to contribute something back when I'm a little further along. So far straightforward -- I'm letting the sim-ecs event loop "lead" and entities have components with Container objects in them that are attached to the pixi scenegraph. Nothing fancy but no major issues yet.

minecrawler commented 8 months ago

Thank you! Pixi is a very good rendering library many projects use, so having a demo for it will be a huge boon. If you have any questions or need help, just drop a message, I try to read my GitHub notifications daily.

drewww commented 8 months ago

Thanks! I might do that. But so far so good -- just churning along productively. I'm finding some ways to decouple Pixi from the ECS components that make sense for me, but may not be generalizable. I'm building a roguelike, so I'm finding it is useful to decouple the stuff that runs at display framerate and letting the ECS systems slow way down and just run once per turn cycle. That may not be useful for others. :D But once my architecture has settled a little more I'll write it up.

dannyfritz commented 8 months ago

Thanks! I might do that. But so far so good -- just churning along productively. I'm finding some ways to decouple Pixi from the ECS components that make sense for me, but may not be generalizable. I'm building a roguelike, so I'm finding it is useful to decouple the stuff that runs at display framerate and letting the ECS systems slow way down and just run once per turn cycle. That may not be useful for others. :D But once my architecture has settled a little more I'll write it up.

FWIW, I have done a tiny bit of work on using Pixi@^8 for rendering from within an ECS. It gets pretty non-trivial when pixi wants a scenegraph for everything or you want to do hierarchies of transformations, but without a tree representation of your data.

And just to be clear, I'm not being modest when I say I've only done a "tiny" amount of work on this. The pixi team on discord has been very responsive to requests for help or even feature requests. But none the less here is some code: https://github.com/dannyfritz/nuthatch/blob/v8-localTransform/lib/src/index.ts

Unfortunately this appears to be the only portion of my local working-tree of sim-ecs experiments that has made its way to GitHub though: https://github.com/dannyfritz/nuthatch/blob/c25e7685f91ac0b39adcf80e725864b722595176/package.json#L17