z0w0 / helm

A functionally reactive game engine, with headgear to protect you from the headache of game development provided.
http://helm-engine.org/
MIT License
600 stars 69 forks source link

Change `subscriptionsFn` to take a model as an argument #125

Open astynax opened 6 years ago

astynax commented 6 years ago

Closes #116

astynax commented 6 years ago

@z0w0 you are right, subscriptions should react on model changes. I'll try to dig in this direction

z0w0 commented 6 years ago

@astynax should be able to change stepAction in Helm.hs to change actionSmp to be the result of calling subscriptionsFn with the updatedModel.

Let me know if you'll have the time to do that, otherwise I'll merge and adjust that myself :)

astynax commented 6 years ago

But if you call subscriptionsFn, how this new SignalGen replace the old one inside running Elerea's graph?

z0w0 commented 6 years ago

Hmm, true. It would generate a new graph every time. Probably not ideal.

Ulrar commented 6 years ago

I might be off here, but if the goal is to allow changing subscriptions at runtime, wouldn't be simpler to just allow the use of a Cmd to either delete / create a subscription, or to request the call to the subscription function (i.e. Cmd.updateSubscriptions) ? That way subscriptions would be re-calculated only when needed.