dakom
January 28, 2020, 7:14am
1
Does anyone have tips for the following use case?
I want to drive application logic completely outside of Babylon - probably in Rust/wasm. It’ll be using an ECS and reacting to changes might not be so straightforward, rather I’d need a way to sync the ecs state as a whole with babylon right before rendering.
This is just a rough idea, and it’s vague/fragile/under-construction - but conceptually, I’d love to hear some ideas of how to decouple Babylon from state management in an environment that isn’t so “reactive”.
Thanks!
JohnK
January 28, 2020, 6:01pm
2
Hi @dakom and welcome to the forum. For the ignorant (ie me) what do you mean by an ECS, I found over 100 possibilities via google.
@JohnK I think he’s talking about an Entity Component System.
@dakom , welcome to babylonjs! I am new babylon as well, but I am also interested in hearing people’s strategies on managing state.
1 Like
You might want to look into using Observables? I know BabylonJS uses them a bunch to manage reacting to events.
https://doc.babylonjs.com/how_to/observables
I was inspired by this article , maybe you’d find a good jumping off point.
pinging @Deltakosh ?
Edit: Oh hey someone else on the forum kinda agreed with me!
This is an issue I’ve been trying to figure out myself for quite a while. I agree that belfortk’s suggestion of asset containers works for encapsulating assets but I don’t know if it works as well for the logic.
Babylon is pretty flexible when it comes to how you handle your logic, so I’ve tried three options (no big projects so I’m not sure how any of them scale, also keep in mind that I use TypeScript which means I can’t just add methods to defined Babylon classes):
Extending mesh class. W…
2 Likes
dakom
January 29, 2020, 6:39am
5
@JohnK - yeah @belfortk is right, Entity Component System
Hmmm the observables looks interesting! Will look into that