-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Right now when you develop a game, you store the state of the game in a plugin variable. This was done for pragmatic purposes and to help users get familiar with how to store state in a plugin.
The issue with this approach is that the game state will die with the Erlang process. This violates Erlang's "Let it Crash" philosophy. We want the game process to be able to crash but the state of the game be preserved. The general way to do this in Erlang is to externalize the state somehow where it can be isolated or even persisted.
One simple way to do this might be to have some kind of GameState Agent. Or use something like ETS tables. We are not Elixir or Erlang experts so we're open to solutions that accomplish the goal.
Ideally it could be done in a way that requires no changes to the Game API or minimizes them. Those tradeoffs could be discussed.
This is not an urgent issue but would be a welcome contribution to make gamebox more reliable.
If we support Host Functions by this point, the set_state and get_state functionality could be implemented in Elixir and passed as a host function to the plug-in to call.