asobi_world_lobby (asobi v0.35.4)
View SourceSummary
Functions
Create a new world for the given mode (no owner — anonymous create).
Create a new world for the given mode and tag the player as owner.
Find a running world with capacity for the given mode, or create one.
The non-serialized implementation. Only asobi_world_lobby_server
should call this — direct callers race. Exposed because the
serializer holds no state and just delegates back here.
List all running worlds.
List running worlds with optional filters: mode, has_capacity.
Functions
Create a new world for the given mode (no owner — anonymous create).
Create a new world for the given mode and tag the player as owner.
Refuses with {error, world_capacity_reached} when the global cap
(asobi:world_max, default 1000) is hit, and {error, player_world_limit_reached}
when the player is already at the per-player cap (asobi:world_max_per_player,
default 5). The cap is enforced via a pg group joined on creation so it
naturally clears when the world process dies.
Find a running world with capacity for the given mode, or create one.
Calls go through asobi_world_lobby_server to serialize concurrent
requests. The naive list-then-create sequence has a TOCTOU race:
two callers both see list_worlds = [], both call create_world,
and both clients end up in different worlds despite asking for the
same mode. Serializing closes the window.
The non-serialized implementation. Only asobi_world_lobby_server
should call this — direct callers race. Exposed because the
serializer holds no state and just delegates back here.
-spec list_worlds() -> [map()].
List all running worlds.
List running worlds with optional filters: mode, has_capacity.
-spec player_owned_world_count(binary()) -> non_neg_integer().