diff --git a/apps/amethyst/lib/api/game.ex b/apps/amethyst/lib/api/game.ex index 6f651f3..4cca9a2 100644 --- a/apps/amethyst/lib/api/game.ex +++ b/apps/amethyst/lib/api/game.ex @@ -31,6 +31,9 @@ defmodule Amethyst.API.Game do `login/3` is called when a new player logs into a game instance. You may either :accept or :reject the player for whatever reason, avoid rejecting the player in your default game as that will disconnect the player. + + Note that if no new players can join for any reason, your game should return false from `joinable?/1`. + The PID received in 'from' will be the one that calls all callbacks caused directly by this player, such as their movement or interactions -- You can expect that PID to never be used by any other player and that this same diff --git a/apps/amethyst/test/game_coordinator_test.exs b/apps/amethyst/test/game_coordinator_test.exs index 160b64c..5963864 100644 --- a/apps/amethyst/test/game_coordinator_test.exs +++ b/apps/amethyst/test/game_coordinator_test.exs @@ -13,7 +13,7 @@ defmodule GameCoordinatorTestGame do @impl true def login(from, cfg, refs) do - :ok + :accept end @impl true diff --git a/apps/example_game/lib/example/game.ex b/apps/example_game/lib/example/game.ex index 78df9f7..247039e 100644 --- a/apps/example_game/lib/example/game.ex +++ b/apps/example_game/lib/example/game.ex @@ -12,7 +12,7 @@ defmodule Example.Game do def login(from, cfg, refs) do Logger.info("Player logged in from #{inspect(from)}: #{inspect(cfg)}") Logger.info("The refs for this game are #{inspect(refs)}") - :ok + :accept end @impl true