Decoupling UI event handler and game simulation #912
Labels
C-Project
A larger project, more suitable for experienced contributors.
S-Moderate
The fix or feature would substantially improve user experience.
T-UI
Involves the user interface.
Z-Feature
A new feature to be added to the game.
Z-Performance
This issue concerns memory or time efficiency of the Swarm game.
Z-Refactoring
This issue is about restructuring the code without changing the behaviour to improve code quality.
Is your feature request related to a problem? Please describe.
When the game is running slow, as with the game of life scenario, the UI is not responsive.
Describe the solution you'd like
The game simulation, e.g. the robot ticks, should happen in a dedicated thread, outside of the brick event handler.
However this is presently not possible because of the tight coupling between UI and Game state.
In order to achieve this feature, it seems like we need to:
handleEvent :: BrickEvent Name AppEvent -> EventM Name AppState ()
tohandleEvent :: GameState -> BrickEvent Name AppEvent -> EventM Name UIState ()
.signal
callback so that the UI can change the GameState, e.g.signal Pause
.The text was updated successfully, but these errors were encountered: