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
598 stars 69 forks source link

Only execute one layer of commands at once #110

Open z0w0 opened 7 years ago

z0w0 commented 7 years ago

Currently in stepModel, here, the engine will continously execute the update function of a game and recursively execute any commands returned by the engine user and then pass them to stepModel again. This would be fine if commands were executed on a separate thread, but in order to support the case of engines that have to be run on the main thread, they are not. To prevent the rendering process from being blocked, the stepModel function should only run the first Cmd returned from the update function, and queue the rest. This will cause some delay but will ensure that rendering always processes in the case of an engine user writing an infinitely-looping command tree.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/39923094-only-execute-one-layer-of-commands-at-once?utm_campaign=plugin&utm_content=tracker%2F290443&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F290443&utm_medium=issues&utm_source=github).