Let's say I have 3 different Streams:
I want the value of a Cell
cTransform to be:
affected by sInput and sPhysics
calculated only by sPhysics
observed by sRender
What would be the idiomatic way to structure this with Sodium?
To clarify the question, it may help to present a real-world use case...
Input events like mouse movement should affect cTransform directly, but because they can happen very frequently and don't actually mean anything unless it's also a physics or render step, they shouldn't really do anything until they're actually needed. On the other hand, they can't simply be tossed away.
Physics steps might be synonymous with render, but it should be adjustable.
If Physics is a separate step than rendering, Rendering shouldn't calculate anything - just draw it.
An event-driven solution to this (using pseudo-js syntax) could be something like:
addEventListener('mousemove', evt => mostRecentMouse = [evt.x, evt.y]);
addEventListener('physics', evt => transform = updateTransforms(evt.physicsTime, mostRecentMouse));
addEventListener('render', evt => draw(transform));
As you can see, mouse events are only sampled and cached (which is cheap) until physics steps (which are expensive).
Along with the question of how to structure this with Sodium - do you think this is a good approach to a game loop with FRP?