asobi_world_server (asobi v0.35.4)

View Source

A persistent, zoned world: the gen_statem behind large session games (game_type = "world"). It partitions space into a grid of asobi_zone processes, moves players between zones as they travel, runs a world-level post_tick, and drives voting. Use it for MMO-style shared spaces; for transient matches use asobi_match_server instead.

Summary

Functions

callback_mode()

-spec callback_mode() -> gen_statem:callback_mode_result().

cancel(Pid)

-spec cancel(pid()) -> ok.

cast_vote(Pid, PlayerId, VoteId, OptionId)

-spec cast_vote(pid(), binary(), binary(), binary()) -> ok | {error, term()}.

finished/3

-spec finished(gen_statem:event_type() | enter, term(), map()) -> gen_statem:state_enter_result(atom()).

get_info(Pid)

-spec get_info(pid()) -> map().

init(Config)

-spec init(map()) -> {ok, atom(), map()}.

join(Pid, PlayerId)

-spec join(pid(), binary()) -> ok | {error, term()}.

join(Pid, PlayerId, SessionPid)

-spec join(pid(), binary(), pid()) -> ok | {error, term()}.

leave(Pid, PlayerId)

-spec leave(pid(), binary()) -> ok.

loading/3

move_player(Pid, PlayerId, NewPos)

-spec move_player(pid(), binary(), {number(), number()}) -> ok.

post_tick(Pid, TickN)

-spec post_tick(pid(), non_neg_integer()) -> ok.

reconnect(Pid, PlayerId)

-spec reconnect(pid(), binary()) -> ok | {error, term()}.

running/3

-spec running(gen_statem:event_type() | enter, term(), map()) -> gen_statem:state_enter_result(atom()).

spawn_at(Pid, TemplateId, Pos)

-spec spawn_at(pid(), binary(), {number(), number()}) -> ok.

spawn_at(Pid, TemplateId, Pos, Overrides)

-spec spawn_at(pid(), binary(), {number(), number()}, map()) -> ok.

start_link(Config)

-spec start_link(map()) -> gen_statem:start_ret().

start_vote(Pid, VoteConfig)

-spec start_vote(pid(), map()) -> {ok, pid()} | {error, term()}.

terminate/3

-spec terminate(term(), atom(), map()) -> ok.

use_veto(Pid, PlayerId, VoteId)

-spec use_veto(pid(), binary(), binary()) -> ok | {error, term()}.

whereis(WorldId)

-spec whereis(binary()) -> {ok, pid()} | error.