Put the Pieces Together
Explore how process supervision coordinates game processes in Elixir using GameSupervisor and GenServer. Understand the impact of supervised process restarts on game state, how state can be lost after crashes, and why maintaining persistent state is important for robust applications.
We'll cover the following...
We'll cover the following...
New IEx session
Now that we have all the pieces assembled, let’s see how they all work together in IEx.
We start by aliasing the Game and GameSupervisor modules:
alias IslandsEngine.{Game, GameSupervisor}
Now we can use the GameSupervisor.start_game/1 function to start a new game:
{:ok, game} = ...